Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
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
I agree; the multiple values you're wanting to return are typically related in some way. These data beg to be encapsulated in a class. If the data are unrelated, they probably shouldn't be returned from the same method...When you feel the desire to return more than one value from a method, that typically means that you are missing an abstraction.
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
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:
Anyhow, I could see that being a collection and instanceOf checks. I won't argue that it wasn't a design smell.
Tony Morris
Java Q&A (FAQ, Trivia)
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
With all due respect Tony, I think "TwoInts" is a very weak "abstraction".
Tony Morris
Java Q&A (FAQ, Trivia)
When you feel the desire to return more than one value from a method, that typically means that you are missing an abstraction.
Originally posted by Anh Vu:
I can't understand why we missed an abstraction here . May you explain me more ?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |