We all reuse our code, but really, how many times did you find yourself re-writing something like this?
class Person{
private String firtsName;
private String lastName;
private Date dob;
...
private List<Address> addresses
or this
class Address {
private String address1;
private String address2;
private String city;
private String zip;
...
Wouldn’t it be nice if we had a library of free, mature, well written, best practice Entity types / beans / POJOs / POCOs so we all can finally say good bye to trying to clone the world in Java / C# / (replace with your favorite language) and start writing actual code.
Is there something like that?
Do you agree it’s required?
I’ve heard of no such library.
No, I don’t.
There are so many possible ways that you could write domain objects like this (depending on the business requirements), that organizing such a library would be a nightmare.
Besides, this kind of object typically consists of just getters and setters, and can be written very quickly … or even generated from a model … so you save very little time / effort by using a library.
(By contrast, the kind of classes you find in typical reusable class libraries are much more complicated, and much more difficult to write from scratch.)
Having said that, I think there is justification for reuse of this kind of thing on a larger scale; e.g. off-the-shelf components or systems for managing customer databases, or website account details.