views:

51

answers:

2

I am a college student, and I have to complete following task by the end of the month... I have to write a client/server application in java that implements 3 patterns: Hollywood principle, Facade pattern and Template method pattern... It must have at least 3-4 domain objects... Database has to be MS Access (I know, I know...) Any suggestions or resources that I should look at, some similar work, cause I dont know where to start? I was thinking about making Library application. I am interested what would you use for domain objects and how would you start...

+1  A: 

Spring Framework is best suited for this. It has all three patterns you are looking for.

vinaynag
Hollywood principle is nothing but IOC (Inversion of Control).
vinaynag
+2  A: 

Well if you want to build a library app then think of one that already exists and what domain objects it could be using. Like when you visit one you (in most cases) have to log in, right? Then that means there is a user class. Lets say you need at least two users, then you can make an abstract User, a Librarian and a LibraryUser (or whatever you want to call the people who want to rent the books) - here you could use the Template Method pattern for something I guess. Then think what do you do at a library? Well you rent books, so you'll need a Book class! Whether you want to make it abstract and make some subclasses is up to you. That will give you at least 3-4 domain objects.

For the Hollywood principle as vinynag said it would be much easier to use an IoC/DI framework like Spring or Google Guice, the question is are you allowed to do that? If not, then you'll have to manually inject everything, it's not that hard but nowadays it's just pointless to do it manually in most cases.

I have to say I don't know a thing about MS Access but if it's anything like MySQL/PostgreSQL/Oracle then for the Object-Relational Mapping I'd go with Hibernate, the basics are really really simple and adding users/books, finding them according to some criteria etc. shouldn't be a problem!

As for the facade pattern... well it's quite late here and I can't think of anything atm, so I'll leave it for you to figure out.

Oh also I guess you could use something for the view part also, then I'd suggest either JSP or JSF, both are quite simple. Since it's a small app I'd start with making a UML diagram, then code the "backbone" of the app (the domain objects, add the Hibernate/Spring annotations) then I'd add the JSP/JSF pages and start putting it together, add some business logic and then some DAOs to get the DB connection up and running.

Zenzen
thank you, thank you, thank you, that really helps... and I have to manually inject everything :(any other advice will help, I am pretty new at this and eager to learn
AverageJane