• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design Pattern needed

 
Hareesh Ram Chanchali
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there is an application which deals with multiple tables sequentially and the logic for population of data is automated for all the tables in such a way that it is achieved in single click.

The total code has been written as a servlet which takes a excel file name as a parameter and get all the sheets (correspond to table name) and sequentially it retrieves the data and before insertion it checks for constraints and then it populates..\

I can not determine the right design pattern

plz tell me design pattern with right references and books
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do some google on Command Pattern.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the OO, Patterns, UML and Refactoring forum.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hareesh Ram Chanchali:
I can not determine the right design pattern

plz tell me design pattern with right references and books

If you can't think of a design pattern that fits your particular situation, it may be better to "just implement it" and look for patterns after the fact. After all, design patterns are not invented but observed.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See also http://faq.javaranch.com/view?WhenToApplyDesignPatterns
 
Hareesh Ram Chanchali
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Lasse,

May be you are right .
But I hope there should some pattern existed for these kind of aplications previously.

Hope u got me
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think patterns got so much buzz that people just throw the word into a question like this. Without it "design needed" would be a different topic.

The suggestion to look into Command was about getting tricky logic out of the servlet layer. Many people like a servlet to get parameters from the HTTP request, call the business layer, forward to a JSP that builds the next page, and (almost) nothin else. I like to build apps with a single servlet that gets page name and action from the HTTP request and uses the combination to look up a Command that contains the call to the business layer. That's only one flavor, tho. If you build a servlet per page you don't really need that bit.

That's all kind of high level architecture. For your particular problem it sounds like a series of sequential steps is pretty straight forward. Look up the transactional abilities of your driver & Excel and put all the operations in a single transaction if you can.

Hope that helps. Let us know what you wind up with!
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hareesh Ram Chanchali:
But I hope there should some pattern existed for these kind of aplications previously.


Design patterns don't exist for kinds of applications. They don't solve problems of the kind "I need this functionality implemented".

What design patterns *do* solve are design problems of the kind "I want to remove this duplicated code", "I want to decouple those two classes" or "I need more flexibility in how those objects are instantiated", for example. Until you encounter problems at that scale, looking out for design patterns simply is premature.

Hope this helps...
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic