Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird 1.2.1 data model

 
Daniel Massie
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is considered to be the best approach to a data model for the assignment?

I am torn between providing a flexible Record object that deals with the String[] returned by the DBAccess interface, and a Record object with getters/setters for each of the columns. With the first approach, the String[] would be dealt with several times where as with the latter it would be read from once to set the properties and created when updates/searches were performed. I am leaning towards the latter since it makes the rest of the code simpler, but it does hardcode the column names in the code. This could be easily justified though, since its no different than creating the likes of a JDO or Hibernate object for a database table.
 
Oliver Weikopf
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either of the two approaches is acceptable. Just make sure you note this decision in your choices.txt.
I personally went for something in-between. I've got a Record object encapsuling the String array. I use only one Getter that expects an index. But I provide constants for the indexes. This way, I hardcode the database layout, but changes in the underlying data model are easily transported just by changing the constants.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Guys


I have something similar with you.I have a RecordHandler and a URLyBirdRecordHandler.
The first (RecordHandler) is a geral haldler - it contains a map<Integer, String> and some get/set/remove methods.
The second (URLyBirdRecordHandler) uses the RecordHandler - take care it does not extend it - for the URLyBirds record scheme(index 0 is Hotel name, 1 is ...).This calss is a singleton also.


Regards, M
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic