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?