Yoda Conditions en andere nieuwe programming jargonhttp://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
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
icon is the article's permalink.