Objects should generally be normalized similar to a database so they contain only the attributes that make sense.
Each object should have Error
as the abstract parent object unless the object or its subclasses will never produce errors.
Each object should also have a create()
method which does the work of inserting a new row into the database table that this object represents.
An update()
method is also required for any objects that can be changed. Individual set()
methods are generally not a good idea as doing separate updates to each field in the database is a performance bottleneck.
fetchData()
and getId()
are also standard in most objects. See the tracker codebase for specific examples.
Common sense about performance should be used when designing objects.