Monday 14 January 2013

Chapter 2: Introduction to Object Orientation



Essay Questions


1.      Define the meaning of the word “object” as it pertains to information systems. In doing so, discuss the two types of elements encapsulated in an object. Identify the terms used in object-oriented parlance that implement these two elements of an object? What are the terms that refer to a category of objects and a particular object? Finally, what is an object’s interface?

Answer:

An object is a perceptible or intelligible entity that encapsulates properties (data) and behavior. The properties are implemented as attributes and the behavior is implemented as operations, sometimes referred to as methods. A category of objects is called a class, and a particular object is an instance. An object’s interface is a named set of operations that characterize its behavior.

Page Reference:  32-33                                  Difficulty:  Moderate


2.      What is an operation? How does it contribute to the concept of a class? What are the elements that make up an operation? How is an operation related to and different from an attribute?

Answer:

An operation describes the behavior of a class. It is composed of a signature and an implementation. The signature includes the name, parameters, and return type of the operation, and a class’s operation signatures provide the interface to the class. Although an operation is sometimes referred to as a method, the method is actually its implementation. This is the code that carries out the logic required to achieve the behavior of the operation. Operations and attributes are both encapsulated by a class, but operations refer to behaviors and are typically verbs, whereas attributes refer to data and are typically names as nouns.

Page Reference:  34-35                                  Difficulty:  Moderate



3.      Name and describe the type of relationship that exists between a superclass and a subclass. What is the implication of this relationship in terms of the attributes and operations of these classes? Is an instance of the superclass going to be bigger than or smaller than an instance of the subclass? Why?

Answer:

The relationship between a superclass and subclass is called generalization. The superclass is more general and the subclass is more specific; thus the subclass is sometimes said to specialize the superclass. A subclass inherits the attributes and operations of its superclass. This means that any attribute (or operation) of the superclass is also an attribute (or operation) of the subclass. In addition, the subclass will also include its own attributes and operations that are not part of the superclass. This means that an instance of the subclass will be larger than an instance of the superclass, since the subclass contains at least as many and probably more attributes than the superclass instance.

Page Reference:  36-37                                  Difficulty:  Moderate

4.      Describe the polymorphic behavior as it pertains to OOSAD. What is the literal translation of the word “polymorphism?” How is it related to messages, operation signatures, class interfaces, and method implementations?

Answer:

The word “polymorphism” means “many forms.” In terms of OOSAD, this means that an identical message can be sent to objects of different types and invoke different behaviors. The messages sent to objects form the class interface. Each of these messages are sent in accordance with a method signature. Although the signatures of the operations in different classes may be identical, their implementations will be different, and this is what facilitates polymorphic behavior.

Page Reference:  37                           Difficulty:  Moderate

5.      What is a systems component? How does this relate to the concept of plug-and-play? Give examples of physical and software components. How is this term similar to and different from the concept of a subsystem?

Answer:

A system component is a replaceable part of a system that provides a clearly defined function through a set of interfaces. A key feature of components is the ability to replace one component with another one that provides identical interfaces. This is what plug-and-play is all about. An example in the physical world is the ability to exchange CD or DVD drives from different manufacturers into a computer. In software terms, the ability to replace one implementation of a software component such as a spell checker with another one, without the need to perform additional design or programming, is a desirable feature in object- oriented software development. Components are in fact subsystems, but the term component is usually used with respect to software implementations whereas the word subsystem is generally associated with systems analysis and design.

Page Reference:  38                           Difficulty:  Moderate
6.      Discuss the concepts of association, aggregation, and composition. Define each term, and compare them to each other in terms of strength and specificity. How does the concept of multiplicity fit with these terms? Give examples of multiplicity symbols and their meanings.

Answer:

The words association, aggregation, and composition all refer to relationships between instances of classes. The most general and “weakest” of these terms is association, which pertains to any kind of relationship between objects. A more specific and stronger association is aggregation, which indicates a whole-part relationship in which the aggregate has no meaning without its parts. The strongest and most specific of these is composition; here the whole has no meaning without the parts and the parts have no meaning without the whole. Multiplicity refers to the numbers of objects that can be on each side of the relationship. A multiplicity of 1 indicates that there must be exactly one object of a specified type in the relationship. A multiplicity of 0..* means that there can be any number of objects of the specified type in the relationship.

Page Reference:  39-40                                  Difficulty:  Moderate


7.      What is a systems model? What purpose does it serve in the systems development process? What is the standard technique for systems modeling in OOSAD, and what concepts and artifacts are symbolized in this modeling technique?

Answer:

A systems model is an abstraction of a system. Abstraction provides a general overview of the system and allows you to focus on relevant aspects while ignoring specific details. Thus, models help facilitate communication between users, developers, and stakeholders. They help in documentation and provide a starting point for the construction of the system. The primary modeling technique in object-oriented analysis and design is the Unified Modeling Language (UML). UML includes symbols for actors, classes and objects, relationships between them, and dynamic concepts such as interactions and activities.

Page Reference:  40                           Difficulty:  Moderate


8.      Discuss the evolution of object orientation, beginning with the first object-oriented language and culminating into the current standard modeling tool for OOSAD. Identify the approximate dates and the key players in this evolution, as well as the names of the key languages.

Answer:

The first object-oriented language was SIMULA, proposed in the mid 1960s. Object orientation was popularized in the 1970s with the development of the Smalltalk language by Xerox PARC, and became widespread in the 1980s with the emergence of C++, and even more so in the 1990s with Java. As object-oriented programming languages gained a foothold in the software development community, its influence extended to systems modeling. This led to the creation of the Unified Modeling Language (UML), an effort that was led by the three amigos, Booch, Rumbaugh, and Jacobson. UML is the standard that has been adopted by the Object Management Group (OMG). Version 1.0 was released by Rational Software in 1997, and enhancements have been made since.

Page Reference:  40-41                      Difficulty:  Hard


9.      Name and describe all the diagram types that make up the Unified Modeling Language. For each diagram, indicate what it models and whether it is static or dynamic.

Answer:

There are nine types of UML diagrams. A use case diagram illustrates the relationship between an actor (a user of the system) and a use case (a set of actions by the system). A sequence diagram illustrates the time-ordered message-passing interactions between objects, and a communication diagram shows these interactions without time ordering. An activity diagram shows the flow of activities within an object and a statechart diagram shows transitioning of an object from state to state in response to system events. All of these diagrams are dynamic in that they are showing actions and behaviors.

One type of static diagram is a class diagram, which shows the set of classes and their relationships, including association, generalization, and aggregation. Similarly, an object diagram shows object instances and their relationships. A component diagram shows software components or modules and their dependencies, and a deployment diagram shows the configuration of run-time processing nodes and the components that live on them.

Page Reference:  41-42                                  Difficulty:  Hard


10.  Consider the following scenario to model. There are two types of people to model, faculty members and students. Faculty members and students all have common characteristics such as names and addresses. Faculty members also have ranks and tenure status, whereas students have majors and grade point averages. You can request any type of person to provide information about himself or herself. If you make this request of any person, you will get their name and address. If you make this request of a faculty member, you will also get information about tenure status and rank, whereas if you make this request of a student, he will tell you about his major and GPA. A faculty member may advise one or more students.

In addition to modeling the people, we should model courses. Each course has a name, and a description, and perhaps one or more prerequisite course. A faculty member may teach any number of courses. A student may take any number of courses.

Discuss how you would model this scenario in an object-oriented system. In particular, identify all classes, their attributes, messages, and operations. Identify the generalizations and inheritance relationships, as well as any associations. Also, indicate whether polymorphism is involved; and if so, where it is.

Answer:

The classes involved here are Person, Faculty Member, Student, and Course. Student and Faculty Member are both subclasses of Person, so a generalization relationship exists between these subclass and the superclass. Attributes for Person include Name and Address, which are inherited by both Faculty Member and Student. The message is the request to provide information, and the operation is the behavior of providing information. Polymorphism exists because the same message causes different behaviors in Faculty Members and Students.

There is an association between Faculty Member and Courses in that each faculty member teaches courses. Similarly, there is an association between Students and Courses, in that a student may take any number of courses. There is also an association between Faculty Members and Students; this describes the advisory relationship. Finally, there is also an association between different courses, which expresses the prerequisite relationships between the courses.

Page Reference:  entire chapter                      Difficulty:  Hard

No comments:

Post a Comment