oo design
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thanks.
--------<br />Andy Zhu<br />scjp 1.4<br />scjd 1.4<br />SAS Certified Programmer 9.0
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Interfaces should be created only to define types not constants. You better create a static class for constants.
SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Regards<br /> <br />Ph.D.<br />SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD 2
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Sorry, I should not have used this term. There is not such thing called static classes.
SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Anyway.
Regards<br /> <br />Ph.D.<br />SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD 2
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
1. using constants interface is a bad ood.
2. class of static fields (Hanna's static class) may not be a good ood choice, either.
Further deduction:
3. a good ood should overweight maintenability requirement. (a centralized constants is easy to maintain)
4. I personally don't like the idea of utility class (I guess this is like properties file), since the resulting file is eventually in the control of user; this is the least thing a developer wants to do. Furthermore, the constants in issue can be determined before compilation and do not depend on user's input (so that is why they are constants, such as default file location and port, etc in this assignment), therefore I don't see any benefits we gain here while putting ourselves in the danger of ruin of whole program. But, I don't know what you think and how Sun likes.
--------<br />Andy Zhu<br />scjp 1.4<br />scjd 1.4<br />SAS Certified Programmer 9.0
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
See sun's java API: interface "javax.swing.WindowConstants".
Sun's API is generally considered good ood, isn't it?
What is good ood? I think the key point of OO is that with the OO principle, it is easier to break a job into several reusable, self-contained pieces. This makes programs easy to code and debug, easy to understand and maintain. As long as your code is based on this principle, it should be considered good ood.
any comments?
[ June 05, 2004: Message edited by: Peter Yunguang Qiu ]
Peter
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Good point. It seems that my idea of using interface just follows Sun's ood. Instead of using one centralized constants interface, break it down for several, so that each serves for one package. I did it this way.
--------<br />Andy Zhu<br />scjp 1.4<br />scjd 1.4<br />SAS Certified Programmer 9.0
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
- Peter
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
| Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |











