Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Toady
Jan 12, 2009

ErIog posted:

I love the mentality required to write something like this. "Guys..this C++ thing is just a tool of the man that we don't need."

On a somewhat related note, why are many new coders full of distrust and want to roll things on their own? No matter how much you tell them it's a bad idea, they will not listen to you. They'll even be polite about it, but you'll never convince them otherwise.

It's surprising how many people show up to #macdev:
  • Insisting on setting up controls programmatically because using IBOutlets is too magical.
  • Doing their own SQLite3 layer instead of using Core Data.
  • Subclassing everything. If a cell needs to display a sheet when double-clicked, they want to create a whole new table view.

Doing these things doesn't help them learn how things work. It just frustrates them and fills the channel with questions that are usually answered with, "Why are you doing that? Just use so-and-so API."

Adbot
ADBOT LOVES YOU

Toady
Jan 12, 2009

Flobbster posted:

The second one is just foolish, but I can understand the first and the third points. When I made the switch to OS X a few years ago, coming from a Windows development background it took me a little bit of time to really understand how Interface Builder worked differently from, say, the Windows dialog resource editor (:gonk:) or the Windows Forms editor.

The third point might come from that same mindset, where on Windows, almost everything is customized by subclassing and overriding methods. The delegation pattern that OS X makes so much use of is almost nonexistent there, so it's a big mental shift when you first get started.

Now if these are programmers with years of OS X experience wanting to do these things, gently caress 'em.

I'm saying that these new developers know they didn't have to do things manually, but they insist on doing them out of a distrust of the system and a fear of things that seem magical. The common reason I hear is that they want to do everything themselves "to learn," but it doesn't help them learn at all. Avoiding IBOutlets, for example, is just silly and cumbersome.

As for the third point, it's a single method call to set a double-click action for a table view. :)

1337JiveTurkey posted:

We teach new coders how to write programs that open a file, read a character stream from them, parse it and then write it to another file. We don't teach them how to do the same task with an ESB and data binding API. When I graduated from college, I didn't really trust the libraries and frameworks I now consider indispensable because I didn't understand them but I did understand the Unix model and I did understand how to parse character streams. It took experience before I could really appreciate the level of abstraction that they operated at, and I gained some of that experience by reinventing the wheel on occasion.

There's a big difference between that and what I'm talking about, which is avoiding fundamental things like NIB files because IBOutlets (which are just pointers) just don't seem as cool and hardcore as writing out a bunch of pointless setup code that's equivalent to 10 seconds spent in Interface Builder. It's emotion-based programming.

Toady fucked around with this message at 02:06 on Apr 15, 2010

Toady
Jan 12, 2009

Munkeymon posted:

I should have specified that it's not totally unreasonable for a one-man operation.

It seems kind of weird and arbitrary, but that's me.

Toady
Jan 12, 2009

Every time I read $your_favorite_language code or the bizarre things that $your_favorite_language does I wonder how the hell that language caught on. It's like someone's academic experiment that broke out of the lab.

Toady
Jan 12, 2009

Dooey posted:

Am I the only one who finds reading code in mixed styles not a big deal? I always use the same style for my own code, but at work we all have different styles and when I read other peoples code I have no problems at all.

I went through a period where I tried each style to see which one I truly preferred, and after the initial novelty of each one wore off, I didn't find any one more readable than the other, so I just chose one to be consistent.

Mustach posted:

I think that monospace fonts are an eyesore. I sometimes think that people stick to them just so they can pretend their code is some kind of WYSIWYG and waste time with valueless formatting like this:

Fixed-width fonts in Objective-C code let Xcode automatically line up colons in long messages, which is really nice:

code:
BOOL result = [someObject doA:firstArg
                        withB:secondArg
                       usingC:thirdArg
                        error:&outError];

Toady fucked around with this message at 21:35 on Aug 9, 2011

Toady
Jan 12, 2009

There's a relatively well-known thread about goto on the Linux kernel mailing list.

Toady
Jan 12, 2009

Someone on Reddit posted:

I'm a little more familiar with minecraft's internals than the average player, but less so than modders and server administrators. I'm fortunate enough to rub shoulders with these folks and do the odd bit of mc development work myself, and I'd like to point out that Mojang's testing cannot be considered thorough by industry standards.

For those following minecraft, you'll note than 1.8 was released today. On friday, the first public pre-release came out, and yesterday the second was released. For the first time I started actually documenting the protocol with the help of others in #mcdevs on freenode. Here's some fun things we found, all new bugs:

