vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · web...

103
KALASALINGAM UNIVERSITY Anand nagar,Krishnankoil 2 AND 16 MARKS QUESTION BANK MCA4003 O B J ECT OR I E N TE D A NA L Y S I S AN D D E S I G N

Upload: others

Post on 06-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

KALASALINGAM UNIVERSITY

Anand nagar,Krishnankoil

2 AND 16 MARKS QUESTION BANK

MCA4003 O B J ECT OR I E N TE D A NA L Y S I S AN D D E S I G N

Page 2: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

2 M A RKS Q UE S T I ONS A N D A N SW E RS

UN I T - I

1. What is object oriented analysis and design goals?It is one of the method of tracking problems by capturing the design that is

easy to communicate, review, implement and evolve.

2. Define analysis.Analysis emphasizes an investigation of problem rather than how a solution

is defined.“Do the right thing”.

3. Define design.Design emphasizes conceptual solution of problem rather than implementation.

“Do the thing right”.

4. Define OOAD.The essence of object oriented analysis and design is to consider a problem

domain and logical solution from the prescriptive of object.

5. Define OO analysis and design.OO Analysis find and describe the object.OO Design emphasizes defining the object’s attribute and methods.

6. List the key steps in OOAD. Define usecases Define domain model Define interaction diagram Define design class diagram

7. Define usecase.Use case is a textual description or a story describing the system. Usecase are

Page 3: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

not an object oriented, they are simply written stories. It is one of the popular tool in requirement analysis.

8. Define domain model or conceptual object model.The domain model is not a description of software object, it is a visualization

of concepts or mental models of a real world domain. It is also called as conceptual object model.

9. Mention the goal of interaction diagram.The main goal of interaction diagram is to show the responsibilities of objects

and how they collaborate to fulfill the requirements.10. Define UML.

Unified modeling language is a visual language used for specifying, constructing nd documenting a system. It is a standard diagrammatic notation used for drawing, presenting pictures related to software engineering.

11. What are the three ways to apply UML? UML as a sketch. UML as a blue print. UML as a programming language.

12. List the perspectives of UML. Conceptual perspectives. Specification perspectives. Implementation perspectives.

13. Define conceptual perspectives.UML diagrams are used to describe things in situations of real world. Raw

UML bject diagram notation used to visualize.

14. Define specification perspectives.It describes the real world things, software abstraction and component

with specification and interfaces.Raw UML class diagram notation used to visualize software components.

15. Define implementation perspectives.UML diagram describe the software component implementation in

a particular technology.

16. Define Unified Process (UP).

Page 4: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Unified process is a iterative process, risk driven process and architecturecentric approach to software development. It comes under software development process.

17. List the phases of UP. UP has four phases.

Inception. Elaboration. Construction. Transition.

18. What are the advantages of inception. Estimation or plans are expected to be reliable. After inception, design architecture can be made easily because

all the use cases are written in detail.

19. Define actor and scenario.Actor is something with behavior. It can be a system, person or a organization.

Scenario is a sequence of actions and interaction between actor and system. It is also called as instance of use cases.

20. List the types of actors. Primary actor. Supporting actor. Off stage actor.

21. Define inception.Inception is the initial stage of project. It deals with approximate vision,

business case, scope of project and vague estimation.

22. What are the uses of usecase. Use cases are very good way to keep everything simple. It gives the user’s goal and perspectives.

23. Define primary actor and supporting actor.Primary actor is used to find the user’s goal which drives the usecases. Eg. Cashier.Supporting actor is used to clarify external interfaces and protocols. Eg. System or organization.

Page 5: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

24. List the types of user interface free style. Essential style writing. Concrete style writing.

25. Define terse usecase.Terse usecase is used for avoiding or deleting noisy words or fuzzy words.

26. What are the basic procedures for use case. Choose the system boundary. Identify the primary actor. Identify the goal of the primary actor. Define the use case.

27. What are the test involved in use case.There are three types of test used in use case.

a. b. c.

28. Define EBP test.

Boss test. EBP test.Size test.

Elementary business process is related to business engineering. The task is performed by one person in one place at one time in response to business events which gives measurable business value.

29. List the types of use case relationships. Include relationship. External relationship. Generalization.

30. Define extension point.Extending use case is triggered by some condition. Extension point is labelled in

the base class and extending use case gives the full reference point of the extension.

Page 6: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

UN I T - II

2 - ma r ks

1. What is a domain model?A domain model is a visual representation of conceptual classes or real-situation

objects in a domain. Domain models have also been called conceptual models, domain object models and analysis object models.

2. Define domain model.Domain model means a representation of real-situation or conceptual classes, not of

software objects. The term does not mean a set of diagrams describing software classes, the domain layer of a software architecture, or software objects with responsibilities.

3. Is a domain model a Picture of Software Business Objects?A UP Domain Model is a visualization of things in a real-situation domain of interest,

not of software objects such as Java or C# classes, or software objects with responsibilities. Therefore, the following elements are not suitable in a domain model:

Software artifactsResponsibilities or methods.

4. What are Conceptual Classes?A conceptual class is an idea, thing, or object. A conceptual class may be

considered in terms of its symbol, intension, and extension. Symbol: words or images representing a conceptual class. Intension: the definition of a conceptual class. Extension: the set of examples to which the conceptual class applies.

5. Are Domain and Data Models the Same Thing?Data Model: It shows the persistent data to be stored somewhere else. It has relation database design. It has some attributes and methods.

Page 7: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Domain Model: Domain model is not a data model because it does not have attributes and methods for a class.

6. How to create a Domain Model?Bounded by the current iteration requirements under design:

1. Find the conceptual classes.2. Draw them as classes in a UML class diagram. 3. Add associations and attributes.

7. What are Three Strategies to Find Conceptual Classes? There are three strategies.

1. Reuse or modify existing models 2. Use a category list3. Identify noun phrases.

8. When to Model with ‘Description’ Classes?A description class contains information that describes something else. For

example, a product description that records the price, picture, and text description of an item.

9. When Are Description Classes Useful? Add a Description Class when:

There needs to be a description about an item or service, independent of the current existence of any examples of those items or services.

Deleting instances of things they describe results in a loss of information that needs to be maintained.

It reduces redundant or duplicated information.

10. Define Association With Example.Associations are defined as “the semantic relationship between two or more

classifiers that involve connections among their instances.”Example:

Register Records-cur ren

Sale

11. Why Should We Avoid Adding Many Associations?We need to avoid adding too many associations to a domain model. Too many

creates “visual noise” in a domain model.

1

1

Page 8: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

12. How to name an association in UML? Association names should start with a capital letter, since an association

represents a classifier of links between instances; in the UML, classifiers should start with a capital letter. Two common and equally legal formats for a compound association name are:

Records-current RecordsCurrent

13. What is role of association?Each end of an association is called a role. Roles may optionally have:

