Reputation: 977
I have to design a Java Bean with 200 variables? is this the correct way? (or) Should I break the Bean into smaller logical beans and add to Main bean
P.S: I have a extract data from Legacy System and generate XML using Castor
Upvotes: 2
Views: 129
Reputation: 3295
Whether you break it down depends on the requirements of the application you are building.
If it were me, I would consider keeping separate beans, one for the bean that Castor needs to deserialize the XML (using the DTO pattern), other beans that make the information more usable and are generated from the DTO.
It absolutely depends on the application and the data though. I have seen beans in financial apps that have over 200 fields (complex derivatives) and breaking the beans down into smaller related beans would add too much opportunity for error.
Upvotes: 3