* Chest state (open or closed) is sent twenty times per second per chest, even if the state hasn't changed. This equates to at least 10kB/s network traffic on a medium-sized server plus the processing the client does
* Same deal with the user list. Each user list packet contains the ping time for one user, and these are sent out twenty times per second per user.
* Experience orbs were broken in 1.8pre1 due to notch's horrible, backwards use of OpenGL. It was already known that dropped items cause serious framerate drops, and the inclusion of orbs made this worse. Multiplayer was unplayable. "So what?", you say, "this is a pre-release". This bug was supposedly fixed by jeb, but instead has resulted in experience orb duping
* The new user list renders improperly with Max Players set above 60, and completely fails to render when Max Players is set above 127.
* The new food system has bugs too - if food saturation is above zero, you can happily not eat without your food decreasing. Only if you take damage will your food start to decrease.
* New player effects can easily be manipulated to give users a speedhack. The server-side stuff that used to detect this cheating has been completely removed.
* The new server list incorrectly assumes a server is up if it has been refreshed within 5s

The best bit is that mojang has no bug tracker. Currently the best thing we have is a wiki talk page that contains some 300kB of plain text for 1.8 ALONE!

And I'm glossing over some of the more egregious bugs that went unfixed for many months. One of my personal favourites was the invisible player glitch - where some players were randomly invisible to others. I play on a player-versus-player server where this sort of thing was pure nightmare material. Imagine playing Halo 3 against an invisible sniper.

I'd like to qualify this whole post by pointing out I'm a huge fan of minecraft and mojang. They do some really great work and have created one of my favourite games ever. I can barely comprehend the amount of time I've spent on it and the good friends I've made. But their development process, QA, and relationship with the modding community continues to suck.

EDIT: I encourage anyone from a technical standpoint to have a look at the protocol docs and gaze in wonder. Also worth bearing in mind that the client's network handling is completely tied up with the physics engine and rendering. They all rely on one another - if one lags, so do the others. The server's model is even more lulsy, involving 4 threads being spawned for every user connected. The server I play on regularly accomodates 50 or more players, and I hear off our techadmins that a significant amount of server cpu time is spent context switching.

Toady
Jan 12, 2009

Munkeymon posted:

:wtc: I mean, I paid $9 for a lego simulator and it was fun to mess around with for a few weeks, but I haven't been back in a while. How in gently caress can they not just stop adding retarded features (hunger?) and clean poo poo up for a few months. That's what I would do if people dumped money in my lap, at least.

I suspect the game is difficult to update. Official mod support will be provided in the form of a source code dump, so that should prove interesting to read and will probably lead to unofficial forks. In my opinion, the biggest surprise is the lack of a bug tracker.

Toady
Jan 12, 2009

TasteMyHouse posted:

"an SQL"? I thought everyone pronounced it "Sequel".

The official pronunciation is to say the letters.

Toady
Jan 12, 2009

Jethro posted:

bar has no value, since it is uninitialized, but it can hold a value which is a reference to an object of type Object.

bar doesn't hold a reference a stack-allocated Object?

Toady
Jan 12, 2009

Brecht posted:

No, it is not equally valid, it is not valid at all to say that, this is not what the word or concept variable means and this exactly the point that many people are trying to make clear to you.

I think you're being a little too pedantic here.

Toady
Jan 12, 2009

Munkeymon posted:

My sister will download it and set it as the default browser on Windows machines because she uses a Mac and since Macs come with Safari that means Safari is the best browser and so she will refuse to use anything else if she can help it. It's pretty sad. I imagine other Apple users do the same when, say, they go to work and have to use the Windows workstation the company provides.

What's sad about that if they happen to prefer Safari? In fact, it may become quite useful if the Windows version ties into iCloud.

Toady
Jan 12, 2009

Edit: Whoops, already posted.

Toady fucked around with this message at 20:20 on Oct 11, 2011

Toady
Jan 12, 2009

PrBacterio posted:

I'm sorry, is it bad that I just can't look beyond the horror of actually using COBOL at all in the first place to whatever it is you're trying to show to us here? :stare:

COBOL is not uncommon in the banking industry.

Toady
Jan 12, 2009

Star Warrior X posted:

Are you trying to say that it's common for business-oriented applications?

I mentioned banking because it was banking code that was quoted.

Toady
Jan 12, 2009

qntm posted:

I just want you to know that I laughed at this. The other guy didn't get it, but I did. Well done.

I got it. :)

PrBacterio posted:

I know that. I also know that people still use MUMPS in the medical or insurance sectors or wherever it was used for. I was only saying that that's a horror imo :ohdear:

COBOL today has classes, .NET and JVM support, C bindings, and other useful stuff. I've never had to work with it, but I wonder if it's such a horror to use in practice since so much high-dollar industry still depends on it.

Toady
Jan 12, 2009

It's amusing how many times the developer claims something is fixed, followed by someone posting an exploit to prove it's not. I don't understand why he got mad at that Dan Rosenberg guy, other than bruised ego.

Toady
Jan 12, 2009

He admitted he actually put Rosenberg on ignore, causing him to miss one of Rosenberg's exploit reports.

Jonnty posted:

e: awww this is just cute

It's a tongue-in-cheek reference to this:
http://www.exploit-db.com/exploits/15704/

Toady fucked around with this message at 23:26 on Nov 4, 2011

Toady
Jan 12, 2009

Has there ever been a published book of coding horrors and related mistakes of technology? Like a Darwin Awards of programming?

Toady
Jan 12, 2009

http://stallman.org/archives/2003-may-aug.html:
"[P]rostitution, adultery, necrophilia, bestiality, possession of child pornography, and even incest and pedophilia ... should be legal as long as no one is coerced. They are illegal only because of prejudice and narrowmindedness."

http://www.stallman.org/archives/2006-may-aug.html#05:
"I am skeptical of the claim that voluntarily pedophilia harms children. The arguments that it causes harm seem to be based on cases which aren't voluntary, which are then stretched by parents who are horrified by the idea that their little baby is maturing."

:reddit:

Toady
Jan 12, 2009

pokeyman posted:

Wait, help me out here. Why shouldn't he be a part of software history? Is it because he eats things you find disgusting? Or because you've diagnosed him with a mental illness? I mean, we all know that anyone with a mental illness can't meaningfully contribute to society. Even more so when that illness is diagnosed remotely from an armchair. And I don't like eating beets, so I'd like to throw out anyone who does eat beets.

In my opinion, someone who eats their toe jam in front of people or believes those who write non-free software are unethical and should go "work in factories" and that their children should starve is not all there. He's the ultimate example of rigid idealism at the expense of compassion and practicality. It's understandable that his presence in computing history might be considered abhorrent to some who are embarrassed by him.

Toady
Jan 12, 2009

pokeyman posted:

You certainly wouldn't be the first to diagnose someone acting against the herd as mentally ill. Not only is that diagnosis immediately suspect, it also doesn't make it a relevant factor when acknowledging the guy's numerous contributions to computing.

And it's our history. Embarrassing or not, it's our history, and he's part of it.

Simply acting against the herd isn't why he's considered mentally ill. It's his impractical views and gross public behavior. If you write non-free software for your job, he actually considers you unethical and thinks your children should starve, after he criticizes you for having children at all. While he is a part of computer history, he's a very minor figure compared to other far more influential people he despises, and he is much less important to the world than supporters often proclaim (sorry, GNU/world).

Toady
Jan 12, 2009

The real level of his influence on the computer industry today is an argument for another debate, but the point is that there are legitimate reasons to be disgusted by the guy.

GNU style indenting, gross!

Toady
Jan 12, 2009

evensevenone posted:

There would have been no point to making Linux better if it were under MIT. Vendors could just make their own versions that only worked on their hardware and they would have gladly spent the last 20 years re-implementing each others features poorly and incompatibly and suing each other.

Doesn't BSD refute this?

Toady
Jan 12, 2009

I have a personal style, but I can read and write multiple styles without caring either way, certainly not enough to spend time maintaining multiple code formatting profiles.

If you're so used to your personal style that you have issues when reading or writing other common styles, you should consider exposing yourself to more external code. You should also experiment with other programming languages so that you're not attached to the syntax of your pet language. The algorithms and data structures are what matter.

Toady
Jan 12, 2009

Those are arguably uncommon styles (I hope).

Toady
Jan 12, 2009


That code is auto-generated.

Toady
Jan 12, 2009

pigdog posted:

Seeing as he has 3700 viewers at the moment, I suppose plenty of people do.

Notch's fans are a little...different. I'd be willing to bet the majority of the viewers aren't programmers.

Toady
Jan 12, 2009

Jabor posted:

Basically Notch's code almost always looks as if he's hacked on it just enough to get it "working" and then just left it like that without ever cleaning it up in any way.

There is a poo poo ton of code out there like that, but people are much more vocal about it in Notch's code because he's actually been successful with it. That and his product is something that most nerds look at and think "I could have hacked out something like that, and done it better", which of course is a recipe for huge nerd jealousy.

I don't think it's accurate to pin negative opinions on nerd jealousy or increased scrutiny due to success. Minecraft's code is objectively bad. It doesn't even combine identical adjacent quads.

Toady fucked around with this message at 01:46 on Apr 8, 2012

Toady
Jan 12, 2009

That Turkey Story posted:

So what, how often would that actually happen in a game like minecraft?

Oh yeah.

