Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Suggestion on choosing a right pattern !!

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i'm developing a component to customise a database for a website, the following functions/methods may included :

1) DBconnection - connect db
2) getDbData - get data from db and generate table
3) displayDBdata - display table to webpage
4) setPrimarykey - set primary key for certain column in specify table
5) unsetPrimary - unset primary key
5) setIndexKey - set index key for certain column in specify table
6) unsetIndexkey - unset index
7) renamecolumn - rename db table's column name
8) renametable - rename specify table
9) addColumn - add column to table
10)deleteColumn - delete column in table

let assume that are basic functions which a component do, can someone pls suggest a suitable design pattern in my case ? thank you very much for your time and suggestion
[ November 30, 2004: Message edited by: Alvin chew ]
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For database access, you might use Data Access Object, and as you need to have some properties change, you might use Transfer Object as well.

Nick
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if not using DAO, any suggestion on pattern for this case ? thank you !
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://faq.javaranch.com/view?WhenToApplyDesignPatterns
 
Joao Vitor Guimaraes
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use DAO.
Take a look at Spring DAO facilities.
[]'s
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i running on time on current project ..and i totally new to DAO, if that is the case, what is the best book to get ?

however, i still hope any volunteer to take a look on how my design should be ..say about what class , interfaces involve or design pattern
[ December 02, 2004: Message edited by: Alvin chew ]
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alvin chew:
i running on time on current project ..and i totally new to DAO, if that is the case, what is the best book to get ?



If you are running short of time, you should probably be more concerned about getting the functionality right in the application rather than worrying about which design pattern to use. In most cases, you will end up with something close to a good design pattern. You can always refactor the code once you are sure that your program does what you want it to do (assuming you have good tests, of course).

The general rule is "Make it work, Make it right, Make it fast".
 
Pj Murray
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Alvin,

If you're running out of time I suggest you generate your DAOs rather than hand write them.

FireStorm/DAO imports database schema definitions from SQL scripts or from live databases via JDBC and then generates a complete persistence tier based on the Data Access Object (DAO) design pattern.

http://www.codefutures.com/products/firestorm/download/

Email support after you download - I'll be happy to arrange an unrestricted license key to help you meet your deadline.


PJ Murray
CodeFutures
http://www.codefutures.com
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you very much for your help, PJ Murray ..which version you advice to download ? i definitely need your help

between, why not you introduce your product here? .. some brief intro may help all developer get known of this value and useful product
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic