Introduction
This is part 8 of my series, Database Essentials. Database Essentials is division 1 of a set of tutorials I have on Database. In this part of the series, we look at what is called the Composition Association. This is another kind of relationship we have to learn. Our aim is to discover the nature of this association and not to know how to derive it or when to use it or how to use it.
Meaning of Composition Association
A composition is similar to an Aggregation. However in a composition you have classes that ultimately become the new class. In other words you have objects that ultimately become the new object. This means that you have tables whose rows (properties), can be described as properties of the new table. Composition deals more with physical entities than aggregation. Composition examples are usually found in factories.
We saw an example of an aggregation relationship in the previous part of the series. There we had a Sale table and a SaleItem table. In this tutorial we shall look at an example of a composition relationship.
Example
Consider a factory where bicycles are manufactured. The ultimate object (class) is a bicycle. This bicycle is built from wheels, crank, stem, etc. This means that the classes of wheels, crank, stem, etc. ultimately form the bicycle class. In other words the bicycle object is built from the objects, wheels, crank, stem, etc. Fig 8.1 shows a class diagram for this bicycle composition relationship. You have to open the following link in a new browser tab to see the figure.
http://www.cool-mathematics.biz/diagrams/composition.htm
There are four tables in the diagram. You have the bicycle table where each row is for one bicycle (finished product). You have the Wheels table where each row is for a wheel (component) in the factory store. You have the Crank table where each row is for a crank (component) in the factory store. You have the Stem table where each row is for a stem in the factory store. For each row in the Bicycle table, there are two rows in the Wheels table (one bicycle has two wheels), one row in the Crank table and one row in the Stem table. In practice, there will be many other component tables, not just three as indicated.
In the diagram the diamonds are filled diamonds, while for the aggregate relationship, the diamond is an open diamond.
The tables for the components are linked to the Bicycle table by the presence of their IDs in the Bicycle table.
Conclusion
In a composition you have classes that ultimately become a new class. In the above example, the Wheels, Crank and Stem classes, all became the Bicycle class (finished product). This means that you have tables whose rows (properties), can be described as properties of the new table. Composition deals more with physical entities than aggregation. Composition examples are usually found in factories.
Chrys
Published by Chrys Forcha
I have more than 10 years experience in computer programming, software, electronics and telecommunications. I have a First Degree in Electronics and a Master's Degree in Technical Education. As well a... View profile
- Database N-to-N RelationshipsIn this part of the tutorial we look at one-to-one, one-to-many and many-to-many relationships.
Twelve Decisions that Will Impact Your First Year in College and Beyond,...The following tips stem from twelve of the myriad decisions my friends and I made during our first year in college, the twelve that really matter for just about everyone.
- 3 Things that Will Help You Grow and Develop SpirituallyIf you want to grow and develop spiritually then you should attend religious ceremonies, meditate and take continuing education classes. Always set goals that allow you to develop spiritually.
- The Effect that "Coming Out" has Upon a FamilyThis is a brief look at the effect that disclosure of sexuality, or "Coming Out" has upon a family according to Family Systems Theory; an overview of systems theory, the disclosure process, and some expectations for f...
10 Classes Every Job Seeker Should TakeTen skill sets that every job seeker should have to land a job.
- Database Table Data Types
- Database Associations Overview
- Database
- Book Review: Molly Bang's Picture This: Perception and Composition
- Mangrove Ecology/ Vegetation and Its Relation to Shore Platforms and Sediment Comp...
- From Minneapolis, MN to Somerset, WI (and Almost Back)
- Database Table Keys



