Documente Academic
Documente Profesional
Documente Cultură
Faculty: Mrs.G.Sudeepthi
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions DEPARTMENT OF COMPUTER SCIENCE III/IV CSE I SEM (2012-2013) OBJECT ORIENTED ANALYSIS AND DESIGN The main Objectives of this course are: 1. Object oriented Analysis and Design using UML present the concepts and techniques necessary to effectively use system requirements to drive the development of a robust design model. 2. The UML is used throughout the project lifecycle to capture and communicate analysis and design decisions. 3. To gain enough competence in object-oriented analysis and design (OOAD) to tackle a complete OOproject 4. To acquire UML, a common language for talking about requirements, designs, and component interfaces.
5. To understand the main principles of OO design.
6. To understand what major tasks are appropriate to developing OO models and software 7. To understand the issues and options in reuse and component based development. 8. Highlighting the impotence of object oriented analysis and design and its limitations 9. Showing how we apply the process of object oriented analysis and design to software development. 10. Pointing out the importance and function of each UML model to the process of object oriented analysis and design, and explaining the notation of various elements in these models. 11. Providing students with necessary knowledge and skills in using object oriented CASE Tools.
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions UNIT-I Syllabus: Introduction to UML: Importance of modeling, principles of modeling, object oriented modeling, conceptual model of the UML, Architecture, and Software Development Life Cycle. Objectives:
To Understand the principles of modeling To identify the different stages in Software Development Life Cycle. To understand the various building blocks of UML.
Lecture plan: S.No Topic Importance of modeling 1 2 3 4 5 6 Principles of modeling Object oriented modeling Conceptual model of the uml Architecture Software development life cycle Total No Of Classes No. of lectures 1 1 1 3 1 2 9
Assignment Questions:
1. What is UML.Write the importance of modeling and principles of modeling? 2. Explain object oriented modeling?
5. Write short notes on diagrams in the UML. Academic Dairy Handbook III CSE II SEM
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions Case study: Study and identify the various requirements involved in designing the below explained case studies
Case study 1. The Trusty Car Company Group: The trusty car company group is rapidly growing business.It was formed about two years ago by the merger of a number of garages who are specialized in sale of used cars.As the newly formed company expanded to cover the sale of new vehicles .The primary business is currently considered to be in car sales both new and used cars .the used cars are from variety of sources.The used cars held at particular garage come from TCCG garages,some from customer trade ins at the garage.Each garage aims to keep a limited number of second hand cars in stock depending upon current trends with in the group as well as local sale patterns. In addition to used cars each garage keeps limited supply of new cars.These are available to customed to test drive/purchase.A record is maintained of all new cars on stock with the TCCG.If customer requires a particular car and the local garage does not have the required car .the sales staff can check if another car in TCCG has one on stock.If one can be located then a transfer /exchange between garages is arranged by the manager.If not available then they can place a new requirement with car manufacturer.Although the members of sales staff can take the bookings for test drives but the final authorization rests with the manager. Each garage has number of other departments like Parts Servicing Administration The primary purpose of parts department is in supplying the service department and supporting car sales.The parts department can also trade with customers directly.The service department has variety of functions like basic car servicing and valet servicing.The administration department has functions like Academic Dairy Handbook III CSE II SEM
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions taking care of staff salaries,holidays,leaves,general switch board activities,handle booking cars for service department. Case study 2: Description for an ATM System The software to be designed will control a simulated automated teller machine (ATM) having a magnetic stripe reader for reading an ATM card, a customer console (keyboard and display) for interaction with the customer, a slot for depositing envelopes, a dispenser for cash (in multiples of Rs. 100, Rs. 500 and Rs. 1000), a printer for printing customer receipts, and a key-operated switch to allow an operator to start or stop the machine. The ATM will communicate with the bank's computer over an appropriate communication link. (The software on the latter is not part of the requirements for this problem The ATM will service one customer at a time. A customer will be required to insert an ATM card and enter a personal identification number (PIN) - both of which will be sent to the bank for validation as part of each transaction. The customer will then be able to perform one or more transactions. The card will be retained in the machine until the customer indicates that he/she desires no further transactions, at which point it will be returned - except as noted below. The ATM must be able to provide the following services to the customer:
1.
A customer must be able to make a cash withdrawal from any suitable account linked to
the card, in multiples of Rs. 100 or Rs. 500 or Rs. 1000. Approval must be obtained from the bank before cash is dispensed. 2. A customer must be able to make a deposit to any account linked to the card, consisting of cash and/or checks in an envelope. The customer will enter the amount of the deposit into the ATM, subject to manual verification when the envelope is removed from the machine by an operator. Approval must be obtained from the bank before physically accepting the envelope. 3. A customer must be able to make a transfer of money between any two accounts linked to the card. 4. A customer must be able to make a balance inquiry of any account linked to the card. Academic Dairy Handbook III CSE II SEM
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 5. A customer must be able to abort a transaction in progress by pressing the Cancel key instead of responding to a request from the machine. The ATM will communicate each transaction to the bank and obtain verification that it was allowed by the bank. Ordinarily, a transaction will be considered complete by the bank once it has been approved. In the case of a deposit, a second message will be sent to the bank indicating that the customer has deposited the envelope. (If the customer fails to deposit the envelope within the timeout period, or presses cancel instead, no second message will be sent to the bank and the deposit will not be credited to the customer. If the bank determines that the customer's PIN is invalid, the customer will be required to reenter the PIN before a transaction can proceed. If the customer is unable to successfully enter the PIN after three tries, the card will be permanently retained by the machine, and the customer will have to contact the bank to get it back If a transaction fails for any reason other than an invalid PIN, the ATM will display an explanation of the problem, and will then ask the customer whether he/she wants to do another transaction. The ATM will provide the customer with a printed receipt for each successful transaction The ATM will have a key-operated switch that will allow an operator to start and stop the servicing of customers. After turning the switch to the "on" position, the operator will be required to verify and enter the total cash on hand. The machine can only be turned off when it is not servicing a customer. When the switch is moved to the "off" position, the machine will shut down, so that the operator may remove deposit envelopes and reload the machine with cash, blank receipts, etc. Case Study 3:BANK Design a system to handle current and savings account for a bank .Accounts are assigned to one or more customers who may make deposits or with draw of money. each type of account earns interest on current balance held in it. current accounts may have negative balances (over drafts) and then interest is deducted. Rate of interest is different for each type of account. Bank employees can check any account that is held at their branch. They are responsible for invoking the addition of interest and for issuing statements at correct times. Academic Dairy Handbook III CSE II SEM
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions A customer may perform money transfer from one account and get credited to another account .Transfer with in a branch happen immediately but transfer to other branches take three days time .The customer passes over to the bank an amount of money in some combination of cash and cheques. The customer specifies which account to be credited. The teller checks the balance and authorizes the updating of relevant account. If the money is incorrect or balance is not sufficient the teller informs the customer and returns the money and account is not updated. When customer applies to open a new account the teller processing the application must check with the manager.The manager has other duties such as checking the books from time to time Case study 4: Restaurant system: The system is intended to support the day-to-day operations of a restaurant by improving the processes of making reservations and allocating tables to customers. The Restaurant system provides the facilities like Record Booking Cancel Booking Record Arrival Table Transfer The new system can offer diners eat at the restaurant without making an advance booking, if a free table is available. This is known as Walk-in. The new system should display the same information as the existing booking sheet and in same format, to make it easy for restaurant staff to transfer, to the new system. When new bookings are recorded or changes made to existing bookings, the display should be immediately updated, so that restaurant staff is working with the latest information available. The restaurant makes bookings, cancel bookings, record arrivals and table transfers of the customers. The receptionist is the employee of the restaurant who interacts with the customer whose work is supported by the system
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions The customer rings up to make a booking there is a suitable table free at the required day and time and the required day and time and the receptionist enters customers name, phone no. and records booking. When the customer arrives, his arrival is updated in the system and waiter attends to them. The customer can also cancel booking what he made or transfer the booking to another day or time. The receptionist can easily record , update and cancel the information about the bookings and customers The customers eat in restaurants even with out any reservations or bookings called Walk-in. Subjective Important Questions With Answers: 1. Explain the Algorithmic perspective of modeling.
OBJECT ORIENTED MODELING: In software these are several ways to approach a model. The two most
common views are 1. Algorithmic perspective: The traditional view of software developments takes an algorithmic prospective. In each approach, the main building block of software is the procedure or function. This view leads developers to focus on issues of control and the decomposition of larger algorithmic in smaller ones. There is nothing inherently evil about such a point of view expects that tends to yield brittle systems. As requirements change and the system grows, it is very hard to maintain the systems built with Algorithmic focus. 2.Explain the Objective oriented perspective Object oriented perspective: In this approach the main building block of all software systems is the Object or Class. An Object is a thing generally drawn from the vocabulary of the problem or the possible solution. A Class is a description of a set of common objects. Every object has identity, state, and behavior.Object oriented approach to software development has proven to be of value in building systems. Object oriented development provides the conceptual foundation for assembling systems out of components using technologies like Java Beans or COM+. Academic Dairy Handbook III CSE II SEM
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 3.What are the various building blocks of UML? BUILDING BLOCKS OF THE UML The vocabulary the UML encompasses three kinds of building blocks: 1. Things 2. Relationships 3. Diagrams Things: Things are the abstractions that are first class citizens in a model; relationships tie these things together; diagrams group interesting collection of things. Things in UML : There are four kinds of things in the UML (i). Structural things (ii).Behavioral things (iii). (iv). Grouping things Annotation things
These things are the basic object oriented buildings blocks of UML. You use them to write well-formed models. (i). Structural things Structural things are nouns of UML models. These are the mostly static parts of the model, representing elements that are either conceptual or physical. In all these are seven kinds of structural things. '
1.Class:First, a class is a description set of objects that share the same attributes, operations, relationships,
and semantics. A class implements one or more interfaces. Graphically a class is rendered as a rectangle, usually including its name, attribute, and operations. Academic Dairy Handbook III CSE II SEM
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 2. Interface: Second, an interface is a collection of operations that specify a service of a class or component. An interface therefore describes the externally visible behavior of that element. The interface might represent the complete behavior of class or component or a part of that behavior. An interface defines a set of operation specifications (That is, there signatures) but never a set of operation implementations. Graphically, an interface is rendered as a circle together with its name. An interface rarely stands alone. Rather, it is typically attached to the class or component that realizes the inter face. 3. Collaboration: Third, a collaboration defines interaction and is a society roles and other elements that work together to provide some cooperative behavior that's bigger than the some all the elements. Therefore, collaborations have structural as well as behavioral, dimensions. A given class might participate in several collaborations. These collaborations therefore represent the implementation of patterns that make up a system. Graphically the collaboration is rendered as an ellipse with dotted lines, usually including only its name. 4. Use Case: Fourth, a use case is a description of sequence of actions that a system performs that yields an observable result of value to a particular actor. A use case is issued to structure the behavioral things in a model. A use case is realized by collaboration. Graphically, a use case rendered as an ellipse with solid lines, usually including only its name. 5. Active Class: Fifth, an active class is a class whose objects own one or more processes or threads and therefore can initiate control activity.
10
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions An active class is just like a class except that its objects represent elements whose behavior is concurrent with other elements. Graphically an active class is drawn just like a class, but with heavy lines, including its name, attributes, and operations. 6. Component: Sixth, a component is a physical and replaceable part of a system that provides the realization of a set of interfaces. A component represents the physical packaging of the logical elements like class, interfaces, and collaborations. Graphically a component is rendered as rectangle with tabs, including only its name. 7. Node: Seventh, a node is a physical element that exists at run time and represents a computational resource. Generally it may have some memory and processing capability. A set of components may reside on node and may migrate from one node to another node. Graphically a node is rendered as cube, including only its name. (ii). Behavioral Things: These are the dynamic parts of UML models. These are the verbs of a model representing behavior over time and space. There two kinds of behavioral things. 1. Interaction 2. State machine 1. Interaction: An interaction is a behavior that comprises a set of messages exchanged among objects within a particular context to accomplish a purpose. The behavior of a set of objects can may be specified with an interaction. An interaction involves elements like messages, action sequences (the behavior invoked by a message), and links (the connection between objects).Graphically a message is rendered as a directed line, including the name of its operation. Academic Dairy Handbook III CSE II SEM
11
2. State machine: A state machine is behavior that specifies the sequences of states an object or an interaction goes through during its lifetime. The behavior of an individual class or a collaboration of classes may be specified with a state machine. A state machine involves elements Like states, transitions (the flow from state to state), events (things that trigger a transition), and activities (the response to a transition). Graphically a state is rendered as a rounded rectangle, including its name and sub states. (iii).Grouping Things: Grouping things are the organizational parts of UML models. These are the boxes into which a model can be decomposed. The primary kind of grouping thing is Packages. 1. Package: A package is a general purpose mechanism for organizing elements into groups. Structural things, behavioral things and other grouping things may be placed in package. A package is purely conceptual i.e. it exists at development time. A package is rendered as a tabbed folder, including only its name and sometimes its contents. There are several kinds of packages like frameworks, models, and subsystems. (iv). Annotational Things: Annotational things are the explanatory parts of UML models. These are the comments that are applied to describe any element in model. The primary kind of annotational thing is note. 1. Note:
12
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions A note is simply a symbol for rendering constraints and comments attached to an element or a collection of elements. Graphically a note is rendered as a rectangle with a dog eared corner, together with a textual or graphical comment.
Objective Questions: 1. UML is a a) Procedure oriented language c) Graphical Language 2. What are the nouns of UML? a) Structural things c) Grouping Things 3. What are the dynamic parts of UML? a) Structural things c) Grouping Things 4. What are the organizational parts of UML? a) Structural things c) Grouping Things 5. What are the explanatory parts of UML? a) Structural things c) Grouping Things 6. Use case is represented as Academic Dairy Handbook III CSE II SEM b) Behavioural Things d) An notational Things b) Behavioural Things d) an notational Things b) Behavioural Things d) an notational Things b) Behavioural Things d) An notational Things b) Object Oriented Language d) Object Based Language
13
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions a) Cube b) Circle c) Ellipse d) Rectangle with tabs 7. Node is represented as a) Cube b) Circle c) Ellipse d) Rectangle with tabs
8. Which of the following thing is grouping thing? a) use case b) Node c) Note d) Package
9. Which of the following thing is behavioural thing? a) Class b) Collaboration c) Node d) Interaction
10. Which of the following are the verbs of UML MODEL? a) Structural things c) Grouping Things b) Behavioural Things d) an notational Things
11. Which of the following are the static parts of UML model? a) Structural things c) Grouping Things b) Behavioral Things d) an notational Things
12. ----------is a society of roles and other elements that work together to provide some cooperative behaviour thats bigger than the sum of all the elements. a) Class b) Collaboration c) Node d) Interaction
13. Which diagram shows the static implementation view of a system? a) Class b) object c) use case d) component
14. Which diagram shows the static deployment view of a system? a) Class b) deployment c) use case d) component
15. Which diagram represents static snapshots of instances of the things found in class Academic Dairy Handbook III CSE II SEM
14
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions Diagrams. a) Class b) object c) use case d) component
16. Which relationship is used between parent and child classes. a) Dependency b) Generalization c) Association d) Realization
17. Which relationship is used between class and interface a) Dependency b) Generalization c) Association d) Realization
18. --------is a relationship between two things in which a change to one thing may affect the semantics of the other thing. a) Dependency b) Generalization c) Association d) Realization
20. -------is a relationship that describes a set of links among objects. a) Dependency b) Generalization c) Associationd) Realization
UNIT-II Syllabus: Basic Structural Modeling: Classes, Relationships, common Mechanisms, and diagrams. Advanced Structural Modeling: Advanced classes, advanced relationships, Interfaces, Types and Roles, Packages Objective:
15
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions To identify the various classes, relationships & Interfaces. Lecture plan: S.No Topic Classes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Relationships Common Mechanisms Diagrams Advanced Classes Advanced Relationships Interfaces Types and Roles Packages Classes Relationships Advanced classes and Advanced Relations Interfaces Packages Diagrams Total classes to complete UNIT-II Assignment: 1. a) Explain about attributes ,operations and responsibilities of Class b) Enumerate steps to model the vocabulary of a system? Academic Dairy Handbook III CSE II SEM No. of lectures 1 2 2 1 2 4 2 1 2 1 2 1 2 2 2 17
16
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 2. a) Enumerate steps to model the distribution of responsibilities in a system b) Enumerate steps to model the non software things? 3. a) Enumerate steps to model the primitive types? b) Explain about dependency and generalization relationships with examples? 4. a) Enumerate steps to model simple dependencies? b) Enumerate steps to model single inheritance? 5. Enumerate steps to model structural relationships with examples? Case Study: For the above description of case studies identify the various classes and design the class diagram 1. Trusty car company group 2. ATM System 3. Bank 4. Restaurant system Subjective Important Questions with answers:
1. Write short notes on Dependency & Generalization RELATIONSHIP A relationship is a connection among things. Graphically, a relationship is rendered as a path, with different kinds of lines used to distinguish the kinds of relationships. In object-oriented modeling, there are three kinds of relationships that are especially important: 1. dependencies, which represent using relationships among classes (including refinement, ace, and bind relationships);
17
2. generalizations: which link generalized classes to their Specialized A generalization is a relationship between a general thing (called the superclass or parent)and a more specific kind of that thing (called the subclass or child).Generalization is sometimes called an "is-a-kind-of' relationship: one thing (like theclass BayWindow) is-a-kindof a more general thing (for example, the class Window).Generalization means that objects of the child may be used anywhere the parent mayappear, but not the reverse.generalization means that the child is substitutable for the parent.A child inherits the properties of its parents, especially their attributes and operations.An operation of a child that has the same signature as an operation in a parent overrides the operation of the parent; this is known as polymorphism.Graphically, generalization is rendered as a solid directed line with a large open arrowhead, pointing to the parent.Use generalizations when you want to show parent/child relationships
To model the vocabulary of a system Identify those things that users or implementers use to describe the problem or solution. Use CRC cards and use case analysis to help fmd these abstractions. For each abstraction, identify a set of responsibilities. Make sure that each class is crisply defined and that there is a good balance of responsibilities among all your classes. Provide the attributes and operation that are need to carry out these responsibilities for each class
18
To model the distribution of responsibilities in a system Identify a set of classes that work together closely to carry out some behavior. Identify a set of responsibilities foe each of these classes. Look at this set of classes as a whole, split classes that have too many responsibilities into smaller abstractions, collapse tiny classes that have trivial responsibilities into larger ones, and reallocate responsibilities so that each abstraction reasonably stands on its own. Consider the ways in which those classes collaborate with one another, and redistribute their responsibilities accordingly so that no class within a collaboration does too much to too little
4. Write short notes on Responsibilities: A responsibility is a contract or an obligation of a class. When we create a class, we are making a statement that all objects of that class have the same kind of state and the same kind of behavior. The attributes and operations are just the features by which the class's responsibilities are carried out. When we model classes, a good starting point is to specify the responsibilities of the things in the vocabulary. Techniques like CRC cards and use case-based analysis are especially helpful here. A class may have any number of responsibility and at most just a handful. Graphically, responsibilities can be drawn in a separate compartment at the bottom of the class icon.
5.Write short notes on stereotype, tagged values & constraint A stereotype is an extension of the vocabulary of the UML, allowing you to create new kinds of building blocks similar to existing ones but specific to your problem. Graphically, a stereotype is rendered as a name enclosed by guillemets and placed above the name of another element. As an option, the stereotyped element may be rendered by using a new icon associated with that stereotype. A tagged value is an extension of the properties of a UML element, allowing you to create new information in that element's specification. Graphically, a tagged value is rendered as a string enclosed by brackets and placed below the name of another element.
19
6.Explain How to model a comment To model a comment Put your comment as text in a note and place it adjacent to the element to which it refers. You can show a more explicit relationship by connecting a note to its elements using a dependency relationship. You can hide or make visible the elements of your model as you see fit. This means that you don't have to make your comments visible everywhere the elements to which it is attached are visible. Rather, expose your comments in your diagrams only insofar as you need to communicate that information in that context. If your comment is lengthy or involves something richer than plain text, consider putting your comment in an external document and linking or embedding that document in a note attached to your model. As your model evolves, keep those comments that record significant decisions that cannot be inferred from the model itself, and discard the others.
7. Explain How To model new building blocks To model new building blocks Make sure there's not a way to express what you want by using basic U . what you want to mode, and define a new stereotype for that thing. We can define hierarchies of stereotypes so that you can have general kinds of stereotypes along with their specializations. Specify the common properties and semantics that go beyond the basic element being
If there's no other way to express the semantics, identify the primitive thing in the UML that's most like
20
Objective Questions: 1. ----------is a contract or an obligation of a class. a) Responsibility b) Operations c) Attributes d) Names
3. Which relationship is used between the super class and sub class a) Dependency b) Generalization c) Association d) Realization
4. ------ is a relationship that specifies that objects of one thing are connected to objects of another. a) Dependency b) Generalization c) Association d) Realization
5. -----------extends the vocabulary of the UML a) Tagged value b) Constraints c) Stereotypes d) adornments
6. ----------- extends the propertied of the UML a) Tagged value b) Constraints c) Stereotypes d) adornments
8. --------- creates new kinds of building blocks that are derived from existing ones but that are specific to our problem. a) Tagged value b) Constraints c) Stereotypes d) adornments
9. ---------- creates new information in that elements specification. Academic Dairy Handbook III CSE II SEM
21
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions a) Tagged value b) Constraints c) Stereotypes d) adornments 10.-------- is used to add new rules or modify existing ones a) Tagged value b) Constraints c) Stereotypes d) adornments
11. -------- view of a system encompasses the classes, interfaces, and collaborations that form the vocabulary of the problem and its solution. a) Use case b) Design c) Process d) Implementation
12. ---------view of a system encompasses the threads and processes that form the systems concurrency and synchronization mechanisms. a) Use case b) Design c) Process d) Implementation
13.--------- is a stereotype that apply to dependency relationships among packages a) access b)extend c)include d)become
14.---------is a stereotype that apply to dependency relationship among classes and objects in class diagram. a)bind b)extend c)include d)become
15.------- is a stereotype that apply to dependency relationship among usecases. a)bind b)extend c)become d)call
16.------- is a stereotype that is used among objects. a)bind b)extend c)include d)become
17. Which of the following is structural diagram a)Class diagram b) use cse diagram c) Sequence diagram d) Statechart
22
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 19.Which of the following is interaction diagram a)Object b)usecase c)class d)sequence
20.------- is a collection of operations that are used to specify a service of a class or component. a) class b)interface c)node UNIT-III Syllabus: Class & Object Diagrams: Terms, concepts, modeling techniques for Class & Object Diagrams. d)collaboration
Objective:
To apply knowledge of common modeling techniques in designing a system. To design class and object diagram by analyzing and interpreting the given data.
No. of lectures 1 1 4 1 2 9
Concepts Modeling Techniques for Class Diagrams Modeling Techniques for object Diagrams Case Study on Class and Object Diagrams Total classes to complete UNIT-III
b) Enumerate steps to model Simple collaborations? 2. Enumerate steps to model a logical database schema and explain with example? Academic Dairy Handbook III CSE II SEM
23
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions Case studies : Design the object diagram for the above description of case studies 1. Trusty car company group 2. ATM System 3. Bank 4. Restaurant system Subjective Important Questions with answers:
1.Write short notes on class diagrams CLASS DIAGRAMS Class diagrams are the most common diagram found in modeling object oriented systems. A class diagram shows a set of classes, interfaces, and collaborations and their relationships.You use class diagrams to model the static design view of a system. For the most part, this involves modeling the vocabulary of the system, modeling collaborations, or modeling schemes. Class diagrams are also the foundation for a couple of related diagrams: Component diagrams and deployment diagrams. Class diagrams are important not only for visualizing, specifying, and documenting structural models, but also for constructing executable systems through forward and reverse engineering. Contents: Class diagrams commonly contain the following things: Classes Interfaces Collaborations Dependency, generalization, and association relationships Like all other diagrams,
24
25
Reverse engineering is the process of transforming code into a model through a mapping from a specific implementation language. Reverse engineering results in a flood of information, some of which is at a lower level of detail than you'll need to build useful models. At the same time, reverse engineering is incomplete. There is a loss of information when forwarded engineering models into codes, and so you can't completely recreate from code unless your tools encode information in the source commits that goes beyond the semantics of the implementation language. To reverse engineer a class diagram. Identify the rules for mapping from your implementation language or languages of choice. This is something you'll want to do for your project or your organization as a whole. Using a tool, point to the model you'd like to reverse engineer. Use your tool to generate a new model or modify an existing one that was previously forward engineered. Using a tool, create a class diagram by querying the model. For example, you might start with one or more classes, then expand the diagram by following specific relationships or other neighboring classes. Exposes or hide details of the contents of this class diagrams as necessary to communicate your intent.
Objective Questions: 1.Which diagram shows a set of classes,interfaces and collaborations and their relationships Academic Dairy Handbook III CSE II SEM
26
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions a)Object b)usecase c)class d)component 2.Class diagram commonly contains a)classes b)interfaces c)collaborations d)all
3.--------diagram shows the static design view of a system a)Object b)usecase c)class d)component
4.Common uses of class diagram are a)to model the vocabulary of a system c)To model a logical database schema b)to model simple collaborations c)all
5.------is a diagram which shows set of objects,their state and relationships. a)Object b)usecase c)class d)component
6.Which diagram shows static design view of a system. a)Object b)usecase c)class d)component
7.------involves modelling a snapshot of the system at a moment in time a)Object b)usecase c)class d)component
9.Common uses of object diagram is a)to model object structure b)to model simple collaborations d)none
10.which diagram shows the static process view of a system a)Object b)usecase c)class d)component Academic Dairy Handbook III CSE II SEM
27
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 11.-----is an instance of a class diagram a) object diagram b) component diagram UNIT-IV Syllabus: Basic Behavioral Modeling-I: Interactions, Interaction diagrams. Objective:
c) deployment d)none
To identify the flow of control of messages and interaction among the objects To model the flow of control by using sequence and collaboration diagram in a given system.
Lecture plan: S.No Topic Interactions 1 2 3 Interaction Diagrams Interaction and Interactions Diagrams Total classes to complete UNIT-IV Assisgnment: 1. Write short notes on a) Objects and roles b) Links 2. a) Enumerate steps to model a flow of control? b) Write contents , common properties, common uses of interaction diagram? 3. Differentiate between Sequence diagram and Collaboration diagram? No. of lectures 2 3 1 5
Case Study: Design the following Sequence & collaboration diagram for the above description of case studies Academic Dairy Handbook III CSE II SEM
28
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 1. Trusty car company group 2. ATM System 3. Bank 4. Restaurant system Subjective Important Questions With answers:
1.What are interaction diagram and explain the common properties involved in designing it
TERMS AND CONCEPTS: An interaction diagram shows an interaction, consisting of a set of objects and their relationships, including the messages that may be dispatched among them. A sequence diagram is an interaction diagram that emphasizes the time ordering of messages. Graphically, a sequence diagram is a table that shows objects arranged along the X axis and the messages, ordered increasing time, along the Y axis .A collaboration diagram is an interaction is an interaction diagram that emphasizes the structural organization of the objects that send and receive messages. Graphically, a collaboration diagram is a collection of vertices and arcs.
Common Properties: An interaction diagram is the just a special kind of diagram and shares the same common properties as do all other diagrams-a name and graphical contents that are a projection into a model. What distinguishes an interaction diagram from all other kind of diagrams is its particular content.
29
2.What are the various thing to remember while designing interaction diagrams and explain about asynchronous messages Things to Note:
The flow of time is shown from top to bottom, that is messages higher on the diagram happen before those lower down The blue boxes are instances of the represented classes, and the vertical bars below are timelines The arrows (links) are messages - operation calls and returns from operations The hide and show messages use guards to determine which to call. Guards are always shown in square braces [ ] and represent constraints on the message (the message is sent only if the constraint is satisfied)
The messages are labelled with the operation being called and parameters are shown. You can choose to enter the parameters or not - this is dependent upon their importance to the collaboration being shown
The sequence numbers are not shown on the messages as the sequence is intrinsic to the diagram
30
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions Asynchronous Messages You can specify a message as asynchronous if processing can continue while the message is being executed. In the example below, the asynchronous call does not block processing for the regular call right below. This is useful if the operation being called is run remotely, or in another thread.
3.Write short notes on Collaboration Diagrams Collaborations are more complex to follow than sequence diagrams, but they do provide the added benefit of more flexibility in terms of spatial layout.
31
Using interaction diagrams, we can clarify the sequence of operation calls among objects used to complete a single use case. When drawing these diagrams, try to keep them as clear and simple as possible. Sequence diagrams are easy to read and follow, as they enforce a standard layout on the diagram. Collaborations have the added advantage of interfaces and freedom of layout, but can be difficult to follow, understand and create. It's also important not to confuse interaction diagrams with state and activity diagrams. Interaction diagrams are used to diagram a single use case. When you want to examine the behaviour of a single instance over time use a state diagram, and if you want to look at the behaviour of the system over time use an activity diagram. Objective Questions: 1.Which of the following is an event a)signal b)calls c)the passing of time d)a change in time
2.------------represents a named object that is dispatched asynchronously by one object and then received by another. a)signal b)calls c)the passing of time d)a change in time
3.---------represents the dispatch of an operation a)signal b)calls c)the passing of time d)a change in time
4.---------is a event that represents the passage of time a)signal b)calls c)time event d)a change in time
5.-------is an event that represents a change in state. a)signal b)calls c)the passing of time d)a change in time
6.which of the following is external event Academic Dairy Handbook III CSE II SEM
32
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions a)the pushing of a button b)an interrupt from a collision c)a&b d)none
7.which of the following internal event a)the pushing of a button c)a&b b)an interrupt from a collision d)overflow exception
8.------is a condition or situation during the life of an object during which it satisfies some condition,performs some activity a)state b)event c)node d)note
9.---------is a relationship between two states indicating that an object in the first state will perform certain actions and enter the second state when a specified event occurs and specified conditions are satisfied. a)state b)transition c)branching d)node
10.-------is an object that owns a process or thread and can initiate control activity. a)active object b)event c)branching d)node
11.---------is a lightweight flow that can execute concurrently with other threads within the same process. a)Thread b)active object c)branching d)node
12.-----------is a class whose instances are active objects. a)Thread b)active object c)branching d)active class
13.--------is a stereotype which apply to active classes a)process b)become c)extend d)include
14.-------is a denotation for the time at which an event occurs. a)timing mark b)location c)process d)Thread
33
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 15.---------- diagram shows a state machine, emphasizing the flow of control from state to state a)class b)object c)component d)state chart
16.---------is a behaviors that specifies the sequences of states an object goes through during its lifetime in response to events. a)state machine b)use case c)active class d)node
17.statechart diagram commonly contain a)simple states b)composite state c)transition d)all
18.common use of state chart diagram a)to model reactive objects c)to model operation 19.which of the following is behavioural diagram a)class b)object c)component d)state chart b)to model work flow d)none
20.which of the following is used to model the dynamic aspects of a system a)class b)object c)component UNIT-V Syllabus: Basic Behavioral Modeling-II: Use cases, Use case Diagrams, Activity Diagrams. Objective:
d)state chart
Ability to identify the various steps involved in forward & Reverse Engineering. Ability to identify the flow of events in different applications Ability to identify various activities, action states, messages & transitions.
34
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions Lecture plan: S.No Topic Use Cases 1 2 3 Use Cases Diagrams Acitivty Diagrams 3 2 No. of lectures 2
Assignment: 1. Write short notes on a) Use cases and Actors b) Use cases and Flow of events c) Use cases and Scenarios. d) Use cases and Collaborations 2. a) Enumerate steps to model the behaviour of an element? b) How to organize use cases? Explain. 3. a) Write Contents, common uses,Common properties of use case diagram b) Enumerate steps to model the context of a system. 4. Enumerate steps to model the requirements of a system. Case study: Design the usecase diagram and activity diagram for the above description of case studies Trusty car company group 2. ATM System 3. Bank Academic Dairy Handbook III CSE II SEM
35
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 4. Restaurant system Subjective Important Questions with answers: 1. Explain how to organize use cases and generalization can be viewed in usecases
ORGANIZING USE CASES You can organize use cases by grouping them in packages in the same manner in which you can
organize classes. You can also organize use cases by specifying generalization, include, and extend relationships
among them. Generalization Generalization among use cases is just like generalization among classes. Here it means that the child use case inherits the behavior and meaning of the parent use case; the child may add to or override the behavior of its parent; and the child may be substituted any place the parent appears (both the parent and the child may have concrete instances) 2.Write short notes on Include relationship Include relationship An include relationship between use cases means that the base use case explicitly incorporates the behavior of another use case at a location specified in the base. The included use case never stands alone, but is only instantiated as part of some larger base that includes it. You use an include relationship to avoid describing the same flow of events several times, by putting the common behavior in a use case of its own (the use case that is included by a base use case). You render an include relationship as a dependency, stereotyped as include. To specify the location in a flow of events in which the base use case includes the behavior of another, you simply write include followed by the name of the use case you want to include 3.What are the uses of Extend relationship? An extend relationship between use cases means that the base use case implicitly incorporates the behavior of another use case at a location specified indirectly by the extending use case.
36
relationship
conditions. by explicit interaction with an actor. Other Features Use cases are classifiers, so they may have attributes and operations that you may render just as for classes. One can think of these attributes as the objects inside the use case that you need to describe its outside Similarly, consider the operations as the actions of the system you need to describe a flow of events. These objects and operations may be used in interaction diagrams to specify the behavior of the use case. As classifiers, we can also attach state machines to use cases. You can use state machines as yet another way to describe the behavior represented by a use case.
behavior.
Objective Questions: 1. .------specifies the behaviour of a system or a part of a system a)usecase b)object c)class d)component
2. .-------describes a set of sequence, in which each sequence represents the interaction of the things outside the system Academic Dairy Handbook III CSE II SEM
37
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions a)usecase b)object c)class d)component 3. .---------represents set of roles of users a)an actor b)object c)class d)component
4. .A use case describes a)what a system does b)how a system does c) a&b d)none
5. .Actors may be connected to use cases only by ,.relationship a)association b)dependency c)realization d)b&c
6. .-----------is a specifice sequence of actions is usecase diagram a)usecse b)scenario c)actor d)a&c
7. -----------------is used to model the use case view of a system a)use case b)object c)component d)deployment
9. .------------is a diagram that shows a set of use cases and actors and their relationships a)usecase b)class c)object d) component
10. . Use case diagram commonly contain a)use cases b)actors c)relationships d)all
11. Common use of use case diagram a) to model the context of a system b)to model the requirements of a system c) A&b 12. which stereotype is used in use case diagram Academic Dairy Handbook III CSE II SEM d) none
38
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions a)extend b)include c)a&b d)none 13. .----------diagram shows flow of control from activity to activity a) Activity b)object c)class d)component
14. Activity diagram commonly contains a) Activity states b)action states c)transition d)all
15. ------represents the synchronization of two or more concurrent flows of control. a)join b)fork c)branching d)Transition
16. ---------specifies a locus of activities in activity diagram a)join b)fork c)branching d)swimlanes
17. Common uses of activity diagram a) to model a workflow b)to model an operation c) a&b d) none
18. -------represents the splitting of a single flow of control into two or more concurrent flows of control. a)join b)fork c)branching d)swimlanes
19. .Which state can be further decomposed. a)activity b)action c)a&b d)none
20. .-------is an ongoing nonatomic execution within a state machine a)activity b)action c)a&b d)none
39
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions Advanced Behavioral Modeling: Events and signals, state machines, processes and Threads, time and space, state chart diagrams. Objective:
Ability to identify the various steps involved in identifying the various states in various applications Ability to apply forward and reverse engineering to state chart diagrams.
Lecture plan: S.No Topic Events and Signals 1 2 3 4 5 7 8 State Machines Processes and Threads Time and Space State Chart Diagrams Processes and Threads State chart Diagrams No. of lectures 3 4 2 2 2 2 1
Assignment: 1. Explain the following events a. Signals b. Call Events c. The passing of time d. A change in state. 2. Enumerate steps to model a family of signals and explain? 3. Enumerate steps to model exceptions and explain? 4. Explain the following terms in UML a. States Academic Dairy Handbook III CSE II SEM
40
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions b. Transition
c. Sub states.
5. a) Enumerate steps to model the lifetime of an object. b) Enumerate steps to model multiple flows of control. Case study: Design the state chart diagram for the above description of case studies Trusty car company group 2. ATM System 3. Bank 4. Restaurant system Subjective Important Questions with answers:
1.Write short notes on event and signal An event is the specification of a significant occurrence that has a location in time and space. In the context of state machines, an event is an occurrence of a stimulus that can trigger a state transition. A signal is a kind of event that represents the specification of an asynchronous stimulus communicated between instances.
Kinds of Events: Events may be external or internal. External events are those that pass between the system and its actors. For example, the pushing of a button and an interrupt from a collision sensor are both examples of external events. Internal events are those that pass among the objects that live inside the system, An overflow exception is an internal event. In the UML, you can model four kinds of events, signals, calls, the passing of time, and a change in state. Signals:
41
using inheritance. Elevate more general ones and lower more specialized. Look for the opportunity for polymorphism in the state machines of these active objects. Where
you fmd polymorphism, adjust the hierarchy as necessary by introducing intermediate abstract signals. To model exceptions: For each class and interface, and for each operation of such elements. Consider the
exceptional conditions that may raise. Arrange these exceptions in a hierarchy. Elevate general ones, lower specialized ones, and introduce intermediate exceptions, as necessary. For each operation, specify the exceptions that it may raise. You can do so
42
2)
Event Trigger
The event whose reception by the object in the source state makes the
3) Guard condition
A Boolean expression that is evaluated when the transition is triggered by the reception of the trigger; if the expression evaluates False, the transition does not fire and if there is no other transition that could be triggered by that same event, the event is lost.
4)
Action
An executable atomic computation that may directly act on the object that
owns the state machines, and indirectly on other objects that are visible to the object. 5) Target state The state that is active after the completion of the transition. A transition is
rendered as a solid directed line from the source to the target state.
43
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 1.Which of the following is an event a) signal b)calls c)the passing of time d)a change in time
2.------------represents a named object that is dispatched asynchronously by one object and then received by another. a) signal b)calls c)the passing of time d)a change in time
3.---------represents the dispatch of an operation a)signal b)calls c)the passing of time d)a change in time
4.---------is a event that represents the passage of time a)signal b)calls c)time event d)a change in time
5.-------is an event that represents a change in state. a)signal b)calls c)the passing of time d)a change in time
6.which of the following is external event a)the pushing of a button c)a&b b)an interrupt from a collision d)none
7.which of the following internal event a)the pushing of a button c)a&b b)an interrupt from a collision d)overflow exception
8.------is a condition or situation during the life of an object during which it satisfies some condition,performs some activity a)state b)event c)node d)note
9.---------is a relationship between two states indicating that an object in the first state will perform certain actions and enter the second state when a specified event occurs and specified conditions are satisfied. Academic Dairy Handbook III CSE II SEM
44
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions a)state b)transition c)branching d)node 10.-------is an object that owns a process or thread and can initiate control activity. a)active object b)event c)branching d)node
11.---------is a lightweight flow that can execute concurrently with other threads within the same process. a)Thread b)active object c)branching d)node
12.-----------is a class whose instances are active objects. a)Thread b)active object c)branching d)active class
13.--------is a stereotype which apply to active classes a)process b)become c)extend d)include
14.-------is a denotation for the time at which an event occurs. a)timing mark b)location c)process d)Thread
15.---------- diagram shows a state machine, emphasizing the flow of control from state to state a)class b)object c)component d)state chart
16.---------is a behaviors that specifies the sequences of states an object goes through during its lifetime in response to events. a)state machine b)use case c)active class d)node
17.statechart diagram commonly contain a)simple states b)composite state c)transition d)all
18.common use of state chart diagram a)to model reactive objects c)to model operation b)to model work flow d)none
45
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 19.which of the following is behavioural diagram a)class b)object c)component d)state chart
20.which of the following is used to model the dynamic aspects of a system a)class b)object c)component UNIT-VII Syllabus: Architectural Modeling: Component, Deployment, Component diagrams and Deployment diagrams. Objective:
d)state chart
Ability to identify the various components and nodes in component & deployment diagrams Ability to model run time view of a system of a given application by using component & deployment diagrams.
Lecture plan: S.No Topic Component 1 2 3 4 5 Deployment Component Diagrams Deployment Diagrams Component and Deployment No. of lectures 2 2 2 2 2
Total classes to complete UNIT-VII 8 Assignment: 1. Write short notes on a) Components and classes b) Components and interfaces. 2. a) Explain about different kinds of components. Academic Dairy Handbook III CSE II SEM
46
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions b) What are the stereo types that apply to components.Explain? 3. a) Enumerate steps to model executables and libraries. b) Enumerate steps to model tables,files and documents? 4. a) Enumerate steps to model an API. b) Enumerate steps to model source code? 5. Write short notes on a) Nodes and Components b) Organizing nodes Case study: Design the component and deployment diagram for the above description of case studies Trusty car company group 2. ATM System 3. Bank 4. Restaurant system
Names:Every node must have a name that distinguishes it from other nodes. A name is a textual string. That name alone is known as a simple name; a path name is the node name prefixed by the name of the package in which
47
Nodes and Components: In many ways, nodes are a lot like components: Bothe have names; bote may participate in dependency, generalization, and association relationships; both may be nested; both may have instances; both maybe participants in interactions. However, there some significant differences between nodes and components. Components are things that participate in the execution of a system; nodes are things that execute
components. Components represent the physical packaging of otherwise logical elements; nodes represent the
physical deployment of components. The first difference is the most important. Simply put, nodes execute components are things that are executed by nodes. ORGANIZING NODES: You can organize by grouping them in packages in the same manner in which you can organize classes and components. You can also organize nodes by specifying dependency, generalization, and association relationships among them.
2. What are the various contents of component diagrams COMPONENT DIAGRAMS Terms and Concepts: A common diagram shows a set of components and their relationships. Graphically, a component diagrams is a collection of vertices and arcs.
48
Like all other diagrams, component diagrams may contain notes and limits. Component diagrams may also containing packages or subsystems, both of which are used to group elements of your model into larger chunks. Common Uses: You use component diagrams to model the static implementation views of a system. This view primarily supports the configuration management of a systems parts, made up of components that can be assembled in various ways to produce a running system. When you model the static implementation views of a system, you'll typically use component diagrams in one of four ways. To model source code With the most contemporary object- oriented programming languages, you'll cut code using integrated development environments that store your source code in files. You can use component diagrams to model the configuration management of these files, which represent work-product components. 1. To model executable releases
49
components stereotyped as files. For larger systems, use packages to show groups of source code files. Consider exposing a tagged values indicating such information as the version number of the source
code file, its author, and the date it was last changed. Use tools to manage the values of this tag. Model the compilation dependencies among these files using dependencies. Again, use tolls to help
50
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 1.------------is a physical and replaceable part of a system
a) node
b)object
c)component
d)class
2.----------is a collection of operations that are used to specify a service of a class or component
a) node
b)object
c)component
d)interface
3.DLL and EXE files are -----------------components a)deployment b)work product c)exection d)none
5.which of the following stereotype is applied to components a)file b)become c)extend d)include
6.-----------is a physical element that exists at run time and represents a computational resource. a) node b)object c)component d)class
7.----------diagram shows a set of components and their relationships a)class b)object c)component d)deployment
9.common use of component diagram a)to model source code b) to model work flow
51
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions 10.-----------is a diagram that shows the configuration of run time processing nodes and the components that live on them a)class b)object c)component d)deployment
12.Common use deployment diagram a)To model embedded system c)To model an operation b)To model work flow d)all
13.which diagram shows the static deployment view of a system a)component b)Deployment c)class d)object
14.-----------diagrams are essentially class diagrams that focus on a systems nodes a)component b)Deployment c)class d)object
15.-----------diagram is a special kind of class diagram that focuses on a systems components a)component b)Deployment UNIT-VIII Syllabus: Case Study: The Unified Library application The Library System is a web-based application used to automate a library. It allows the librarian to maintain the information about books, magazines and CDs. It also allows the librarian to maintain the information about its users. It provides the facilities such as search for items, browse, checkout items, return items, make reservation, remove reservation etc. to its users. c)class d)object
52
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions To borrow the items from the library, the users must register in the system. The search option allows the users to search for any item in the library. If the user finds that the required item is available in the library, he/she can checkout the item from the library. If the item is currently not available in the library, the user can make reservation for the item. When the item becomes available the respective user who made the reservation for that item first is notified. The reservation is canceled when the user checks out the item from the library or through an explicit cancellation procedure. The system allows the librarian to easily create, update, and delete information about titles, borrowers, items and reservations in the system. The librarian is an employee of the library who interacts with the borrowers whose work is supported by the system. The Library System can run on popular web-browser platforms like Windows Explorer, Netscape Navigator etc. It can be easily extended with new functionality The Library System might be:
It is a support system The library lends books, magazines and CDs to borrowers who are registered in the system The Library System handles the purchases of new titles for the library Popular titles are brought in multiple copies. Old books, magazines and CDs are removed when they are out of date or in poor condition
The librarian is an employee of the library who interacts with the borrowers whose work is supported by the system
A borrower can reserve a book, magazine or CD that is not currently available in the library so that when it is returned or purchased by the library, the borrower is notified
The reservation is canceled when the borrower checks out the book, magazine or CD or through an explicit cancellation procedure
The librarian can easily create, update, and delete information about titles, borrowers, items and reservations in the system
53
Dept. of Computer Science Engineering, School of Engineering, Anurag Group of Institutions The system can run on popular web-browser platforms like Windows Explorer, Netscape navigator etc. The system is easy to extend with new functionality
Objective:
Ability to design unified library application by using various diagram in UML. Ability to model & visualize any given application.
Lecture plan: S.No Topic Case Study 1 The Unified Library application No. of lectures 4
Assignment:
1. Study the library management application and visualize by the various diagrams in UML.
54