Quite often since most buildings and other user creations, plains-like biomes, oceans/lava, etc. have flat surfaces.

quote:

Edit: Although, to be honest, I highly doubt that would ever be a bottleneck anyway.

Fear not, the engine does far dumber things.

Toady
Jan 12, 2009

That Turkey Story posted:

Yeah, that would be the joke.

Whoops.

Toady
Jan 12, 2009

Keevon posted:

You know maybe instead of being an angry nerd and writing your paper about how poorly notch wrote a multi million dollar game you could try being productive and write your own game but properly and show him whats what.

What a weird comment. Nobody is angry, and making millions doesn't change the quality of the code.

Toady
Jan 12, 2009

Chuu posted:

A lot of the hate is that it fundamentally bothers some people that code quality and popularity are not correlated at all.

There isn't hate, sour grapes, or jealousy here. The point of this thread is to mock bad code. If Minecraft was well-written, it wouldn't get mentioned. The fact that it's popular, inexplicably runs poorly, and has had its technical problems exposed through decompilation makes it an obvious target. Just because Notch made lots of money off of it or that most of his users aren't aware of its design flaws doesn't make it exempt from technical criticism.

Toady
Jan 12, 2009

Ensign Expendable posted:

Why does a modern programming language still have gotos!?

goto isn't automatically bad. Example: http://kerneltrap.org/node/553/2131

Toady
Jan 12, 2009

duck monster posted:

For the love of god, bring back pascal as a mandatory educational language PLEASE aarrgghhhhhhh. There is no valid reason to use GOTO ever that does not have as its root cause "Doesn't 'get' structured programming discipline".

From the previously linked lkml thread:

quote:

From: Linus Torvalds
Subject: Re: any chance of 2.6.0-test*?
Date: Sun, 12 Jan 2003 12:22:26 -0800 (PST)

On Sun, 12 Jan 2003, Rob Wilkens wrote:
>
> However, I have always been taught, and have always believed that
> "goto"s are inherently evil. They are the creators of spaghetti code

No, you've been brainwashed by CS people who thought that Niklaus Wirth
actually knew what he was talking about. He didn't. He doesn't have a
frigging clue.

> (you start reading through the code to understand it (months or years
> after its written), and suddenly you jump to somewhere totally
> unrelated, and then jump somewhere else backwards, and it all gets ugly
> quickly). This makes later debugging of code total hell.

Any if-statement is a goto. As are all structured loops.

Ans sometimes structure is good. When it's good, you should use it.

And sometimes structure is _bad_, and gets into the way, and using a
"goto" is just much clearer.

For example, it is quite common to have conditionals THAT DO NOT NEST.

In which case you have two possibilities

- use goto, and be happy, since it doesn't enforce nesting

This makes the code _more_ readable, since the code just does what
the algorithm says it should do.

- duplicate the code, and rewrite it in a nesting form so that you can
use the structured jumps.

This often makes the code much LESS readable, harder to maintain,
and bigger.

The Pascal language is a prime example of the latter problem. Because it
doesn't have a "break" statement, loops in (traditional) Pascal end up
often looking like total poo poo, because you have to add totally arbitrary
logic to say "I'm done now".

Linus

Toady
Jan 12, 2009

GrumpyDoctor posted:

So what is the correct use of XML? I'm going to get asked about it tomorrow and I know nothing about its best practices.

It's a language for generating markup languages.

Toady
Jan 12, 2009

Fren posted:

I've never heard anyone in the Lisp community say either of those things, and I can't name a single person who considers Paul Graham a Lisp figurehead. Maybe you have an aphasia?

It's not as if there isn't a known "heh, finally caught up to Lisp" attitude out there. Happens to any marginalized community.

Toady
Jan 12, 2009

HappyHippo posted:

"Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."

"...including Common Lisp."

Toady
Jan 12, 2009

"how to use pointers in Objective c"

Objective-C code:
- (void)setupWebView:(UIWebView**)aWebView {

    UIWebView *webview = [[UIWebView alloc] init];

    // ...

    if (*aWebView) {
        [*aWebView release];
    }

    *aWebView = webview;
}

Toady fucked around with this message at 22:47 on Jun 13, 2012

Adbot
ADBOT LOVES YOU

Toady
Jan 12, 2009

I wonder how much of Valve's choice of Squirrel for Left 4 Dead 2 and Portal 2 had to do with its reference counted memory management. It's hard to find information about Squirrel's real-world use compared to Lua. I adopted Squirrel for my current project, but it's not a game and so I can't speak to any performance benefits. However, I prefer Squirrel's API as well as its explicit slot creation over Lua's behavior in which undefined variables don't generate an error.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply