IGNOU Latest Assignments
IGNOU BCA Assignments MCA 2009
IGNOU BCA Assignments MCA 2008
IGNOU BCA Assignments MCA 2007
IGNOU BCA Assignments MCA 2006
IGNOU Latest Assignments
IGNOU BCA Assignments IGNOU BCA Assignments
IGNOU BCA Assignments IGNOU MCA Assignments
IGNOU MBA Assignmants IGNOU MBA Assignments

IGNOU > IGNOU Assignments > MCA > MCA 2009 Assignments >Object Oriented Analysis and DesignManagement

IGNOU MCA Assignments

Question 3 What is Inheritances? Explain with an example, how Inheritance is shown in class diagram

Ans.
An important concept in object-oriented programming is inheritance. It provides a way for objects to define relationships with each other.

As the name inheritance suggests an object is able to inherit characteristics from another object. In more concrete terms, an object is able to pass on its state and behaviors to its children. For inheritance to work the objects need to have characteristics in common with each other. For example, let's say we make a class called "Human" that represents our physical characteristics. It's a generic class that could represent you, me or anyone in the world. Its state keeps track of things like number of legs, number of arms, and blood type. It has behaviors like eat, sleep, and walk. Human is good for getting an overall sense of what makes us all the same but it can't for instance tell me about gender differences. For that we'd need to make two new class types called "Man" and "Woman". The state and behaviors of these two classes will differ from each other in a lot of ways except for the ones that their inherit from Human.

Therefore inheritance allows us to encompass the parent class' state and behaviors into its child. The child class can then extend the state and behaviors to reflect the differences it represents. The most important aspect of this concept to remember is that the child class is a more specialized version of the parent.

Superclass

In the relationship between two objects a superclass is the name given to the class that is being inherited from. It sounds like it's a super duper class but remember that it's the more generic version. Better names to use might be base class or simply parent class. To take a more real world example this time we could have a superclass called "Person". Its state holds the person's name, address, height and weight and has behaviors like go shopping, make the bed, and watch TV. We could make two new classes that inherit from Person called "Student" and "Worker". They are more specialized versions because although they have names, addresses, watch TV and go shopping, they also have characteristics that are different from each other. Worker could have a state that holds a job title and place of employment whereas Student might hold data on an area of study and an institution of learning.

What Is a Subclass?

In the relationship between two objects a subclass is the name given to the class that is inheriting from the superclass. Although it sounds a little more drab, remember that it's a more specialized version of the superclass. Subclasses can also be known as derived classes or simply child classes.

In the previous example, Student and Worker are the subclasses.

Number of Subclasses

You can have as many subclasses as you want. There is no limitation to how many subclasses a superclass can have. Likewise there's no limitation on the number of levels of inheritance. A hierarchy of classes can be built upon a certain area of commonality.

In fact, if you look at the Java API libraries you will see many examples of inheritance. Every class in the APIs is inherited from a class called java.lang.Object. For example, any time you use a JFrame object you're at the end of a long line of inheritance

: java.lang.Object
extended by java.awt.Component
extended by java.awt.Container
extended by java.awt.Window
extended by java.awt.Frame
extended by javax.swing.JFrame

In Java, when a subclass inherits from a superclass its known as "extending" the superclass.

Use of Inheritance

Inheritance allows programmers to re-use code they've already written. In the Human class example we don't need to create new fields in the Man and Woman class to hold the blood type because we can use the one inherited from the Human class.

Another benefit of using inheritance is it also allows us to treat a subclass as if it was a superclass. For example, let's say a program has created multiple instances of the Man and Woman objects. The program might need to call the sleep behavior for all these objects. As the sleep behavior is a behavior of the Human superclass we can group all the Man and Woman objects together and treat them as if they were Human objects

Question 4 What is an object? Critically explain “Object Identification is one of the major challenges in OOAD”.

ANS.

Objects are key to understanding object-oriented technology.

Object-oriented software is all about objects. An object is a "black box" which receives and sends messages. A black box actually contains code (sequences of computer instructions) and data (information which the instructions operates on). Traditionally, code and data have been kept apart. For example, in the C language, units of code are called functions, while units of data are called structures. Functions and structures are not formally connected in C. A C function can operate on more than one type of structure, and more than one function can operate on the same structure.

Not so for object-oriented software! In o-o (object-oriented) programming, code and data are merged into a single indivisible thing -- an object. This has some big advantages, as you'll see in a moment. But first, here is why SDC developed the "black box" metaphor for an object. A primary rule of object-oriented programming is this: as the user of an object, you should never need to peek inside the box!

Object is a pattern (exemplar) of a class. The class of Dog defines all possible dogs by listing the characteristics and behaviors they can have; the object Lassie is one particular dog, with particular versions of the characteristics. A Dog has fur; Lassie has brown-and-white fur.

Object identification is one of the major challenge in OOAD.

Object identification in object models means that every object instance has a unique, unchanging identity. Object identification is often referred to as an OID. OIDs are used to reference object instances.

Characteristics of OIDs:

OIDs are independent of data contained in the object. The internal data values are not used to generate identification.

OIDs are generated by the object system. Users or programs have no control over identification.

OIDs last the lifetime of the object. The OID never changes even when the data contents may change

PREVIOUSINDEXNEXT