Sie sind auf Seite 1von 14

July 2011 Master of Computer Application (MCA) Semester 5 MC0083 Object Oriented Analysis & Design using UML

ML 4 Credits
(Book ID: B0969)

Assignment Set 1 (60 Marks)


Answer all Questions Each question carries TEN Marks

1. Write about the Object Oriented Systems Development Methodology with relevant real time examples In an object-oriented environment, software is a collection of discrete objects that encapsulate their data as well as the functionality to model real world objects. In an object oriented system, everything is an object and each object is responsible for itself. In a payroll application, instead of saying, System, compute the payroll of this employee, you tell the employee object, Compute your payroll. Advantages of Object Orientation Object oriented systems are easier to adapt to changing requirements, easier to maintain, more robust, and promote greater design and code reuse. 1. Higher level of abstraction: Top-down approach supports abstraction at the function level. The object-oriented approach supports abstraction at the object level. Since objects encapsulate both data (attributes) and functions (methods), they work at a higher level of abstraction. 2. Seamless transition among different phases of software development: The object-oriented approach essentially uses the same language to talk about analysis, design, programming and

database design. This seamless approach reduces the level of complexity and redundancy and makes for clearer, more robust system development. 3. Encouragement of good programming techniques: In a properly designed system, the classes will be grouped into subsystems but remain independent; therefore, changing one class has no impact on other classes, and so, the impact is minimized which encourages good programming. 4. Promotion of reusability: Objects are reusable because they are modeled directly out of real-world problem domain. The object orientation adds inheritance, which is a powerful technique that allows classes to be built from each other and therefore, only differences and enhancements between the classes need to be designed and coded.

2. Describe the following Object Oriented concepts with relevant real-time examples: o Objects The term object was first formally utilized in the Simula language. The term object means a combination of data and logic that represents some real world entity.

When developing an object-oriented application, two basic questions always rise:

What objects does the application need?

What functionality should those objects have?

Programming in an object-oriented system which consists of adding new kinds of objects to the system and defining how they behave.

Objects are grouped in classes

A class is a set of objects that share a common structure and a common behavior, a single object is simply an instance of a class. A class is a specification of structure (instance variables), behavior (methods), and inheritance of objects.

Attributes: Object state and properties Properties represent the state of an object: For example in a car object, the manufacturer could be denoted by a name, a reference to a manufacturer object, or a corporate tax identification number. In general objects abstract state can be independent of its physical representation.

Fig. 2.2: The attributes of a car object Object behavior and methods A method is a function or procedure that is defined for a class and typically can access the internal state of an object of that class to perform some operation. Behavior denotes the collection of methods that abstractly describes what an object is capable of doing. Each procedure defines and describes a particular behavior of the object. The object, called the receiver, is that on which the method operates. Methods encapsulate the behavior of the object, provide interfaces to the object, and hide any of the internal structures and states maintained by the object.

Objects respond to messages

Objects perform operations in response to messages. The message is the instruction and the method is the implementation. An object or an instance of a class understands messages. A message has a name, just like method, such as cost, set cost, cooking time. An object understands a message when it can match the message to a method that has a same name as the message. To match up the message, an object first

searches the methods defined by its class. If found, that method is called up. If not found, the object searches the superclass of its class. If it is found in a superclass, then that method is called up. Otherwise, it continues the search upward. An error occurs only if none of the superclasses contain the method.

A message is different from a subroutine call, since different objects can respond to the same message in different ways. This is known as polymorphism, and this gives a great deal of flexibility.

A message differs from a function. A function says how to do something and a message says what should be done.

Example: draw is a message given to different objects.

Objects respond to messages according to methods defined in its class o Encapsulation and Information Hiding Information hiding is the principle of concealing the internal data and procedures of an object and providing an interface to each object in such a way as to reveal as little as possible about its inner workings. C++ has a very general encapsulation protection mechanism with public, private, and protected members. Public members (member

data and member functions) may be accessed from anywhere. Private members are accessible one from within a class. An object data representation, such as a list or an array, usually will be private. Protected members can be accessed only from subclasses. In per-class protection, the most common form (e.g. Ada, C++, Eiffel), class methods can access any object of that class and not just the receiver. In per-object protection, methods can access only the receiver. An important factor in achieving encapsulation is the design of different classes of objects that operate using common protocol, or objects user interface. This means that many objects will respond to the same message but each will perform the message using operations tailored to its class. Data abstraction is the benefit of the object-oriented concept that incorporates encapsulation and polymorphism. o Polymorphism Poly means many and morph means form. In the context of object-oriented systems, polymorphism means objects that can take on or assume many different forms. Polymorphism means that the same operation may behave differently on different classes. Polymorphism allows us to write generic, reusable code more easily, because we can specify general instructions and delegate the implementation details to the objects involved. Since no assumption is made about the class of an object that receives a message, fewer dependencies are needed in the code and, therefore maintenance is easier. For example, in a payroll system, manager, office worker, and production worker objects all will respond to the compute payroll message, but the actual operations performed are object specific.