Multiplicity expression Name Navigability

14. Define Multiplicity.Multiplicity defines how many instances of a class A can be associated with one

instance of a class B. For example, a single instance of a Store can be associated with many” Item instances.

15. Define attributes with example.An attribute is a logical data value of an object. It is useful to identify those

conceptual classes that are needed to satisfy the information requirements of the current scenarios under development.For example, a receipt in the Process Sale use case normally includes adate and time, the store name and address, and the cashier ID, among many other things.

Sale

date Time

/ total : Money

16. When to show attributes?Include attributes that the requirements suggest or imply a need to remember

information.Therefore,

Sale needs a dateTime attribute. Store needs a name and address. Cashier needs an ID.

Page 9: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

17. What is the syntax for an attribute?The full syntax for an attribute in the UML is:

Visibility name: type multiplicity = default {property-string}.

18. What is derived attribute?The total attribute in the Sale can be calculated or derived from the information in

the SalesLineItem. It is derivable attribute, we use convention: a / symbol before the attribute name.

19. What is datatype attribute in the domain model?It is a primitive datatype such as numbers, character, Boolean, string and

enumerations.Example:

Cashier

Name

currentRegister

Here, currentRegister is not a datatype.

20. When to define new datatype classes?In the NextGen POS system an itemID attribute is needed; it is probably an

attribute of an Item or ProductDescription. For example, itemID : Integer or itemID : String. If itemID will be a class in the domain model then use the attribute of the item as itemIdentifier in software designing.

21. Hoe to apply activity diagrams?A UML activity diagram offers rich notation to show a sequence of activities,

including parallel activities. It may be applied to any perspective or purpose, but is popular for visualizing business workflows and processes and use cases.

22. Define generalization.Generalization is the activity of identifying commonality among concepts and

defining superclass and subclass relationships. For example, the concepts CashPayment, CreditPayment and CheckPayment are all very similar and it is possible to organize them into a generalization, specification, class hierarchy.

23. What is 100% Rule?

Page 10: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

100% of the conceptual super class definition should be applicable to the subclass. The subclass must conform to 100% of the superclass is attributes and associations.

24. Write guidelines to define conceptual subclasses.1. The subclas s has additional attributes of interest. 2. The subclass has additional associations of interest.3. The subclass concept is operated differently than the superclass.4. The subclass concept represents an animate thing that behaves differently than the

superclass or other subclasses.

25. Write guidelines to define conceptual superclass.1. The potential conceptual subclasses represent variations of a similar concept. 2. The subclasses will conform to the 100% and Is-a rule.3. All subclasses have the same attribute that can be factored out and expressed

in the superclass.4. All subclasses have the same association that can be factored out and

expressed in the superclass.

26. What is Aggregation?Aggregation is a vague kind of association in the UML that loosely suggests

whole-part relationships. It has no meaningful distinct semantics in the UML versus a plain association, but the term is defined in the UML.

27. Define Composition.Composition, also known as composite aggregation, is a strong kind of whole-

part aggregation and is useful to show in some models. It is an instance of a part belongs to only one composite instance.Example:

Sale1 1..*

SalesLineItem

28. How to identify composition?The lifetime of the part is bound within the lifetime of the composite there is a

create-delete dependency of the part on the whole.

29. Guidelines for writing activity diagram.1. This is used for very complex processor.2. If your business process, then use the rake notation for sub activity system.

Page 11: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

3. On the first overview “level0” diagram, keep all the actions at a very high level of abstraction, so that the diagram is short and sweet.

30. What are the UML activity notations? The UML activity notations are,

Rake symbol Merge symbol Decision symbol

UNIT-III

1. What is SSD?SSD stands for system sequence diagram during interaction and actor generates system

events to a system representing some system operation to handle the event the sequence diagram also illustrates the actors interaction and the operation initiated by them

2. What are the things that the system should react? External events from the actor Time events Fault or exceptions

3. What is the relationship between SSD and use cases? SSD:

It shows the system events for one scenario of a use case Use case:

System events are generated by use cases SSD are the visual representation of usecase.

4. How to model SSD involving other external system? SSD is used to illustrate collaboration between system. It can illustrate collaboration between pos and credit payment authorization system

5. Define layers:Layers are coarse grained grouping of classes /packages/subsystems these classes have same responsibility for major aspects of the system

6. What are the types of layers? lower layers

Page 12: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

higher layers

7. What are the parts of the layers? User interface Application logic/domain object Technical service

8. What are the types of layered architecture? Strict layered architecture Relaxed layer architecture

9. Define UML package diagramIt is used for the logical architecture of the system grouping of package is possible using

this package nesting of packages is common in uml package diagram.

10. What are the benefits of using the layers?There is a separation of concern. (ie)Separation of higher level from lower level services

this reduces coupling and improves cohesion by using layers complexity is reduced.

11. What do you meant by separation of concern?It is the responsibility of object in the layer should be strongly related to each other and

should not be mixed with the responsibility of other layer.

12. Define UI layer:UI layer should focus on UI work such as creating windows, capturing mouse and

keyboard events.

13. Define domain layer:It should focus on application logic such as calculating a sale total or taxes.

14. Define tier, layer and partioning: Tier:

It always represents the logical layer. But not the physical node but the word has become widely used to mean a physical processing node.

Layer:In layered architecture, vertical slices are called as layers

Partitioning:It represents horizontal division of relatively parallel subsystems of a layer.

15. What are the two types of interaction diagram? sequence diagram interaction diagram

16. Define sequence diagram:

Page 13: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

It is in the form of fence format. The new objects are added in the right side of the objects

17. What is the strength and weakness of sequence diagram? Strength:

It clearly shows sequence or time ordering messages. It has largest set of detailed notations

Weakness:Forced to extent to the right when adding new object consumes horizontal spaces

18. What is the strength and weakness of communication diagram? Strength:

Space is flexible to add new objects in two dimensions Weakness:

More difficult to see sequences of messages only fewer notations are present

19. Give the syntax for basic message expressions:Return: message(parameter parameterType):returntype

20. Define singleton objects:If a class has only one instances, then it is called a singleton objects Object is marked

with one in the upper right corner of the lifeline boxes.

21. Define found messages:Starting messages is called found messages. It is shown with a opening solid ball and

sender will not be specified and it is not shown where the messages is coming from.

22. What are the types of interaction frames? o alto loop o opt o paro region

23. Define classifier:It is a model which describes the behavior and structure .it is also a specialized one in a

class diagram .They are the generalization of many of the elements including classes, interfaces and use cases, actor.

24. Define abstract operation:It is denoted by keyword called leafIt is also denoted inside the curly braces. {Leaf}

25. Define dependencyThe dependency relationship indicates the client element has the knowledge of another

Page 14: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

supplier element. Any changes in the supplier element can affect the client. Dependency is indicated as a dashed arrow line from the client to the supplier

26. Define constraintsConstraints are the conditions or instructions written in curly braces. It is commonly used

in class diagram. It is a restriction or condition in UML element

27. Define aggregationIt is a kind of association in uml and it is a whole part relationship the other name is plane

association it has no meaningful distinct semantics in UML

28. Define compositionIt is a strong kind of relationship or whole part of aggregation the composition

relationship implies an instance of the path belongs to only one composite instance at a time.

29. What are the two types of notations for interface? o socketline notationo lollipop notation

30. Define active classAn active object runs on and controls its own thread of execution.then the class of an

active object is an active class

31. What are the three ways to show uml attribute? attribute text notation attribute as association in line notation both together

Page 15: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

UNIT-IV

T wo m arks q ue stio n with a n sw e rs

1. What is GRASP?

General Responsibility Assignment Software Patterns (or Principles), abbreviated GRASP, consists of guidelines for assigning responsibility to classes and objects in object-oriented design.

2. What is Responsibility-Driven Design?

A popular way of thinking about the design of software objects and also larger scale Components 3 are in terms of responsibilities, roles, and collaborations. This is part of a larger approach called responsibility-driven design or RDD.

3. What is Responsibilities?

The UML defines a responsibility as “a contract or obligation of a classifier”. Responsibilities are related to the obligations or behavior of an object in terms of its role.

4. What are the two responsibilities?

The responsibilities are of the following two types: doing and knowing.

Doing responsibilities of an object include: doing something itself, such as creating an object or doing a calculation initiating action in other objects controlling and coordinating activities in other objects

Page 16: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Knowing responsibilities of an object include: knowing about private encapsulated data knowing about related objects knowing about things it can derive or calculate

5. Define Pattern?

A pattern is a named and well-known problem/solution pair that can be applied in new context, with advice on how to apply it in novel situations and discussion of its trade-offs, implementations, variations, and so forth.

6. What are the GRASP patterns?

They describe fundamental principles of object design and responsibility assignment. expressed as patterns.

7. How to Apply the GRASP Patterns?

The following sections present the first five GRASP patterns:

Information Expert Creator High Cohesion Low Coupling Controller

8. Define Creator?

Creation of objects is one of the most common activities in an object-oriented system. Which class is responsible for creating objects is a fundamental property of the relationship between objects of particular classes.

9. What is Controller?

The Controller pattern assigns the responsibility of dealing with system events to a non-UI class that represents the overall system or a use case scenario. A Controller object is a non-user interface object responsible for receiving or handling a system event.

10. Define Low Coupling?

Low Coupling is an evaluative pattern, which dictates how to assign responsibilities to support:

low dependency between classes; low impact in a class of changes in other classes; high reuse potential;

Page 17: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

11. Define High Cohesion?

High Cohesion is an evaluative pattern that attempts to keep objects appropriately focused, manageable and understandable. High cohesion is generally used in support of Low Coupling. High cohesion means that the responsibilities of a given element are strongly related and highly focused. Breaking programs into classes and subsystems is an example of activities that increase the cohesive properties of a system.

12. What is Information Expert?

Information Expert is a principle used to determine where to delegate responsibilities. These responsibilities include methods, computed fields and so on. Using the principle of Information Expert a general approach to assigning responsibilities is to look at a given responsibility, determine the information needed to fulfill it, and then determine where that information is stored. Information Expert will lead to placing the responsibility on the class with the most information required to fulfill it

13. What is singleton pattern?

The singleton pattern is a design pattern used to implement the mathematical concept of a singleton, by restricting the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system.

14. What is adapter pattern?

The adapter pattern is a design pattern that translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface. The adapter is also responsible for transforming data into appropriate forms.

15. What is Facade Pattern?

A facade is an object that provides a simplified interface to a larger body of code, such as a class library. A facade can:

make a software library easier to use, understand and test, since the facade has convenient methods for common tasks;

make code that uses the library more readable, for the same reason;reduce dependencies of outside code on the inner workings of a library, since most code

uses the facade, thus allowing more flexibility in developing the system; Wrap a poorly-designed collection of APIs with a single well-designed API (as per task

needs).

16. What is Observer pattern?

Page 18: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

The observer pattern (a subset of the publish/subscribe pattern) is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. It is mainly used to implement distributed event handling systems.

17. What is Visibility?

Visibility is the ability of an object to “see” or have reference to another object. More generally, it is related to the issue of scope: Is one resource (e.g. instance) within the scope of another?

18. Give the types of Visibility?

There are four types of Visibilities. They are

Attribute Visibility Parameter Visibility Local VisibilityGlobal Visibility

19. What is attribute visibility?

Attribute visibility exists from an object A to object B when B is an attribute of A (Association). It is a relatively permanent visibility because it persists as long as A and B exists. This is the most common visibility in OO.

20. What is parameter visibility?

Parameter visibility exists from an object A to object B when B is passed as a parameter to a method of A (Dependency). It is a relatively temporary visibility because it persists as only within the scope of the method. This is the 2nd most common visibility in OO.

21. What is global visibility?

Global visibility exists from an object A to object B when B is globally visible (Dependency). It is a relatively permanent visibility because it persists as long as A and B exists. This is the least common visibility in OO. One way to achieve this, assign an

instance to a global variable (possible in C++but not in Java). The preferred method is to use the Singleton Pattern.

22. What is local visibility?

Local visibility exists from an object A to object B when B is declared as a local object in a method of A (Dependency). It is a relatively temporary visibility because it persists only within the scope of the method. This is the 3rd most common visibility in OO.

Page 19: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

UNIT-V

1. What are UML state machine diagrams?

A UML statechart diagram illustrates the interesting events and states of an object, and the behavior of an object in reaction to an event. Transitions are shown as arrows, labeled with their event. States are shown in rounded rectangles.

2. Define events with an example

An event is a significant or noteworthy occurrence. It is a label associated with a transition that identifies the message which causes a state change.

Example: A telephone receiver is taken off the hook.

3. Define state with an exampleA state is the condition of an object at a moment in time—the time between events.

Example: A telephone is in the state of being "idle" after the receiver is placed on the

hook and until it is taken off the hook.

4. Define transition with an exampleA transition is a relationship between two states that indicates that when an event occurs, the

object moves from the prior state to the subsequent state.Example: When the event "off hook" occurs, transition the telephone from the "idle" to "active" state.

5. What are operation contracts?

Operation Contracts gives the more detailed or precise description of system behavior. Operation Contracts use pre- and post- conditions to describe detailed changes to objects in the domain model, as a result of the system operation.

Page 20: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

6. Define pre and post conditions.

Preconditions are a constraint that must hold true before an operation is requested.

Post conditions are a constraint that must hold true after the completion of an operation.

7. What are the steps involved in mapping design to code?

