Brown, K. and Whitenack, B.
Vlissides, J et al (eds), Pattern Languages of program design.
This paper deals with many issues with relation mappings to OO systems. This is a major issue in current real time OO centric systems. The paper concentrates on static mappings, that is how the objects map to tables and vice versa.
many of the issues raised come from basic DB theory and going from first Backus Normal form etc. Allot of the paper deals with the best way to deal with relationships and map these things from a design standpoint. Allot of this is hidden is we use something like Hibernate.
However we will return to this paper after we do some more things on Hibernate. However some key points to note:
- Look at the way objects map to the DB early so this mapping has some significant effect.
- Ensure you spend time with the database and map the relationships like you would when you going from 1st order through to 4th order BN.
- You will need to give every object some unique key, in order to make the relational world happy, that is everything will need some form of primary key, and this will help to amp relationships (from simple 1 : 1 to inheritance mappings).
- You will need to have some idea about the way the database stores primitive types so you know what format things will map to.
- When dealing with the issues of relationships you should use direct access (i.e. pointers within the object) rather than relying on the presence of foreign keys which is inherently slow. However ensure that these do exist and are updated to ensure that when an object needs to be instantiated it can be.