I am unsure about the required constructor for the implementation of the given interface. The assignment says nothing about it. Is it allowed to declare a constructor with parameters?
How can the my assignment then be automatically examinated by software if it cannot construct the instance?
Tks for reply
Maybe they have for automatic testing a program where they just have to add 1 line: creating the Data instance (according to your javadoc) and let it run...
I am using a singleton as well. I pass in a database path into getInstance method and actually have an overloaded version without params. I know this is a terrible design but I throw a custom exception when it isn't used properly. Is there a way I didn't think of to get around this. I don't like the idea of having a setter for the database path. How did you get the database path to Data? by the way I have been reading a lot of your posts... You are a very adept at teaching, when you help people solve their problems you do it in a way that is understandable and you are very humble (in my opinion a must for any teacher) which helps people build their confidence. I was very insecure when I began the project, only a week later, I am almost cocky! Just wanted to say thanks man .
My Data class has just 1 getInstance method with 0 parameters, so you can get around this (and I didn't use a setter too). What did I do? I created my own interface which extends the given interface and I added 2 methods to this new interface: 1 for initializing (with a parameter containing the database path) and another one for "destroying" (releasing any resources, writing cache back to file,...)
Andy Gertjejansen wrote:I have been reading a lot of your posts... You are a very adept at teaching, when you help people solve their problems you do it in a way that is understandable and you are very humble (in my opinion a must for any teacher) which helps people build their confidence. I was very insecure when I began the project, only a week later, I am almost cocky!
Thanks for these kind words, Andy. Some appreciation now and then is always nice to hear Concerning the teaching: before I started my Applied Computer Sciences study, I was trying to become a secondary teacher, because being a math teacher was my little boy's dream. After 1.5 years I decided it wasn't my cup of tea and switched to the IT training, a very wise decision in the end
Not a problem
Did you already have read my story about SCJD? A link is provided in my signature. It contains a lot of information about how I tackled/handled the assignment and also an overview of the high-level decisions I took. First item under "Data class" is:
Roel De Nijs wrote:created my own interface (extending the sun interface)
And as you can see I passed (even with a maximum score ), so it's certainly fine for the accessors.