Campbell Ritchie wrote:Campbell's rule about Exceptions in Java: the number of different opinions obtained is equal to the number of different people asked!
Exceptions need to be handled in different ways, but I like the 2nd method. Set up a utility class with lots of Exception handling methods. By the way: you can probably make those methods static. That will probably work for 90-95% of your Exceptions. That only leaves 5-10% needing something different, which will make life simpler for you.
nitinram agarwal wrote:its better to use composition while designing and hence option 2 works out to be the best as suggested in the first reply itself
Emanuele Gherardini wrote:[To improve my code and design quality, could you suggest me a book containing all that kind of advices? (design quality advices, like "is better to use composition while designing" etc etc).
Thanks in advance.
Raghavan Muthu wrote:Yes, its indeed a good thought. Though both 1 and 2 seems to be good candidates, I also would go for option 2! Until and Unless required, you don't need to go with Abstract classes/interfaces.
Emanuele Gherardini wrote:
That is what I think, anyway I stated it as a possibility for the sake of completeness