27 comments

[ 2.9 ms ] story [ 71.3 ms ] thread
I like the comment under "Refuctoring":

> We had a guy come in and immediately strip out comments and whitespace from our code "to make it faster".

I always considered "refuctoring" to be refactoring, but without tests to ensure that the new version actually works.
Just a quick warning before you click through: pages and pages of puns.
dammit - warning came 2 hours too late.
Wrong is what with Yoda conditions?
Nothing wrong there is. To understand and read them quickly difficult it is.

Subject verb noun, to process, is easier.

For native speakers of English and other Subject-Verb-Object (SVO) languages, anyway; it sounds like a weird variant of passive voice. There are also SOV, VSO, etc. human languages, though.
Dakota has some combos that sound different to English speakers (e.g. phrase: "Mazaska wacin", Mazaska = money, wacin = 'I want').

// my choice of example phrase is based on what I valued as a teenager (and can still remember), not some weird social commentary

Japanese is SOV (subject-object-verb).

I yoda conditions very much hate!! Crazy they me drive!

But I Japanese like.

I really dislike post-statement ifs, like "do_something() if condition?". They seem to be used particularly often in Ruby. I don't know how dependent clauses ("if x then y" vs. "y if x") work in Japanese, but Ruby coming from Japan may be a factor.

"if (3 == x)" doesn't bother me so much, I tend to think of it like unification in Prolog.

I got into the habit of writing literals first from being bitten one too many times by the (absolutely insane!) semantic difference between "=" and "==".

In my day job (working with Java) it's less of a problem, but I switch languages so much in my spare time that it has served me well.

    post-statement ifs, ... used particularly often in Ruby. ... Ruby coming from Japan may be a factor.
I think Ruby borrowed them from Perl's Statement modifiers (http://perldoc.perl.org/perlsyn.html#Statement-Modifiers). I like them and use them when I want the focus to be on the body rather than the conditional.
Japanese conditionals come (AFAIK) before statements.

They can come after statements, just like in English, "Tell me if you see him".

I don't use Ruby but I actually like this idea.

Often when reading code, I'm looking for what's being done, not the condition under which it's done. I only look for the condition after I've found the statement.

(comment deleted)
Awesome...

"A Duck"

A feature added for no other reason than to draw management attention and be removed, thus avoiding unnecessary changes in other aspects of the product.

In Jewish folklore, this is I guess a hundred or two years old, and is called a goat or a sheep:

A man complains to his Rabbi that they have a tiny house and they can't manage with their wife and three kids all in the same room. The rabbi tells him "take your goat and put it in the room as well". The man does as advised, and comes back to the Rabbi two weeks later, complaining even more. The Rabbi tells him "take the goat out". The next time the man sees the Rabbi, he thanks him "We have so much room now that the goat is out".

I recently coined (afaik):

    enbug - v. to program; the opposite of debug
Sorry to burst your bubble, but there exists enbug.org whose about page (http://enbug.org/AboutThisSite) says:

    The meaning of enbug is the opposite of the word debug, namely, to add errors or defects into software or hardware.
That page was last edited on 2007-03-04.
Favorites: Smug, Drug, Chug, and Shrug reports. Will have to remember those...
A buddy and I coined SQL Ejaculation.

Where you use SQL to generate text to be executed by another system...like HTML.

Have you ever seen an entire web site generated by stored procedures. I have. It aint pretty.

I hate to write this... But I've seen a few of these "most upvoted" StackOverflow questions posted to HN in the last few days, and, although they are good articles, they are very easily accessed (by which I mean, all you have to do is go to StackOverflow and click on questions, and then on most voted; likely what anyone new to it would do. As programmers, I'm pretty sure most us have visited SO at least once), and hence something most of us would have already seen.

People will see this phenomenon and it'll catch on, and HN will end up like Digg, with the only content posted being "top tens".

reverse polish hungarian notation: char * nameZspl;

ifless if: ptr && (* ptr = 10);

WTF-8: an almost-UTF-8 type of encoding, which possibly cannot be decoded anymore

gangbang of four: an act of cluelessly quoting GoF, Fowler et al.

Code Prion -

n. a really bad idea dressed-up as a good idea thereby becoming contagious in a way that never seems to die out.

n. memes adopted as a religion by the clueless because "it seems like a great idea" while drowning-out the opposition because the arguments against are subtle.

* "Our object model makes it hard to implement NaNs" -- famous last words before adding hundreds of if_special() checks to your code and transforming your object model into something that defeats your ability to reason about programs by undermining common notions of equality as being reflexive, symmetric, and transitive. If you doubt that identity-implies-equality, then you're infected.

* Most ideas for pre-commit hooks are code prions. If your process depends on crippling a developer's ability to make a check-in, then you're infected.

* "Our dynamic language doesn't implement static language feature X". If you think Ruby and Python need Enums and Interfaces, then you're infected. Those features cost nothing in compiled languages and often only serve to overcome the limitations of those languages.

* "We're making everything clean and pure by deprecating everything we don't like anymore." Hey, it only takes you ten minutes to add the deprecation, who cares if it consumes hundreds of hours of user-time to update their programs or if they stick with an old version just to avoid your deprecation hassles. Better to just document it as obsolete than to inflict pain on a large user base. (By the way, authors of books will hate you too -- it makes their books go out-of-date prematurely). If you think of published APIs as mutable, then you're infected.

* If you think self.assertLessEqual(x, y) is the right way to spell, "assert x<y", then you're infected. Get nose.py or py.test and live free.

* "Everybody knows eval() is an egregious security hole, so you should never use it." Learn to differentiate between trusted and untrusted code; otherwise, your fear will keep you from using your most basic and powerful tools. This code prion is chonic and progressive -- eventually you'll find yourself unable to write "import collections" because someone might have stolen you ssh key, logged into your machine and added their own collections.pyc file which would appear to run normally but actually emails your mother's secret porridge recipe to wikileaks. If you think eval() is evil, you're infected.