Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.


A Software company is developing a website for a university using a multiple inheritance between classes. The classes include Person, Teacher, Student, GradStudent, GradTeachAsst. 

Click here to view the class diagram of given scenario

For some reasons, the project design team decided not to use multiple inheritance for GradTeachAsst class, and give two alternatives. One is to use Composition and other is combination of Single Inheritance with Composition. Being a software developer which option you will select? Justify your answer with good reasons

Views: 1501

Replies to This Discussion

discuss here plz

length kitni honi chaheay gdb ki??

ya GDB bilkul thek ha

ofcourse i will suggest the 2nd methode of composition because Composition is fairly easy to understand - we can see composition in everyday life: a chair has legs, a wall is composed of bricks and mortar, and so on. While the definition of inheritance is simple, it can become a complicated, tangled thing when used unwisely. Inheritance is more of an abstraction that we can only talk about, not touch directly. Though it is possible to inheritance using composition in many situations, it is often unwieldy to do so. The purpose of composition is obvious: make wholes out of parts. The purpose of inheritance is a bit more complex because inheritance serves two purposes, semantics and mechanics. Inheritance is only good while you have specific number of class but handling large numbers of objects and class composition is the best idea. Another thing to consider when using inheritance is its “Singleness”. When deriving, it can only inherit from one super class and because of this, complex structures could use composition to make them easier to manage yet composition normally uses inheritance from its own super class. A valuable side-effect of modelling object relations using composition is that it exposes dubious design far more easily than inheriting implementation would.

Please Discuss here about this GDB.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

 

Note:-

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

Or visit this link 

Click Here For Detail.

&

.•°How to Download past papers from study groups°•.

 

Please Click on the below link to see…

.... How to Find Your Subject Study Group & Join .... 

GDB Solution:

Being a software developer I will go with composition. Composition allows the object encapsulation to persist and both objects can continue to be managed separately, so that changing the data of one class does not affect the other class data.

Complete GDB solution. Cs304

Being a software developer I will prefer to Composition vs inheritance.
Because composition allows the object encapsulation to persist and both objects can continue to be managed separately, so that changing the data of one class does not affect the other class data.
Also
composition as when the class uses another object to interacting with objects instead of directly with the implementation of methods and fields, we hide and protect the implementation of a class. If a consumer does not know anything about an object other than its public interface, then it cannot rely on any internal implementation details.

In my point of view composition is better than combining single inheritance in composition because of the following reasons:

1)      GradTeachAsst become a dependant class which is strongly related to teachers class.

2)      Combination is a weak relation in composition.

3)       Combining a single inheritance makes complex structure because in composition derived class is directly inherited from base class.

4)      In this way design become more flexible and provides more stable business domains.

 In this way encapsulation of data increases

Please Discuss here about this GDB.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

 

Note:-

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

Or visit this link 

Click Here For Detail.

&

.•°How to Download past papers from study groups°•.

 

Please Click on the below link to see…

.... How to Find Your Subject Study Group & Join .... 

RSS

Looking For Something? Search Below

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service