News for hackers. Stuff that matters.
Re:New Programming Jargon by neilk on Sunday May 09, 2010 @05:46PM (#1332923)
Mostly just in-jokes, but I loved "yoda conditions" and "stringly-typed". Those deserve wider usage.
Re:New Programming Jargon by fhars on Sunday May 09, 2010 @06:41PM (#1332984)
What he calls yoda conditions is actually considered best practice in C-like languages, as it will result in a compile time error instead of wrong run time behaviour if you forget to type the second equals sign. The name is still funny, but the way he has written it up betrays a certain lack of understanding.
Re:New Programming Jargon by neilk on Sunday May 09, 2010 @09:51PM (#1333291)
Perhaps I was unclear -- I and probably over half of HN are familiar with that trick already. However, to my knowledge there was no pithy, memorable name for this practice before.

It's a good practice in almost any language, BTW. In scripting languages, the error will either be caught at parse time or maybe at runtime, but at least it will be noticed.

Re:New Programming Jargon by eru on Monday May 10, 2010 @08:56AM (#1334236)
> It's a good practice in almost any language, BTW.

In any language that's susceptible to this kind of bug, yes. Python and Haskell solve it in different ways.

Re:New Programming Jargon by BrandonM on Sunday May 09, 2010 @07:33PM (#1333051)
Shouldn't best practice be to compile with something like "gcc -Wall" instead of making the code less readable?
Re:New Programming Jargon by philwelch on Sunday May 09, 2010 @08:46PM (#1333188)
Yoda conditions, like ternary operators[1], are perfectly readable if you have more than a week's experience working with them IMO.

Of course, you also turn all the warnings on.

[1] By "ternary operators" I mean "pretty-printed, non-nested ternary operators".

Re:New Programming Jargon by raganwald on Monday May 10, 2010 @12:42AM (#1333590)
While neither agreeing nor disagreeing with the style of placing the rval on the left and the lval on the right, I'd just like to point out that another way to avoid these errors is to use immutable variables more often.
Re:New Programming Jargon by jemfinch on Sunday May 09, 2010 @08:55PM (#1333200)
I'm not sure you should instantly jump to thinking the term "yoda condition" is derogatory. Yoda is generally considered positively by most nerds.
Re:New Programming Jargon by fhars on Monday May 10, 2010 @12:28AM (#1333569)
It's not the term I'm objecting to, it is the writeup that sounds like it is inferior to the unsafe alternative.
Re:New Programming Jargon by kentosi on Monday May 10, 2010 @03:45AM (#1333826)
I often see programmers with a C/C++ background enter the Java world using Yoda conditions, where such practices serve no use.

I used to work with a guy who insisted on using yoda conditions, "just to be sure". This guy would also make sure he'd "null" out all his variables at the end of the method for the same reason.

Re:New Programming Jargon by mgrouchy on Sunday May 09, 2010 @07:52PM (#1333083)
This is something I learned to do when I first started programming and just continued to do. I didn't think it was that uncommon (I also do this in non c-like languages as well because while it produces a runtime error you won't get incorrect behavior, just breakage).
Re:New Programming Jargon by latortuga on Monday May 10, 2010 @01:57AM (#1333699)
Following the link to Yoda Conditions, I found this gem which I think is almost as good:

"Isn't 'Yoda Programming' where you never handle exceptions? Because, you know, there is no 'try'"

Re:New Programming Jargon by kdeberk on Sunday May 09, 2010 @05:37PM (#1332907)
I'm actually guilty of using Yoda conditions in anything but Lisp. It is now hardwired in my brain since I learned it early. I'm using it for the same reason as all other Yoda conditioners are, -Wall wasn't really an option then since the source code normally spouted 50+ warning lines due to some included header file.
Re:New Programming Jargon by squidsoup on Sunday May 09, 2010 @06:25PM (#1332968)
I liked the variation on this - Yoda Exception Handling (or the lack thereof): there is no try.
Re:New Programming Jargon by jallmann on Sunday May 09, 2010 @05:57PM (#1332938)
I use them too, but can't figure out if TFA is being derisive or not. I always thought Yoda conditions were good defensive programming, especially in C-type languages.
Re:New Programming Jargon by aaronbrethorst on Sunday May 09, 2010 @06:09PM (#1332950)
I use Yoda conditions all the time. Never knew there was a name for it besides 'a good defensive programming convention to keep you from doing something stupid when programming C.'
Re:New Programming Jargon by squidsoup on Sunday May 09, 2010 @05:22PM (#1332879)
Great, but perhaps would have been better to simply link to the SO thread. Loved "hot potato/hot potatoes" for http/https.
Re:New Programming Jargon by die_sekte on Sunday May 09, 2010 @05:38PM (#1332909)
But it has pictures! Funny pictures!

Actually, yeah, it would have been better.

Re:New Programming Jargon by mahmud on Sunday May 09, 2010 @10:54PM (#1333405)
Yoda Conditions: if (5 == count)

Folks, conditions != conditionals.

Re:New Programming Jargon by dmoney on Tuesday May 11, 2010 @08:28AM (#1337574)
5 == count is the condition, so if (5 == count) ... uses a Yoda condition in a conditional.
Re:New Programming Jargon by merraksh on Sunday May 09, 2010 @08:31PM (#1333152)
I was surprised not to find "heisenbug". It's on Wikipedia, along with other families of bugs.

http://en.wikipedia.org/wiki/Unusual_software_bug

Re:New Programming Jargon by carussell on Sunday May 09, 2010 @11:07PM (#1333426)
Why were you surprised, then? It's already been coined.
Re:New Programming Jargon by davidalln on Sunday May 09, 2010 @07:55PM (#1333091)
My favorite is "mechanical issue". I use it all the time whenever the build team on my robotics team blames me (i.e., the coder) for an issue on the robot.

Build Team: DAVID! The robot is continuously driving in circles whenever we turn it on. Me: Must be a mechanical issue

Re:New Programming Jargon by jcromartie on Sunday May 09, 2010 @08:13PM (#1333120)
I've been called out for Yoda conditions with comparisons, but it's actually just number-line order. I.e. instead of writing "x > 0" I write "0 < x", but I read both as "x greater-than 0."
Re:New Programming Jargon by iamdave on Monday May 10, 2010 @02:53AM (#1333772)
I successfully used a duck when designing a site for my old company, who insisted I place the CMS in the root directory, so users don't get confused when the URL shows up in the address bar.

I told them it would get addressed immediately.

It got addressed via an .htaccess file that masked the URL.

Ducks ftw

Re:New Programming Jargon by adriand on Sunday May 09, 2010 @08:26PM (#1333141)
I've just put a web app into production and one of my client's associates is driving me nuts with his "shrug reports" ('A bug report with no error message or “how to reproduce” steps and only a vague description of the problem. Usually contains the phrase "doesn’t work."'). So I really enjoyed this list.
Re:New Programming Jargon by paulitex on Sunday May 09, 2010 @11:58PM (#1333527)
The Duck is genius.
Re:New Programming Jargon by joubert on Monday May 10, 2010 @09:13AM (#1334293)
Bloombug is my favorite