Hi All
I'm working on the B&S. I�ve been playing with a few ideas since receiving my assignment while I wait to attend a course book by my company run by sun which will help me with ideas.
I�m looking to made use of design
patterns where ever I can. The first that comes to mind is the Transfer design pattern as mentioned in Andrew Monkhouse�s book ( he applies it to replicate the record structure for his DVD class). In his example his example he defines this class that that it is pretty rigid, it matches his data file�s current structure. In my assignment I would have something like the follow to represent the equivalent:
Public contractor{
private Boolean deleted;
private int recordNo;
private
String name;
private String location;
private String specialties;
private String size;
private String rate;
private String owner;
�. Constructor goes here populating all the above values.
Public void setName(String name){this.name = name;}
Public getName(){return this.name;}
Etc�
}
Now, as a developer I have found over a number of years working, especially on green field projects, the user community keeps changing their mind on what they want (even after they've signed off the specifications). The supplied data file only 6 has columns. So what if they decide they want to add the phone number or remove the size column. With the above structure you would have to modify this class to add/remove getter and setter methods, visit the classes and methods that require the new method or remove the deprecated method including in the GUI swing components when using the MVC design pattern.
Can anybody explain why it is not a good idea to use a transfer data factory type object that uses generics and a map collection?
public class transferObject<key,val> {
Map<key,val> transferMap;
transferObject (Map<key,val> transferMap)
{
this.transferMap = transferMap;
}
The way I see it I can then take advantage by my front end never having to know what is basing its view on, it will be told at runtime what model to use. I am developing both models to see the difference as I go along to compare issues, but at the moment my generic method is seemingly a far better solution.
Any views and assistance welcome.
Cheers
Q