Implementation in an object-oriented language requires writing source code for:

class and interface definitions method definitions

8. What are deployment diagrams?

A deployment diagram shows the assignment of concrete software artifacts (such as executable files) to computational nodes (something with processing services). It shows the deployment of software elements to the physical architecture and the communication (usually on a network) between physical elements

9. What is device node?

Device node (or device) is a physical (e.g., digital electronic) computing resource with processing and memory services to execute software, such as a typical computer or a mobile phone.

10. What is execution environment node?

Execution environment node (EEN) is a software computing resource that runs within an outer node (such as a computer) and which itself provides a service to host and execute other executable software elements.

Example: an operating system (OS)

11. What is Component Diagrams?The Component Diagram helps to model the physical aspect of an Object-Oriented

software system. It illustrates the architectures of the software components and the dependencies between them.

12. What is State-Independent and State-Dependent Objects?If an object always responds the same way to an event, then it is considered as state-

independent (or modeless) with respect to that event.State-dependent objects react differently to events depending on their state or mode.

13. What is a system operation?System operations are operations that the system as a black box component offers in its

public interface14. Define Operation in UML.

Page 21: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Operation is a specification of a transformation or query that an object may be called to execute. An operation has a signature, specified by its name and parameters, and it is invoked via a message. A method is specification of an operation with a specific algorithm.

15. Define a component.

A component represents a modular part of a system that encapsulates its contents and whose manifestation is replaceable within its environment. A component defines its behavior in terms of provided and required interfaces.

16. What is composite state?

Composite state can be broken down into substates.This can be done by nesting a state within a state.

17. How to create code from interaction diagrams?

The sequence of messages in an interaction diagram will be translated into the series of statements in method definitions

18. List out some complex reactive objects.

Physical devices controlled by software Transactions and related objectsRole mutators

19. Define Guard Conditions.

Guard Conditions are a logical condition that will return only ”true” or “false”. A guarded transition occurs only if the guard resolves to “true”.

20. What are the sections of the contract? Operation Cross reference Preconditions Postconditions

Page 22: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

16 M A RKS QU ES T I O NS A N D A N SW E RS UN I T I

1. What is UML? What are the ways and perspectives to apply UML?The Unified Modeling Language is a visual language for specifying, constructingand documenting the artifacts of systems.

Thr e e w a ys t o apply UM L:

1. UML as sketch: Informal and incomplete diagrams Created to explore difficult parts of the problem

2. UML as blueprint: Detailed design diagram Used for better understanding of code

3. UML as programming language: Complete executable specification of a software system in UML

Thr e e p er spectiv e s t o ap pl y UM L;

1. Conceptual perspective: Diagrams describe the things of real world

2. Specification perspective: Diagrams describe software abstractions or components with

specifications and interfaces

Page 23: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

3. Implementation perspective: Diagrams describe software implementation in a particular

technology

2. What is UP? Explain are the phases of UP.The Unified Process has emerged as a popular iterative software developmentprocess for building object oriented systems.

UP P hase s :

1. Inception: Initial stage of project Approximate vision Business case and scope Vague estimate

2. Elaboration: Refined vision Core architecture Resolution of high risk Identification of most requirement and scope Realistic estimate

3. Construction: Design the elements Preparation for deployment

4. Transition: Beta tests Deployments

3. Describe use case relationships.Use case relationships is divided into three types

1. Include relationship 2. Extend relationship 3. Generalization

1. Include relationship:

It is common to have some practical behavior that is common across several use cases.

It is simply to underline it or highlight it in some fashion Example:

Page 24: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Paying by credit: I n c lude Handle Cr e dit Pa yme nt

2. Extend relationship:

Extending the use case or adding new use case to the process Extending use case is triggered by some conditions called extension point.

3. Generalization:

Complicated work and unproductive time is spending in this use case relationship. Use case experts are successfully doing use case work without this relationship.

4. What are the templates used to write a Fully-dressed Use case?

Use ca se s e c tion C o m m e nts

Use case name Starts with a verb.

Scope The system under design.

Level Defines user goal.

Primary actor Who calls on the system to deliver its services.

Stake holders and interests Who cares about this use case and what do they do.

Precondition What must be true on start and worth telling the reader.

Success guarantee What must be true on successful condition.

Main success scenario A typical, unconditional happy path scenario of success.

Extension Alternate scenarios of success or failure.

Special requirements Related non functional requirements.

Technology and data variation list

Varying I/O methods and data formats.

Frequency occurrence Could be nearly continuous.

Page 25: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

16 marks

1. Explain in detail about Domain model.Domain model: Domain model means a representation of real-situation or

conceptual classes, not of software objects

Symbols used for Domain model:

1. Domain object/ conceptual classes2. Association between conceptual classes 3. Attributes and methods

Is a domain model a Picture of Software Business Objects:

A UP Domain Model is a visualization of things in a real-situation domain of interest, not of software objects such as Java or C# classes, or software objects with responsibilities. Therefore, the following elements are not suitable in a domain model:

Software artifactsResponsibilities or methods.

Conceptual classes: It is considered in terms of symbols, intension, extension.

Are Domain and Data Models the Same Thing:Data Model: It shows the persistent data to be stored somewhere else. It has relation database design. It has some attributes and methods.Domain Model: Domain model is not a data model because it does not have attributes and methods for a class.

2. Explain in detail about Association.Association: Associations are defined as “the semantic relationship between two or more classifiers that involve connections among their instances.”

Page 26: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

How to name an association in UML:Association names should start with a capital letter, since an association

represents a classifier of links between instances; in the UML, classifiers should start with a capital letter.Role of association: Each end of an association is called a role. Roles may optionally have:

Multiplicity expression Name Navigability

Multiplicity:

Multiplicity defines how many instances of a class A can be associated with one instance of a class B.

3. Explain in detail about Attributes.Attributes: An attribute is a logical data value of an object. It is useful to identify those conceptual classes that are needed to satisfy the information requirements of the current scenarios under development.When to show attributes?

Include attributes that the requirements suggest or imply a need to remember information.The full syntax for an attribute in the UML is:

visibility name : type multiplicity = default { property-string}. Derived attribute:

The total attribute in the Sale can be calculated or derived from the information in the SalesLineItem. It is derivable attribute, we use convention: a / symbol before the attribute name.Datatype attribute:It is a primitive datatype such as numbers, character, Boolean, string and enumerations.

4. Explain in detail about Domain model refinement. Generalization:Generalization is the activity of identifying commonality among concepts and defining superclass and subclass relationships lain in detail about Domain model refinement. 100% Rule:

100% of the conceptual super class definition should be applicable to the subclass. The subclass must conform to 100% of the superclass is attributes and associations.Guidelines to define conceptual subclasses:5. The subclas s has additional attributes of interest.

Page 27: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

6. The subclass has additional associations of interest. Guidelines to define conceptual superclass:

5. The potential conceptual subclasses represent variations of a similar concept. 6. The subclasses will conform to the 100% and Is-a rule.

5. Explain in detail about UML activity diagram.This diagram shows sequential and parallel activities in a process.

UML activity notations:The UML activity notations are,

Rake symbol Merge symbol Decision symbol

Guidelines for writing activity diagram:4. This is used for very complex processor.5. If your business process, then use the rake notation for sub activity system. 6. On the first overview “level0” diagram, keep all the actions at a very high

level of abstraction, so that the diagram is short and sweet.

Page 28: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

UNIT-3

16 MA R K S:

1. Explain about Logical Architecture And Uml Package Diagram:

L o g ical a r c h ite c tu re :

It’s called the logical architecture because there’s no decision about how these elements are deployed across different operating system processes or across physical computers in a network.

L a y er:

A layer is a very coarse grained grouping of classes,packages or subsystems that has a cohesive responsibility for a major aspect of the system.

Typically layers in an OO system include:

User Interface Application logic and domain objects Technical Services .

Layered architecture is divided into

Strict Layered architecture Relaxed Layered architecture

Uml p ac ka g e d ia gra m:

It is used for designing logical architecture of the system.Using this package we can group anything.Eg:classes,other packages(usecases)

Page 29: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Nesting of packages is common in UML package diagram.

Uml tool re v er se e n g i n eering pac k a g e f r o m c o d e:

First sketch a UML package diagram then organize code according to this package sketches.This process is done in earlier stage.The code base grows and we spend more time in programming and less time in modeling.

Guid e lin e s to d e si g n a la y er:

Organize the large scale logical structure of a system into discrete layers of didtinct related responsibilities,with clean and cohesive separation of higher layer and lower layer.Higher layer is called as more application specific service Lower layer is called as general service.

Collaboration and coupling is from higher to lower layer.Lower to higher layer coupling is avoided

Different types of layers:

Fig:Common layers in an information system logical architecture.

B e nefits of using l a y ers:

There is a separation of concern that means separation of higher level from lower level services.Lower level services are called as general services.Higher level services is called as more application specific services.This reduces coupling and dependency and improves cohesion.

By using layers complexity is also reduced. Some layers can be replaced with new implementation.This is generally

not possible for lower level such as technical services,foundation etc.It can be only possible for UI,applicationand domain layer.This layer architecture can be developed or maintained by team because of logical segmentation

Sep ara tion of co n c er n :

It is the responsibility of objects in the layer should be strongly related to each other and should not be mixed with the responsibilities of other layer.UI object should not be an application logic.

Rev e rse e n g i n e er i ng p ack a ge dia g r am fr om c o d e:

Page 30: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

The great use if UML case tool is to reverse engineers. The source code and generate a package diagram automatically.

2. Explain about Uml Interaction Diagram:

UML includes interaction diagram to show how two objects interact through messages

Two types of interaction diagram are

Sequence diagramIt is the important and commonly used diagram.

Communication interaction diagram

Sequence and communication interaction diagram express similar interaction. It provides a big picture overview of how asset of interaction diagram are related in terms of logical flow and process flow. The most important diagram among the now is sequence diagram.

Sequ e n c e diagr a m:

It is in the fence format. New objects are added in the right side.messages are passed in the time ordering.

Com m uni ca tion int erac tion di a g r am:

Messages are passed in number ordering.

Str e n g th a nd w ea k n ess o f s e q ue nce vs c ommunication di a g r am:

TYPES STRENGTH WEAKNESSSequence Clearly shows sequence or

time ordering messages.It has large set of deatailed notations.

Forced to extend to the right when adding new objects. Consumes horizontal spaces.

Communication Space economical is flexible to add new object in two dimension

More difficult to see sequence of messages.Only fewer notations are present.

Si n g l e ton obj ec t:

a class with only one instance is called singleton object and instance is called as singleton instance

B a sic s e q u e nc e dia g r am not a tions:

Page 31: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

L ifeline bo x es a nd lif e lin e :

the lifeline boxes including a vertical line extended below.these are the actual lifeline of the objects. The lifeline is indicated as dashed line.the lifeline boxes are used for indicating boxes and objects.

M e ss a g e s:

Each message between the objects is represented with a message expression on a filled arrowed solid line between the vertical lifelines.

Di a g ra m f r a mes in u ml sequ en c e dia gra m:

Frames are also called as interaction frame or diagram frames. It is a region or fragmentation of the diagram. Frame has label, operator and guard.

T y p e s o f fram e s:

Frame operator MeaningAlt It is alternative fragment for mutual exclusion

conditional logic expressed in guards.Loop Loop fragment while guard is true can also

write loop(n) to indicate looping n timesOpt Optional fragment that executes if guard is truePar Parallel fragment that executes if guard is true.Region Critical region within which only one thread

can run.

B a sic c ommunic a tion di a g ram not a tions :

L ink:

It is the path of communication between two objects. It indicate form of navigation and visibility between the object. It is an instance of an association.

M e ss a g e s:

Each message between object is represented with a message expression and a small arrow indicating the direction of messages.

M e ss a g e s to ” s e lf’ or “ th is ” :

A message can be send from an object to itself with messages flowing along the link.

3. Explain about the Uml Class Diagram:

Page 32: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Class di a g ram:

Class diagram is used to define classes interface and their associate.

D e si g n cl a ss di a g ram:

Class diagram has 2 perspectives

1. It can be design as a domain model.

2. It can be create as a design model.

Classifi er s:

Classifiers are a model that described the behavior and structure. It is also a specialized thing in aclass diagram.they is the generalization of many of the elements including classes, interfaces and use case.

Two types of classifiers

1. Regular classes

2. Interface.

Uml A ttribut e s :

Attributes of a classifier are shown in several ways

Attribute text notation such as currentsale:sale Association line Both together

Syntax:visibility name:type multiplicity=default{property- string}

Guid e lines f or a tt r ibut e : Attribute are assumed private if no visibility is given Attributes as association line has the following style

A navigability arrow pointing from source object to target object Multiplicity should be specified at the target end and not at the

source end Role name which is also called as attribute name is given at the

target end No association name should be specified

The UML meta data model allows multiplicity and role names at the souce end and also allows association name

As the domain model is not software perspective

Page 33: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Anoid using navigation arrow Show association name

Fig:association notation usage in different perspectives

Guid e line: w h e n to use a t tribute t e x t v er sus a sso c i a tion lin e s for a tt r ibut e s

Use attribute text notation for datatype object and association line notation for others. These two representations are semantically equal. A datatype refers to object for which unique identity is not important

Op e r a tions an d m e thods:

o p era tion:

Third compartment of uml class diagram shows the operations

Syn t a x:

visibilityname(parameter list){property-string}

Here there is no return type elemnt.with return type element,the operation syntax

Visibilityname(parameter list):return type{property-string}

Qu a lifi e d a sso c i a tion:

A qualified association has a qualifier that is used to select an object from a large set of related objects based upon the qualifier key

Asso c i a tion c l a ss:

Association class can create an association itself as a class and model it with attributes,operations and other features

Si n g l e ton cl a ss:

A class with only one instsnce is known as singleton calss

A c tive c lass:

An active object runs and controls its own thread of execution then the class of an active object is active class

4. Explain about System Sequence Diagram:

Page 34: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

SSD is a fast and easily created artifact that illustrate input and output events related to the system

S S D:

Use case describes how external actors interact with the system.During interaction an actor generates system events to a a system representing some system operation to handle the system event. Sequence diagram also says the actor interaction and the operations initiated by them

S S D sho w s one p ar tic u l a r s ce nario of us e case

Events that actors generate Their order Inter system event

W h y d r a w ssd?

We have to design the software to handle these events and execute a response.These works are done by SSD

Basically software system reacts three things

External events from actor Time events Fault or exceptions

E x ter na l e v e nts:

It affects the system events. Used for analyzing the system behavior. It explains what a system does and it does not explain what a system doing

Ap p l y i ng U ml:Sequ e nc e Di a gr a m

Interaction frame is used to show loops in sequence diagram

Rel a tionship b e t wee n ssd and us eca s e:

SSD shows the system event for one scenario of usecase.Usecase generates the system the system events

How to na me s y st e m e v e n ts a nd op era tions:

Scanitem(item ID) enteritem(item Id)

From this which one is better?

Page 35: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

System event should be expressed at the abstract level of abstraction and not in terms of physical input devices. Hence enteritem(item Id) is better than scanitem(item Id) because it captures the intent of the operation.scanitem(itemId) explains about what interface is used to capture the system event.

How to mod e l ssd involving oth e r e x te r n a l s y st e m :

SSD is used to illustrate collaboration between system such as collaboration between pos and external credit payment

W h a t ssd inf o rm a tion to be pl ace d in the g lossa r y :

The elements shown in SSD are terse it may be operation name,parameters and written data. We need glossary because we needproper explanation so that during software design design what it is coming in and what is going out Eg:change dues,reciept

5. Explain about the Basic Sequence Diagram And Notations:

Sequ e n c e diagr a m:

It is in the fence format. New objects are added in the right side. Messages are passed in the time ordering.

B a sic s e q u e nc e dia g r am not a tions:

L ifeline bo x es a nd lif e lin e :

The lifeline boxes including a vertical line extended below.These are the actual lifeline of the objects.The lifeline is indicated as dashed line.The lifeline boxes are used for indicating boxes and objects.

M e ss a g e s:

Each message between the objects is represented with a message expression on a filled arrowed solid line between the vertical lifelines. Starting message is called as the found message which is shown with the opening solid ball and sender will not be specified and it is not shown where the message is coming from.

F o cu s of c o ntr o l a nd e xe cution s pec i f i ca tion:

Execution specification shows the focus of control.It is automatic in a UML case tools.

I llustr a ti n g rep l y o r re tur n :

Page 36: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Two ways to show the return result from a messages

1. Using the message syntax return var=message(parameter).

2. Using a reply(or return)messages line at the end of an activation bar.

Obj e c t lif e line a nd d e str u ction:

<<destroy>>sterotype message with a large x and it also explains the short lifeline of a object.

Di a g ra m f r a mes in u ml sequ en c e dia gra m:

Frames are also calle d as interaction frame or diagram frames. It is a region or fragmentation of the diagram.frame has label,operator and guard.

Types of frames:

Frame operator MeaningAlt It is alternative fragment for mutual exclusion

conditional logic expressed in guards.Loop Loop fragment while guard is true can also

write loop(n) to indicate looping n timesOpt Optional fragment that executes if guard is truePar Parallel fragment that executes if guard is true.Region Critical region within which only one thread

can run.

Conditional m e ss a ge s:

Opt frame is placed around one or more message The guard is placed over the object lifeline.it is the one-conditional message. To show a single conditional message with an opt frame box is not necessary and second diagram is very simple and is probably popular for years.

Mutu a l l y e x clusive c ond i tional m e ss a g e s:

For this we are using alt frame.For mutually exclusion conditional messages we use the alt frame and it is placed around where the conditional arises.

Iteration over a collection:

A c tion B o x:

Action box may contanin arbitrary statements that is incrementary or decrementary

Page 37: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

selector expression line item[i] in lifeline is used to select one object from the group.

Guidelines:

Any sequence diagram can be surrounded with an sd frame to name it.it is referenced by using the ref frame by another sequence diagram.

6. LOGICAL ARCHITECTURE REFINEMENT:

I ntr o d u ction:

Logical architecture and the layers pattern was introduced. There are other types in these packages, only a few are shown to indicate noteworthy aspects. The foundation layer was not shown in this view, the architect decided it did not ass interesting nformation,event though the development team will certainly be adding some information classes, such as more advanced string manipulation utilities. For now, a separate application layer is not used. The responsibilities of control or session objects in the application are handled by the register object. The architect will add an application layer in a later iteration as the behavior grows in complexity and alternative client interface are introduced

I nte r L a y e r A nd I n t er P a c ka g e Coupling :

Applying UML

Observe that dependency lines can be used to communicate coupling between packages or types in a packages.Plain dependency lines are excellent when the communication does not care to be more specific on the exact dependency but just wants to highlight general dependencies

Note also the use of a dependency line emitting from a package rather than a particular type such as from the sales package to posrule engine fascade class and the domain package to the log4J package.This is useful when either the specific dependent type is not interesting or the communication wants to suggest that many elements of the package may share that dependencyFig

I nte r L a y e r A nd I n t er P a c ka g e S c en ar ios :

Package diagram show static information. In spirit architectural view which hides uninteresting details and emphasizes what the architect wants to convey an interaction

Page 38: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

diagram in the logical view of the architecture focuses on the collaborations as they cross layer and package boundaries, A set of interaction diagrams that illustrate architecturally significant scenario

Collabo ra tions w ith l a y e r s p a tt er n:

Two design decisions at an architecture level are

What are the big parts? How are they connected?

Si m ple Pa cka g e s Ver sus S u b s y s t ems:

Some packages or layers are not just conceptual group of things that are true subsystems with behavior and interface. The pricing package is not a subsystem; it simply groups the factory and strategies used in pricing. Likewise with foundation packages such as java.util On the other hand, the persistence POSR ule Engine and Jess packages are subsystems. They are discrete engines with cohesive responsibilities that do work

Fa ca de :

For packages that represent subsystems, the most common pattern of access is facade, a GOF design pattern. The façade should not normally expose many lowlevel operations. Rather it is desirable for the façade to expose a small number of high level operations, the coarse grained services when a faced does expose many low level operations it tends to became in cohesive.

Rel a x ed L a y er e d Coupl i n g :

The layers in the most layered architecture are not coupled in the same limited sense as a netwrk protocol based on the OSI layer model.Int he protocol model,there is strict restriction that elements of layer N only access the services of the immediate lower layer N-1

Com m e nts on t y pical c o upling b e t w een l a y ers

All higher layers have dependencies on the technical service and foundation layer It is primarily the domain layer that has dependency on the Business InfrastructurE

LAYER The presentation layer makes calls on the application layer,which makes service calls on

the domain

Page 39: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

T er minolo g y : T i e rs, L a y er s A nd P a rtitions

The original notion of a tier in architecture was a logical layer, not a physical node but the word has become widely used to mean a physical processing node such as the “client tiers”.

I nf o rm a tion S y st e ms: T he Classic Th re e Ti e r Arc h it e c ture

A classic description of the vertical tiers in a three tier architecture is

Interface-windows, reports and so on Application logic-tasks and rules that govern the process Storage-persistent storage mechanism.

UNIT-IV

1)Explain Creator Pattern with an example.

Creator

The creation of objects is one of the most common activities in an object-oriented system. Consequently, it is useful to have a general principle for assignment of creation responsibilities. Assigned well, the design can support low coupling increased clarity, encapsulation, and reusability.

Problem: Who should be responsible for creating a new instance of some class ?

Solution:

Assign class B the responsibility to create an instance of class A if one or more of the following is true :

B aggregates A objects .

B contains A objects.

B records instances of A objects.

B closely uses A objects.

B has the initializing data that will be passed to A when it is created

B is a creator of A objects.

Example: NextGen POS Example

Problem :Who should create a SalesLineItem

Page 40: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Solution: Since a Sate contains (in fact, aggregates) many SalesLineltem objects, the Creator pattern suggests that Sale is a good candidate to have the responsibility of creating SalesLineltem instances.

Discussion of Creator pattern Responsibilities for object creation are common

Connect an object to its creator when:

Aggregator aggregates Part

Container contains Content

Recorder records

Initializing data passed in during creation Creator benefits

Low coupling is supported, which implies lower maintenance dependencies and higher opportunities for reuse.

Coupling is properly not increased because the created class is likely already visible to the creator class due to the existing associations that motivated its choice as creator.

Related Patterns

Low coupling Concrete Factory & Abstract Factory

2) Explain ‘Information Expert’ with an example.

Information Expert

Page 41: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

By Information expert we should look for the class of objects that has the information needed to determine the total.

Problem: What is a general principle of assigning responsibilities to objects?

Solution: Assign a responsibility to the information expert – a class that has the information necessary to fulfill the responsibility.Example:

Problem Who should be responsible for knowing the total price for a sale?

Solution : Let Sale do it because it knows all of its SaleLineItems. For example, to get the sale total ,Sale gets subtotals from SaleLineItem which get prices from ProductDescription

We see that Sale already has the SalesLineItem objects needed to calculate the total

But to get the price of a SalesLineItem, we also need the ProductDescription's price attribute. SalesLineItem has the needed information

Page 42: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

(

:

To fulfill the responsibility to know its subtotal, the SalesLineItem needs to collaborate with ProductDescription

Expert benefits

Information encapsulation is maintained since obj. use their own info to fulfill tasks. This usually supports low coupling, which leads to more robust and maintainable systems.

Page 43: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

(Behavior is distributed across the classes that have the required info, thus encouraging more

cohesive “lightweight” class definitions that are easier to understand and maintain.

Related Patterns

Low coupling High cohesion

3)Explain ‘Low Coupling’ with an example.

Low CouplingCoupling is a measure of how strongly one element is connected to, has knowledge of, or relies on other element. If there is coupling or dependency, then when the depended-upon element changes, the dependent may be affected.

Problem: How to support a low dependency,low change impact ,and increased reuse?

Solution:

Assign a responsibility so that coupling remains low.

Evaluate design alternativesChoose option that minimizes coupling “Simple chain of command”

Example:NextGen POS Example

Problem: Who should create a Payment and associate it with a Sale?

Solution :

By Expert, let Register create Payment info, then associate it with the Sale Register & Sale now coupled to Payment

By Low Coupling, Register delegates Payment creation to Sale Only Sale coupled to Payment

Design:1

On the one hand, we might give Register the responsibility to create the

Payment:

Page 44: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Design :2

On the other hand, we might give Sale the responsibility to create the Payment:

Which is better? It is unavoidable that Sale is coupled to Payment. But the first design creates an unnecessary coupling of Sale to Register. All else being equal, we prefer the second.

Low Coupling benefits

Not affected by changes in other components Simple to understand in isolationConvenient to reuse Classes are

More independent Easier to reuse Easier to understand Easier to maintain

Related Patterns

Page 45: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

(Protected Variation

4) Define pattern ‘Controller’Controller is the first obj. (class) beyond the UI layer that is responsible for receiving or handling a system operation message.

Problem The UI & domain layers should be loosely coupled. What is the 1st object should receive and coordinate messages (system operation) between the UI layer and other domain objects?

Solution :

Assign responsibility to an object representing one of these choice:

The overall ‘system’ or a ‘root’ object (Store, Bank) A device that the SW is running within (BankATM) A major subsystem (AccountingSystem)A major use case scenario (GameHandler)‘Single channel of communication between layers’

Example:NextGen POS Example

Problem :Which object in the domain layer should be responsible for the system operations?

Solution:

Select the ‘root’ object in the POS domain model (Store) Select an object that represents a key device (Register) Create an object that handles the use case (SaleHandler)

Example: for the enterItem operation, we have a situation like this:

Page 46: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Some possible design alternatives:

Combining with the other system operations, we can see the consequences of each design alternative:

Page 47: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Some tips about controllers:

The controller should be seen as a facade into the domain layer.Use the same controller for all system events involved in a use case.Controllers will often be stateful, maintaining information about the current progress of the use

case.For purposes of cohesion, controllers should primarily delegate, (forward responsibility to other

objects) wherever possible.In Java EE, controllers will oftentimes be stateful session Enterprise Java Beans.The controller may delegate directly to domain layer objects, or if it is in a separate application

logic layer, it may make requests to other controllers in the pure domain layer.Some controller antipatterns:

A single controller with \too many" system events. No delegation.Duplication of information found elsewhere in the domain layer.M

Don't allow direct manipulation of domain objects in the UI layer!

Example (good design):

Page 48: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Example (bad design):

Page 49: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Controller benefits

Increased potential for reuse and pluggable interfaces Opportunity to reason about the state of the UC

Related Patterns

Command: In a msg handling sys., each msg may be represented and handled by a spate Command obj

FaçadeLayers (POSA pattern) placing domain logic in the domain layer. Pure Fabrication

5) Define pattern ‘High Cohesion’

Page 50: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Cohesion measures how functionality related the operations of a software elements are, and also measures how much work a software element is doing.

Problem : How to keep objects focused, understandable, manageable, maintainable and a side effect?. How to support low coupling?

Solution :

Assign responsibilities so that cohesion remains high and object’s responsibilities are closely related

Evaluate alternatives to optimize cohesion ‘Don’t spread yourself too thin’‘Teamwork’

Example:

For the POS system, when we design for the makePayment() system operation:

We already saw that this creates an unnecessary coupling between Register

and Payment. But it also reduces the cohesion of Register.

By delegating Payment creation to Sale, we not only decrease coupling,

but we also increase the cohesion of Register.

Page 51: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Since Register has fewer responsibilities, it is more cohesive.

High Cohesion benefits

Clarity and ease of comprehension of the design is increased Maintenance and enhancements are simplifiedLow coupling is often supportedReuse of fine-grained, highly related functionality is increased because a cohesive class can be

used for a very specific purpose.

Page 52: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

U N IT- V

1. Explain UML state diagrams with an example?

Sta t e m a c hine diag r a ms: A UML statechart diagram illustrates the interesting events and states of an object, and the

behavior of an object in reaction to an event. Transitions are shown as arrows, labeled with their event. States are shown in rounded rectanglesEle me nts of state m a c h i n e diagr a m s

EventsAn event is a significant or noteworthy occurrence. An event causes a transition from one state toanother state

Example: A telephone receiver is taken off the hook Transition

A transition is a relationship between two states that indicates that when an event occurs, the object moves from the prior state to the subsequent state.Example: When the event "off hook" occurs, transition the telephone from the "idle" to "active" state.

StateA state is the condition of an object at a moment in time—the time between events.

Example: A telephone is in the state of being "idle" after the receiver is placed on the hook and until it is taken off the hook.

Exa m ple

State machine diagram for telephone

Page 53: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

2. Explain Operation contracts with an example?

Ope r a t ion Con tr a ct s: Operation Contracts gives the more detailed or precise description of system behavior.

Operation Contracts use pre- and post- conditions to describe detailed changes to objects in the domain model, as a result of the system operation.

Se ct ions of a c o nt r a c t

Operation Name of operation, and parameters

Cross Ref UCs that this Op occurs within

Preconditions Noteworthy assumption about the state of

the system or objects in the DM before

executing the operation

Postconditions The most important section. The state of

objects in the DM after the completion of

the operation.

Po s t c o n d iti o n s

Describe changes in the state of objects in the Domain ModelInclude instances created, associations formed or broken, and attributes changed Postconditions are not actions to performRather, they are declarations about Domain Model objects that are true

when the operation has finishedExpress postconditions in the past tense, to emphasize they are declarations about a state change

in the past.

Exa m pl e

Here's an operation contract for the enterItem system operation..

Page 54: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

Contract CO2 enterItem

Operation enterItem(itemID: ItemID, quantity: integer)

Cross References Use Cases: Process Sale

Preconditions There is a sale underway.

Post conditions A SalesLineItem instance sli was created (instance creation).

-sli was associated with the current Sale (association formed).

-sli.quantity became quantity (attribute modification).

-sli was associated with a ProductDescription, based on itemID match

(association formed).

The categorizations such as "(instance creation)" are a learning aid, not properly part of the contract.

3. Explain Mapping design to code with an Example?

Implementation Model- The ultimate deliverables such as Source code, DB definitions, HTML pages etc.

In Design -> code is more than mechanical code generation Especially with agile modeling because many details skipped intentionally Developers may have good ideas that improve design

Implementation in OO language requires writing source code for: Definitions of classes & interfaces: get these from design class diagram. There are many

tools can generate them.Definitions of methods

Work from OOA/D artifacts Create class definitions for Domain Class Diagrams (DCDs)

DCD’s depicto Class or interface name o Super classeso Operation Signature o Attributes of classThese things are enough for creating a basic class definition in OO

Page 55: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

language Create methods from Interaction diagrams

o The sequence of messages in an interaction diagram translates to series of statements in method definitions

Collection classes in code Collection classes are implemented with the collection object such as List or map

or array. Exception handling

In UML, exceptions can be inserted as property strings of messages Order of implementation

Start implementing the classes from least-coupled to most-coupled

4. Explain guidelines for how to create and write contracts?

Appl y t h e fo l l o wi n g a d v i c e t o c re a t e c ontract s :

1. Identify system operations from the SSDs.

For system operations that are complex and perhaps subtle in their results, or which are not clear in the use case, construct a contract.

2. To describe the postconditions, use the following categories:

instance creation and deletion attribute modificationassociations formed and broken

W ri t i n g C on tr a cts

1. Write the postconditions in a declarative, passive past tense form (was …) to emphasize the observation of a change rather than a design of how it is going to be achieved.

For example:

(better) A SalesLineItem was created.

(worse) Create a SalesLineItem.

2. Remember to establish an association between existing objects and with those newly created.

For example, it is not enough that a new SalesLineItem instance is created when the enterItem operation occurs. After the operation is complete, it should also be true that the newly created instance was associated with Sale.Thus :the SalesLineItem was associated with the Sale (association formed).

5. Explain UML deployment diagrams and component diagrams

Deployment diagramA deployment diagram shows the assignment of concrete software artifacts (such as executable

files) to computational nodes (something with processing services). It shows the deployment of software

Page 56: vidhyasaraswathi.weebly.comvidhyasaraswathi.weebly.com/uploads/5/7/4/0/57409133/…  · Web viewDefine UML. Unified modeling language is a visual language used for specifying, constructing

elements to the physical architecture and the communication (usually on a network) between physical elements

Elements in deployment diagram

The basic element in the deployment diagram is node. There are two types of nodes

1. Device Node2. Execution Environment node

1. Device Node:

Device node (or device) is a physical (e.g., digital electronic) computing resource with processing and memory services to execute software, such as a typical computer or a mobile phone.

2. Execution Environment node

Execution environment node (EEN) is a software computing resource that runs within an outer node (such as a computer) and which itself provides a service to host and execute other executable software elements.

Example:

Component Diagram

an operating system (OS) an operating system (OS) is software that hosts and executes programsa virtual machine (VM, such as the Java or .NET VM) hosts and executes programsa database engine (such as PostgreSQL) receives SQL program requests and executes them, and hosts/executes internal stored procedures (written in Java or a proprietary language)

The Component Diagram helps to model the physical aspect of an Object-Oriented software system. It illustrates the architectures of the software components and the dependencies between them

Component

A component represents a modular part of a system that encapsulates its contents and whose manifestation is replaceable within its environment. A component defines its behavior in terms of provided and required interfaces. As such, a component serves as a type, whose conformance is defined by these provided and required interfaces