logo

New Response

« Return to the blog entry

You are replying to:

    • avatar
    • Nathan T. Freeman
    • Posted on Tue 24 Apr 2012 07:53 AM

    Tim Tripcony used to be a big fan of chaining as well. But it's bad practice when you start testing complex code because it hides the point of failure in execution. If we take your last example, and that line resulted in a NullPointerException, how would you know whether it was the constructor, .setTitle(), or .show() that failed to return the correct object?

    Restricting individual lines to single operation may bulk your code up a bit, but it makes it MUCH easier for a maintenance developer to come behind and diagnose a runtime error.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: