/** Code speaks louder than words */
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
<a href="http://www-306.ibm.com/software/rational/bios/ambler.html" target="_blank" rel="nofollow">Scott W. Ambler</a><br />Practice Leader Agile Development, IBM Rational<br /> <br />Now available: <a href="http://www.ambysoft.com/books/refactoringDatabases.html" target="_blank" rel="nofollow">Refactoring Databases: Evolutionary Database Design</a>
/** Code speaks louder than words */
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
But if the object was instantiated on a remote machine (via RMI or whatever), the extra round trip to free an empty String array object (that provided no information that a null return value couldn't have) may incur some non-trivial overhead.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Originally posted by Ryan McGuire:
Which client code would you all rather see:
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Stan James:
I'd agree, but then be a pain the butt ...
account.showYourOwnDarnedTransactions()
might score higher on those scales.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Roger Chung-Wee:
Let me pose this question: can we say that null IS-A String[]? No! By not returning String[], you have broken the API of the method you have written.
And as others have said, there is a negative impact on clients' code which can get littered with checks for null - just to save a few objects from being created.
Yes null is a String[]. Only a Roman would disagree
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
"null is a String" doesn't have much meaning, simply because "is a" isn't well defined in this context.
According to Liskov's Substitution Principle, null is not a subtype of String[]. Java's instanceof operator knows this, too - null is never an instance of any class.
That you can assign null to a reference to a String[] is more a language hack, in my opinion.
Originally posted by Mr. C Lamont Gilbert:
Yes you have a point. null is more of a representation requiring interpretation than anything else. I guess Sun didn't want to be Anal and force everyone to create NullInstances of each type they used to represent nothingness. They left it optional.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
And they even might have been right doing so in this case...
I like a feature that is implemented in Nice, though: being able to declare wether a reference is allowed to hold null values. http://nice.sourceforge.net/safety.html#id2448199
Originally posted by Mr. C Lamont Gilbert:
Is that a runtime or compile time check?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Don't get me started about those stupid light bulbs. |