CS304 assignment No 01 Solution and DiscussionHere You can read CS304- Object Oriented Programming Assignment No. 1 Solution and Discussion Spring 2017 . CS304 assignment Deadline : April 27, 2017. Total Marks : 20.
Previously we shared : CS304 Assignment No. 1 Spring 2017.
|CS304 assignment No 01 Solution and Discussion|
CS304 assignment Instructions:Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
- The assignment is submitted after due date.
- The assignment is submitted via email.
- The assignment is copied from Internet or from any other student.
- The submitted assignment does not open or file is corrupt.
- It is in some format other than .doc (MS Word Document).
For any query about the assignment, contact at CS304@vu.edu.pk
CS304 assignment ObjectiveThe objective of this assignment is:
To give you the practical implementation of Class Diagram
For any query about the assignment, contact at email@example.com
CS304 assignment No 01 Helping MaterialFirst of All You need to understand few basic concepts:
- What is Association
- What is Aggregation
- What is Composition
What is AssociationAssociation is a relationship where all objects have their own life cycle and there is no owner.
Let’s take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers, but there is no ownership between the objects and both have their own life cycle. Both can be created and deleted independently.
What is AggregationAggregation is a specialized form of Association where all objects have their own life cycle, but there is ownership and child objects can not belong to another parent object.
Let’s take an example of Department and teacher. A single teacher can not belong to multiple departments, but if we delete the department, the teacher object will not be destroyed. We can think about it as a “has-a” relationship.
What is CompositionComposition is again specialized form of Aggregation and we can call this as a “death” relationship. It is a strong type of Aggregation. Child object does not have its life cycle and if parent object is deleted, all child objects will also be deleted.
Let’s take again an example of relationship between House and Rooms. House can contain multiple rooms - there is no independent life of room and any room can not belong to two different houses. If we delete the house - room will automatically be deleted.
Let’s take another example relationship between Questions and Options. Single questions can have multiple options and option can not belong to multiple questions. If we delete the questions, options will automatically be deleted.