09 Dec '13, 3pm

The "No Special Case" Pattern | The Devel!

Very often I’ll write (or use) APIs that look like this (translate accordingly for Ruby / Javascript code) Thing findOneThing(Key key); // if nothing is found, throw an Exception or return null Collection findManyThings(Collection keyList); // if nothing is found, return null All well and good? I’d known the textbook-bullet-points for this, but for the longest time, I didn’t realize how much tax I’m paying subconsciously.. and just how many APIs are ignoring this wisdom: Nulls are awkward things in object-oriented programs because they defeat polymorphism. link » Instead of returning null, or some odd value, return a Special Case that has the same interface as what the caller expects. link » Not all language can do this easily link » - from P of EAA: Special Case via sharedcopy.com Finding yourself having to check for null return values? That’s not "the way it is", that’s ...

Full article: http://blog.choonkeat.com/weblog/2007/11/the-unspecial-c....

Tweets

Celebrate Giving with the special people in you...

baume-et-mercier.com 13 Dec '13, 3pm

TALK TO A BRAND AMBASSADOR Call us We're here to answer your questions: for more detailed information about the watch you ...

The Actual Impact of PPC on Sales [Case Study]

The Actual Impact of PPC on Sales [Case Study]

searchenginewatch.com 10 Dec '13, 2pm

Everyone knows that PPC helps to increase sales. After all, PPC almost always drives incremental traffic to a website and ...

What It Really Takes For Video Content To Go Viral [Case Study]

What It Really Takes For Video Content To Go Vi...

reelseo.com 11 Dec '13, 7pm

Creating a viral video is the hope of nearly all online video creators. For some, virality is a primary goal; for others i...

A special edition bag with a special purpose, t...

gucci.com 08 Dec '13, 4pm

For security reasons, Gucci online purchases will require an adult signature upon delivery. Purchases may not be shipped t...

Bitcoin: China’s New Special Economic Zone -

Bitcoin: China’s New Special Economic Zone -

bitcoinmagazine.com 07 Dec '13, 5pm

After the recent regulatory announcement on the part of the People’s Bank of China, the Bitcoin markets and many in the Ch...

Check out @PeopleTree advent calender. There is...

peopletree.co.uk 08 Dec '13, 11am

New In Womens Dresses Tops Jackets Knitwear Trousers Skirts Nightwear Jewellery Accessories Designers Black Score Zandra R...

Improving Code Readability with the Builder Pat...

pivotallabs.com 07 Dec '13, 11pm

The Builder pattern is an easy way to make your code more readable. The pattern is useful when dealing with a constructor ...

@lovethekisses so pretty babe!!!! :D

zalora.sg 19 Dec '13, 7am

{"currency":"SGD","price_label_without_special":"Price","price_label_with_special":"Before","special_price_label":"Now","s...

Six good reasons to watch the Supreme Court's interstate air pollution case

Six good reasons to watch the Supreme Court's i...

grist.org 09 Dec '13, 11pm

The Supreme Court hears argument Tuesday in EPA v. EME Homer City Generation – a case that offers everything a Supreme Cou...