File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes When designing a class, how do I know ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "When designing a class, how do I know ..." Watch "When designing a class, how do I know ..." New topic
Author

When designing a class, how do I know ...

Jay Jones
Greenhorn

Joined: Oct 11, 2001
Posts: 14
When designing a class, how do I know the following?
(1)What fields do I need?
Are there any systematic (scientific, disciplined) ways to figure that out as opposed to the intuitive ways used by those experienced programmers?
(2)Constructors are usually for initializing the fields in a class, but I've seen constructors do far more complicated things than that, such as opening up a database, performing animation, etc. How do I know what the constructors are supposed to do when designing my class?
(3)What parameters do I need for a method? Do I decide on this first before coding the method? Or do I code the method first and then come back to fill in the method signature?
Are there any books that deal with these topics?
I have been bugged by these questions for a long time. I appreciate if you programming gurus can share with us juniors how you overcome these hurdles.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Answered this in Beginner Please do not cross post.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: When designing a class, how do I know ...
 
Similar Threads
To break or not to break?
Cosntructor question
Matrix
When designing a class, how do I know ...
Converting a String to Proper Case