3. Explain Rumbaugh et al.s Object Modeling Technique (OMT) in detail.

The Object Modeling Technique (OMT) presented by Jim Rumbaugh and his co-workers describes a method for the analysis, design, and implementation of a system using an objectoriented technique. OMT is a fast, intuitive approach for identifying and modeling all the objects making up a system. Details such as class attributes, method, inheritance, and association also can be expressed easily. The dynamic behavior of objects within a system can be described using the OMT dynamic model. This model lets you specify detailed state transitions and their descriptions within a system. Finally, a process description and consumerproducer relationships can be expressed using OMTs functional model. OMT consists of four phases, which can be performed iteratively: 1. Analysis. The results are objects, dynamic and functional models. 2. System design. The results are a structure of the basic architecture of the system along with high-level strategy decisions. 3. Object design. This phase produces a design document, consisting of detailed objects static, dynamic, and functional models. 4. Implementation. This activity produces reusable, extendible, and robust code. OMT separates modeling into three different parts: 1. An object model, presented by the object model and the data dictionary. 2. A dynamic model, presented by the state diagrams and event flow diagrams. 3. A functional model, presented by data flow and constraints. The object model

The object model describes the structure of objects in a system: their identity, relationships to other object attributes, and operations. The object diagram contains classes interconnected by association lines. Each class represents a set of individual objects. The association lines establish relationships among the classes. Each association line represents a set of links from the objects of one class to the objects of another class.

Fig. 4.1: The OMT object model of a bank system. The boxes represent classes and the filled triangle represents specialization. Association between Account and Transaction is one to many; since one account can have many transactions, the filled circle represents many (zero or more). The relationship between Client and Account classes is one to one: A client can have only one account and account can belong to only one person (in this model joint accounts are not allowed).

The OMT dynamic model OMT provides a detailed and comprehensive dynamic model, in addition to letting you depict states, transitions, events, and actions. The OMT state transition diagram is a network of states and events. Each state receives one or more events, at the time it makes the transition to the next state. The next state depends on the current state as well as the events.

Fig. 4.2: State transition diagram for the bank application user interface. The round boxes represent states and the arrows represent transitions. The OMT functional model The OMT data flow diagram (DFD) shows the flow of data between different processes in a business. An OMT DFD provides a simple and intuitive method for describing business processes without focusing on the details of computer systems. Data flow diagrams use four primary symbols: 1. The process is any function being performed; for example, verify Password or PIN in the ATM system. 2. The data flow shows the direction of data element movement; for example, PIN code. 3. The data store is a location where data are stored; for example, account is a data store in the ATM example. 4. An external entity is a source or destination of a data element; for example, the ATM card reader.

Overall, the Rumbaugh et al. OMT methodology provides one of the strongest tool sets for the analysis and design of object-oriented systems.

Fig. 4.3: OMT DFD of the ATM system. The data flow lines include arrows to show the direction of data element movement. The circles represent processes. The boxes represent external entities. A data store reveals the storage of data. 4. What are the various classes in class stereotypes of software development process? Explain in detail. IntroductionThis section defines the UML Extension for Software Development Processes, defined in terms of the UMLs extensionmechanisms, namely Stereotypes, TaggedValues, and Constraints.See the UML Semantics chapter for a full description of the UML extension mechanisms.This chapter describes a UML extension that has been found useful in software development processes. Although thisextension was based on the Objectory process, it is general-purpose and may also be applied to other software developmentprocesses. It is not meant to be a comprehensive description of all software development processes, but is an example of onesuch process.Class StereotypesAnalysis classes come in the following three kinds: 1) entity, 2) control, and 3) boundary. Design classes are not stereotyped inthe process.EntityEntity is a class that is passive; that is, it does not initiate interactions on its own. An entity object may participate in manydifferent use case realizations and usually outlives any single interaction.ControlControl is a class, an object of which denotes an entity that controls interactions between a collection of objects. A control classusually has behavior specific for one use case and a control object usually does not outlive the use case realizations in which itparticipates.BoundaryA Boundary is a class that lies on the periphery of a system, but within

it. It interacts with actors outside the system as well asobjects of all three kinds of analysis classes within the system.NotationClass stereotypes can be shown with keywords in guillemets. They can also be shown with the following special icons.

5. Describe the goals and scope of UML with suitable examples.

The Unified Modeling Language (UML) is a standard language for specifying, visualizing, constructing, and documenting the artifacts of software systems, as well as for business modeling and other non-software systems. The UML represents a collection of best engineering practices that have proven successful in the modeling of large and complex systems.1 The UML is a very important part of developing object oriented software and the software development process. The UML uses mostly graphical notations to express the design of software projects. Using the UML helps project teams communicate, explore potential designs, and validate the architectural design of the software. Unified Modeling Language (UML) is a standardized general-purpose modeling language in the field of software engineering. The standard is managed, and was created by, the Object Management Group.UML includes a set of graphical notation techniques to create visual models of software-intensive systems. UML combines best techniques from data modeling (entity relationship diagrams), business modeling (work flows), object modeling, and component modeling. It can be used with all

processes, throughout the software development life cycle, and across different implementation technologies.[3] UML has synthesized the notations of the Booch method, the Object-modeling technique (OMT) and Object-oriented software engineering (OOSE) by fusing them into a single, common and widely usable modeling language. UML aims to be a standard modeling language which can model concurrent and distributed systems. UML is a de facto industry standard, and is evolving under the auspices of the Object Management Group (OMG). OMG initially called for information on object-oriented methodologies that might create a rigorous software modeling language. Many industry leaders have responded in earnest to help create the UML standard. UML models may be automatically transformed to other representations (e.g. Java) by means of QVT-like transformation languages, supported by the OMG. UML is extensible, offering the following mechanisms for customization: profiles and stereotype. The semantics of extension by profiles have been improved with the UML 2.0 major revision. Software Development Methods UML is not a development method by itself,[8] however, it was designed to be compatible with the leading object-oriented software development methods of its time (for example OMT, Booch method, Objectory). Since UML has evolved, some of these methods have been recast to take advantage of the new notations (for example OMT), and new methods have been created based on UML. The best known is IBM Rational Unified Process (RUP). There are many other UML-based methods like Abstraction Method, Dynamic Systems Development Method, and others, designed to provide more specific solutions, or achieve different objectives. Modeling It is very important to distinguish between the UML model and the set of diagrams of a system. A diagram is a partial graphical representation of a system's model. The model also contains a "semantic backplane" documentation such as written use cases that drive the model elements and diagrams. UML diagrams represent two different views of a system model Static (or structural) view: Emphasizes the static structure of the system using objects, attributes, operations and relationships. The structural view includes class diagrams and composite structure diagrams. Dynamic (or behavioral) view: Emphasizes the dynamic behavior of the system by showing collaborations among objects and changes to the internal states of objects. This view includes sequence diagrams, activity diagrams and state machine diagrams. UML models can be exchanged among UML tools by using the XMI interchange format Example:- Use Case diagram

6. What are the two ways of communicating with subsystem? Explain. There are two ways of communicating with a subsystem, either by sending stimuli to the subsystem itself to be re-directed tothe proper recipient inside the subsystem, or by sending stimuli directly to the recipient inside the subsystem. In the first case,an association is defined with the subsystem itself to enable stimuli sending.A subsystem can have generalizations to other subsystems, i.e., the public and protected elements in the contents of asubsystem as well as operations and receptions are also available to its heirs.A subsystem may offer a set of interfaces, i.e., for each operation defined in an interface, the subsystem offering the interfacemust have a matching operation, either as a feature of the subsystem itself or of a specification element.Profile: Profiles can contain stereotypes, tag definitions, and constraints. They can also contain data types that are used by tagdefinitions for informally declaring the types of the values that can be associated with tag definitions.

Model:

Figure 7.12: Model illustration shows Model and its environment in the metamodel by flattening the inheritance hierarchy.A model is a description of a physical system with a certain purpose, such as to describe logical or behavioral aspects of thephysical system to a certain category of readers. Examples of different kinds of models are use case, analysis, design, andimplementation, or computational, engineering, and organizational each representing one view of a physical system.Thus, a model is an abstraction of a physical system. It specifies the physical system from a certain vantage point (orviewpoint); that is, for a certain category of stakeholders (for example, designers, users, or orderers of the system), and at acertain level of abstraction, both given by the purpose of the model. A model is complete in the sense that it covers the wholephysical system, although only those aspects relevant to its purpose; that is, within the given level of abstraction and vantagepoint, are represented in the model. Furthermore, it describes the physical system only once; that is, there is no overlapping; nopart of the physical system is captured more than once in a model. A model consists of a containment hierarchy where the top-most package or subsystem represents the boundary of the physicalsystem. This package/subsystem may be given the stereotype topLevel to emphasize its role within the model. It is possibleto have more than one containment hierarchy within a model; that is, the model contains a set of top-most packages/subsystemseach being the root of a containment hierarchy. In this case there is no single package/subsystem that represents the physicalsystem boundary.The model may also contain model elements describing relevant parts of the systems environment. The environment istypically modeled by actors and their interfaces. As these are external to the physical system, they reside outside thepackage/subsystem hierarchy. They may be collected in a separate package, or owned directly by the model. These modelelements and the model elements representing the physical system may be associated with each other.A model may be a specialization of another model via a generalization relationship. This implies that all public and protectedelements in the ancestor are also available in the specialized model under the same name and interrelated as in the ancestor.A model may import or access another model. Models may be nested. A large physical system may be composed by a set of subordinate physical systems together making up the large physical system.

Das könnte Ihnen auch gefallen