Spinsels op het web
actions » SearchLogin 310 articles • 07 Feb 2012

Article with comments

Wednesday, 12 May 2010

permalink Yoda Conditions en andere nieuwe programming jargon

http://www.globalnerdy.com/2010/05/09/new-programming-jargon/

Bevat juweeltjes als deze:

Pokemon Exception Handling: For when you just gotta catch ’em all!

en deze:

Shrug Report: 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."

En eindelijk een leuke naam voor een techniek die ik al een paar jaar gebruik: Yoda Conditions 8-)

Over dat laatste:

This is actually quite a common idiom on languages that use == and =. If you put a constant on the LHS of the expression the compiler will generate an error if you use = accidentally rather than == for equality checking. Quite a few C or C++ programming types actually recommend doing this, and the principle would apply to C# or Java as well.

Tevens helpt het om null-pointer errors te voorkomen.

person.getName().equals("harry")

kan nullpointeren als getName() null teruggeeft. Maar

"harry".equals(person.getName())

is equivalent en nullpointert nooit want je kunt altijd een string constante vergelijken met een eventuele null. Scheelt dus weer een bug (of een extra if, of een try-catch)

• Wrote irmen at 01:49 | read 49× | Add comment

Comments (0)

No comments for this article yet.

Write a comment

Your name  
E-mail   (only visible for blog owner)
Homepage
Text:

[b] [i] [u] [tt] [center] [code] [quote] [url] [url=] [img] [@] [@@] [@:]
detailed help about markup
You must answer the following to be able to submit.
How much is ten minus eight?  
[Captcha Image] Type the letters you see in the image.
(Unreadable? Click on it for another one)

Process times: page=0.007 request=0.013 cpu=0.010