Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design doubt

 
Kushmakar Sharma
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am a beginner in Java and have started reading Head First Java by O'Reilly publication. Though I am able to understand most of the concepts of OOP and how they are implemented in Java, one question that has me perplexed is: How do we decide the number of classes a particular application will need? In the book there is an example of a Dot Com Bust game in which 3 different classes are created. One is the GameHelper class, another is the DotCom Class and the third one is DotComBust class. What factors decide how many classes are we gonna have in the application?

Regards,
Kush
 
manoj r patil
Ranch Hand
Posts: 181
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you really understood OOP or you need to revisit the basic concepts?

You question sounds to me like "someone is asking as how many tables one application should have in its DB model?" and the answer is it totally depends on the architect and there is a famous quote, "No design is wrong!" ...but any design can be improved further considering different aspects
 
Kushmakar Sharma
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Manoj,

Thanks for the reply. I understand that an architect decides the number of classes to be coded. But what are some of the design considerations that an architect keeps in mind while doing so? To take your DB analogy, DBA might decide number of tables depending on the speed of data retrieval or the ease of access. What derives the number of classes - maintainability probably.. anything apart from that?

Thanks,
Kush
 
Colin Wright
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no really good answer to this question, it depends on the application and there are no hard and fast rule.

In OOP, a class should represent a type of object in your application so the question is how many types of objects are their in your application. Classes should always try to work for themselves, and should work together to achieve the purpose of the application.

But there is more than one way to skin a cat so often two programmers given the same functional requirements might come up with a different set of classes.

In a way you question is meaningless, if you have understood OOP the question always needs to be answered for the particular application requirements and is more a set of questions asking yourself should this be an object repeatedly?

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic