Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jay Jones
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answered this in Beginner Please do not cross post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic