15 Minutes Null

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    15 Minutes Null - Presentation Transcript

    1. 15 min. Null
    2.     C/C++ Legacy 'not initialized pointer'  in java/C# we don't work with pointers,  objects are not pointers  
    3. Null is Dishonest it can be a valid instance of any reference type it is not an object it has no methods,   it cannot be a valid substitute for objects (types) null is always a 'special case' Liskov's Substitution Principle (LSP)  if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program
    4. Null in the API as a parameter please use method overloading as a result needs special care needs extra documentation/naming convention do it in code (self-documented)  @NotNull/@Nullable (findbugs, IntelliJ)  
    5. Null Object a Null Object is an object with defined neutral (\"null\") behavior  opportunity for 'Tell don't Ask'  can be extended by the use of a Visitor
    6. Option (Some/None) 'generic' Null Object originated (!?) in ML, it is also present in its derivatives ocaml, F#, scala) and even java ideal for API usage parameter & result intention clear, self-documented smaller granularity (generic functions),  ability to compose those ('maybe monad')
    7. Navigating over nulls  a.getB().getC()  need to handle null on the receiver for every '.' Comega groovy: Safe Navigation Operator java7  ruby: andand   DISCLAIMER Extensive object navigation violates the Law of Demeter making future refactorings and testing more difficult. Tell Don't Ask
    8. Defensive Programming Don't accept nulls NotNullAdvice for services (beans) ValidatedAs.notNull(param,...) for other data throws IllegalArgumentException
    9. References Richard Cobbe:'Much Ado About Nothing: Putting Java's Null in its Place'  http://delicious.com/andrei.pamula/null http://delicious.com/andrei.pamula/option  
    SlideShare Zeitgeist 2009

    + andrei.pamulaandrei.pamula Nominate

    custom

    274 views, 0 favs, 2 embeds more stats

    How to avoid nulls in java/c#

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 274
      • 248 on SlideShare
      • 26 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds
    • 24 views on http://thought-tracker.blogspot.com
    • 2 views on http://www.squidoo.com

    more

    All embeds
    • 24 views on http://thought-tracker.blogspot.com
    • 2 views on http://www.squidoo.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags