Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How will you design the classes

 
abhijitg ga
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. How will you design a BOOK and a AUTHOR class?
What kind of association will be between them ?
How would you instantiate them?
Which pattern will you select?



 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Book HAS-A Author.

For creation use -
1. Factory
2. Dependency Injection.


I am all for DI as it removes tight coupling and is configurable as well.

Cheers,
Raj.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A book has one or more authors.
Creation strategy depends on how the information to create the book is going to be made available and how complex it is to create a book instance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic