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

Articles written on 12 May 2010

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× | 0 Comments

1 shown; more articles may be found in the archives. The permalink icon is the article's permalink.
Process times: page=0.004 request=0.009 cpu=0.006