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.
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.
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.
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 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".
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.
27 comments
[ 2.9 ms ] story [ 71.3 ms ] thread> We had a guy come in and immediately strip out comments and whitespace from our code "to make it faster".
The author kept the tests green while refuctoring it...
catastrophic data destroying bug - "Oh the humanity!"
full-disclosure: I didn't read the linked article, but can only assume that it's in there.
1 = http://en.wikipedia.org/wiki/Heisenbug#Heisenbug
Subject verb noun, to process, is easier.
// my choice of example phrase is based on what I valued as a teenager (and can still remember), not some weird social commentary
I yoda conditions very much hate!! Crazy they me drive!
But I Japanese like.
"if (3 == x)" doesn't bother me so much, I tend to think of it like unification in Prolog.
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.
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.
"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.
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".
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.
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".
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.
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.