Results 1 to 1 of 1
- 11-17-2013, 11:45 PM #1Member
- Join Date
- Nov 2013
- Rep Power
Object Orientation Question & scenario
I have been programming in java for over a year now and not sure if that classes me as a beginner or not so hope this is the right forum.
I am writing a program which uses a database. This program allows you to create modules which have screens and fields. I am trying to make this as OO as possible and was unsure of the following scenario.
I want to get the list of fields for a module from the database. When i get the result set i will have a factory method which will return the correct type of field as there are many depending on which type is recorded in the database.
These fields have properties in the database such as id, name, caption etc. I will have all the getters public but i think i should have all the setters as default to keep setters controlled at package level only.
I want the fields to be fully set up with their field id, name and caption. I used to let the factory class Create the instance of the field and set all its properties. However, more advanced developers have said that the factory method should only create the instance. They have also told me that i should not collect the many properties in the field constructor and set them as this is bad practise. So how can i set up all these values in an approved OO way?
- By rookiecoder in forum New To JavaReplies: 7Last Post: 09-19-2012, 12:58 PM
- By Qurawe in forum JDBCReplies: 4Last Post: 06-30-2011, 10:56 PM
- By atul_kumar2038 in forum New To JavaReplies: 2Last Post: 09-14-2010, 07:21 PM
- By Boysie in forum Jobs DiscussionReplies: 4Last Post: 04-14-2010, 09:32 PM
- By DrMath in forum New To JavaReplies: 1Last Post: 09-29-2009, 07:07 PM