This is off topic but I find it difficult to read the blog-articles from jaquesmattheij.com . Zooming doesn't help because the text doesn't wrap correctly. Just a suggestion for the author to change the layout of the page.
The legacy system that I'm working on now has about 20-30 distinct classes/data types that it needs to manage and persist to the database. The previous developer chose to implement all of these different data structures in one uber-table named 'object' and in the application code with one uber-class named 'Thing'. Relationships between 'Things', regardless of meaning or type, are simply dumped into a 'relationship' t…
One of my favorite accessor method names I've run across is 'maybeGetCube()'. The idea was that if it was cached, then it would return the cube, otherwise null. Cube was actually relatively aptly named, it was a big matrix of data BTW. I guess really it wasn't THAT horrible, but the whole idea of 'maybe' doing something in code has always made me chuckle.
That's the whole premise of Prolog (ok, if you squint at it from the right angle). Execute steps X Y and Z, but if Z fails go back and try Y again a different way, and if that fails back up further and try X again a different way...
You really don't know bad programming until you have spent some time in a 50000 line cobol program. I'd post some crap I work on every day but I don't want to make anyone cry. Nevermind. Here's some random code I'm working on. MOVE SPACES TO LISTBAT-NAME. STRING WORK-FILES "LIST.BAT" DELIMITED BY " " INTO LISTBAT-NAME. OPEN OUTPUT LISTBAT. MOVE SPACES TO SCR-S. STRING "DIR /B " DATA-PREFIX " > " WORK-FILES "TMPLIST"…
Note to self: do not learn COBOL.
I'm sure it would make you a better programmer. Using tools that were abandoned by their company 10 years ago teaches one to be humble and to appreciate the little things in life.
I've seen that too. I don't think it was intentional -- the programmer simply didn't understand what the existing code structure was for, and "defactored" it.
Just think of all the function-call overhead he saved!
There are actually systems where this is a non-trivial gain. I've heard some of the Extream software (since acquired by HP) guys tell stories about having to inter-operate with ancient mainframes their customers refused to replace. In order to get throughput on some of the logic up to an acceptable level, they had to do just this. Amdahl's Law, a-gogo!
I met the guy who wrote this bit that I had to maintain: for(a=0;a What really pissed me off was that he was such a nice guy. He still works a lot. Makes a lot of money. And his customers love him. (No, I don't think they review his code.)
Where do you go on error Hell, Arizona or any other village with that name. Real C# code can be like this: if(John is evil){ goto Hell}; ( http://msdn.microsoft.com/en-us/library/scekt9xw%28v=vs.71%2... )
GOTO HELL showed up with predictable frequency. I don't recall if he used it for errors, though.
Which Hell would that be? The one in California, Michigan, the Cayman Islands or Norway?
I worked with a guy (I won't name the company) who wrote Java code in one, huge, static class as much as possible. In fact, everything was largely in one function too. He decided to name his fields alphabetically. static int a static int b static String c static float d static int e... What, I wondered, would happen when he ran out of letters? Scrolling down further I saw this: static int aa static float ab static St…
Often smart people coming from mathematics start programming this way. In math it's traditional to give everything what programmers would consider cryptic one-letter names, partially because you tend to write them on paper a lot while thinking, and partially because you have fewer entities so it's less bothersome to remember their meaning.
Of course it's a bad idea while programming, I just find it helpful to remember the reasons that smart people can make seemingly terribly unaesthetic decisions.
I've watched enough "programmers at play" and read enough code to happily believe that this guy was just letting his sense of humor have its day. I'm not at all convinced that things like this are deliberate obfuscation. Of course, I'm not the one who had to disentangle it all. We've all read bad code with bad names that nonetheless "works" (except perhaps for the occasional minor glitch). This is perhaps just one th…
I agree. Tomato and Pizza aren't any less silly than Foo, Baz and Bar, and certainly much less offensive than Fubar... ... It's not just programmers that do this either, also network admins name their computers R2D2 and C3PO, Shodan, Skynet etc.
Naming computers using a linguistic convention unrelated to their function is a good idea, because there's a good chance you switch what your hardware is doing. The worst outcome is when you have computers named things like "webserver1", "webserver2" and then you get some new hardware so webserver1 is no longer your webserver, it's your test server.