• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NX: Data package

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
I've started my assigment with trying to get the read/search/create to work. I did this by putting a file access in the data class. This works fine, but makes my class very unclear. Seeing as almost everybody is using a datahelper/dataschema helper class to do all file access, I'm wanting to do same.
Somethings are unclear to me though:
1. If I give my clients a data class each the dataHelper class is a singleton?
2. My assigment specifies that the data.java and all exceptions thrown from it should be put in the suncertify.db package. But can I or must I put my dataHelper in the same package or must I put it in one of my own packages
Regards,
Hans
 
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know about #1.
For #2, I put my helper/schema class in the db package rather than creating a new package of my own. I am trying to keep the number of packages fairly small - db, gui, remote, util, and test (test will not be included with submission)
TJ
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hoi Hans,

Originally posted by Hans ter Wal:
1. If I give my clients a data class each the dataHelper class is a singleton?


You would probably want to limit the number of instances of that class.
Before making it a singleton, though, try and decide whether it really does fit that pattern. The first question you should probably ask yourself is whether there is any conceivable circumstance where you might want more than one instance of that class. For example, what if a later enhancement required a second table to be used? If you make this class a Singleton, then it might be difficult to add additional instances of the class later.
You might be better off making it either a multiton (a controlled number of instances of the class - for example making an instance of the class for each unique database), or simply creating a single instance of it that you use throughout your application.

Originally posted by Hans ter Wal:
2. My assigment specifies that the data.java and all exceptions thrown from it should be put in the suncertify.db package. But can I or must I put my dataHelper in the same package or must I put it in one of my own packages


It is generally a good idea to group classes within packages so that they form a logical group. In this case, what is the logical group of classes that would be in the db package? If your answer is "database" classes, and your dataHelper class falls into the category of a "database" class, then you might find the answer to your question
I agree with Terry's packages. The only difference I had was that I called the "remote" package something like "connectivity" or something like that.
Regards, Andrew
[ November 23, 2003: Message edited by: Andrew Monkhouse ]
 
Hans ter Wal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thx Terry and Andrew,
I'll go with the suncertify package then :-)
Thanks for the help on the singleton thing 'multiton' gives me a few more threads to read through, going to go through them first.

Hoi Hans


Do you know more dutch Andrew? ;-)
Regards,
Hans
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hoi Hans

Originally posted by Hans ter Wal:
Do you know more dutch Andrew? ;-)


Ik spreek een kleien beetje Nederlands, als ik gewond en geworkte in Maarsen (vlakbij Utrecht) vor twee jaar.
Even more amazing: I can pronounce the g's in that sentence! (But like most Aussies, I have a hard time with the r's). So I can make myself understood (not that many Dutch people are willing to put up with my Australian accent and terrible Dutch ) but as you can see, my written Dutch is terrible
I did complete my first year of a three year course to learn Dutch to the official level required for students (not that I was trying to be one), and I got close enough to a pass mark that I was told I could continue with the second year (which is another way of saying I failed )
Regards, Andrew
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic