This title covers Object Oriented (O-O) concepts, tools, development life cycle, problem solving, modeling, analysis, and design, while utilizing UML for O-O. Covers O-O concepts, tools, development life cycle, problem solving, modeling, analysis, and design, while utilizing UML (Unified Modeling Language) for O-O. A Student Guide to Object-Oriented Development is an introductory text information systems courses, as well as business studies courses.

Object Oriented System Development Ebook

Language:English, Dutch, Arabic
Genre:Children & Youth
Published (Last):01.12.2015
ePub File Size:16.74 MB
PDF File Size:14.12 MB
Distribution:Free* [*Registration needed]
Uploaded by: ERLINDA

Editorial Reviews. From the Back Cover. Object-Oriented Design with Applications has long tyoususnappsave.ga: Object-Oriented Analysis and Design with Applications (3rd Edition) eBook: Grady Booch: As a systems architect, Mike employs object-oriented analysis nad design techniques in complex systems development. Object-Oriented Design with Applications has long been the essential reference to Lee más de 1 millón de eBooks en cualquier dispositivo site o en la aplicación data acquisition, cryptoanalysis, control systems, and Web development. perform that step in the system development life cycle (SDLC) process. through UML , the new standard for object-oriented analysts and.

This updated edition includes the new features of UML 2.

Bibliographic Information

Table of Contents Introduction. Hour 1: Introducing the UML. Adding a Method to the Madness. Components of the UML. Some Other Features.

New Diagrams in UML 2. Why So Many Diagrams? Hour 2: Understanding Object-Orientation. Objects, Objects Everywhere. Some Object-Oriented Concepts. The Payoff. Hour 3: Working with Object-Orientation. Visualizing a Class. Attributes, Operations, and Visualization. Responsibilities and Constraints.

Attached Notes. Hour 4: Working with Relationships. Qualified Associations. Reflexive Associations. Inheritance and Generalization. Class Diagrams and Object Diagrams. Composite Structure Diagram. Interfaces and Realizations. Interfaces and Ports. Hour 6: Introducing Use Cases. Use Cases: What They Are. An Example: The Soda Machine. Including a Use Case. Extending a Use Case. Starting a Use Case Analysis. Hour 7: Working with Use Case Diagrams. Representing a Use Case Model. Visualizing Relationships Among Use Cases.

Use Case Diagrams in the Analysis Process. Taking Stock of Where We Are. The Big Picture. Hour 8: Working with State Diagrams. What Is a State Diagram? History States. New in UML 2.

Object-Oriented System Development

Why Are State Diagrams Important? Building the Big Picture. Hour 9: Working with Sequence Diagrams. What Is a Sequence Diagram? Cars and Car Keys. The Soda Machine. Creating an Object in the Sequence. Hour Working with Communication Diagrams. What Is a Communication Diagram? Creating an Object. One More Point About Numbering. A Few More Concepts. Hour Working with Activity Diagrams. Applying Activity Diagrams. Hybrid Diagrams. New Concepts from UML 2. An Overview of an Interaction.

Hour Working with Component Diagrams. Components and Interfaces. What Is a Component Diagram? Applying Component Diagrams. Component Diagrams in the Big Picture. Hour Working with Deployment Diagrams.

What Is a Deployment Diagram? Applying Deployment Diagrams. Deployment Diagrams in the Big Picture. Hour Understanding Packages and Foundations. Package Diagrams. A Hierarchy. Extending the UML. Methodologies: Old and New. Identifying use cases from scenarios. Another approach to identifying use cases is to start with the scenarios. We have already mentioned scenarios in Chapter 2 - a scenario describes a series of interactions between the user and the system in order to achieve a specified goal.

Depending on the stage they have reached, system developers can use scenarios to describe what did actually happen or might typically have happened on one occasion or how they want things to happen in the new system. A careful study of scenarios depicting both typical and exceptional uses of the system is a very good way to understand what the system does and how it is used. You start by looking at the details of how the system is used and from this work out what the overall aims and objectives are and from this what the use cases are.

Each use case represents a group of scenarios. Scenarios belonging to the same use case have a common g o a l - each scenario in the group describes a different sequence of events involved in achieving or failing to achieve the use case goal. Figures 3. Use cases are not essentially object- oriented; they are a useful tool whatever method of developing software is being used. Use case modelling formalizes and documents a long-standing practice.

Jacobson was responsible for raising the profile of the use case to the extent that it is now almost universally adopted by the object-oriented community, is formally included in the UML notation and is part of almost all object-oriented methods of developing software.

It would be an inefficient use of time for a developer to write scenarios for every possible sequence of events in a use case. A software tester writes test cases to test an intelligent selection of cases; he tests to agreed coverage criteria.

In much the same way a developer should write a representative set of scenarios. The scenarios should document: The developer needs to be sure he understands and documents how the system should respond in every eventuality. He will probably write detailed scenarios to document large or complicated use cases, but small, simple use cases can be adequately described by use case descriptions see below.

The user may see it as a task that he uses the system to achieve, one of the jobs that make up his daily workload, or it may produce a list or a report that he gets from the computer. A use case is a complete end-to-end use of the computer, a complete path through the system. A use case must deliver some benefit to the actor associated with i t - it must have a goal.

Each use case will have several scenarios associated with it. Some will be successful, i. The software developer needs to be aware of all possible scenarios because the system must be able to cope with them all and respond appropriately.

Instead, scenarios can be produced to illustrate what happens typically and interesting exceptions. A use case description is used to describe the use case in general terms and document the main variations from the norm.

Use case descriptions The use case description is a narrative document that describes, in general terms, the required functionality of the use case. Typically it describes the use case goal and gives a general description of what usually happens, the normal course of events, adding a brief description of any minor variations.

In other words the description is generic, it should be written in such a way that it encompasses every sequence of events, every scenario, relating to the use case. The description is written in terms of what the system should do, not how it should do it. What happens behind the scenes in terms of coding, data storage structures and other implementation details is not relevant in a use case description, only what the user sees happening.

In other words, the use case describes the system as the user sees it and does not aim to form the basis of a program specification or provide information about the internal processes of the system. UML does not dictate any particular format for describing use zyxw cases. Different practitioners use different methods. The best advice is that we have a look at different techniques described by experts on the subject and choose something that works for us.

The standard we will use in this book, which closely follows the style recommended by Larman , is illustrated in Figures and 3. High-level description. It is useful to have two distinct types of use case description. In the early stages of software development, when no detailed decisions have been made about the design of the Figure 3. Subsequently it is useful to have more detailed structured descriptions known as expanded use case descriptions see Figure 3.

Name of the use case as it appears in the use case diagram Actors: List of actors associated w i t h the use case Goal: The goal or purpose of the use case Overview" Copy of the high-level description Cross-reference: Relate this use case to the system requirement it covers T y p i c a l c o u r s e of e v e n t s zyx Describes the most usual course of events in terms of the actor i n p u t and the system response Alternative courses This section describes the main alternative courses of action Figure 3.

This description is more detailed and structured than the high-level use case description. It should document: Some practitioners include a section for preconditions in the e x p a n d e d use case descriptions. We might specify, for example, that the bike list needs to be up to date before the use case 'Issue bike' is performed, i. The e x p a n d e d use case description would then be presented as in Figure 3.

Normally an actor is a user, but sometimes it is another system such as a banking or accounting system; an actor can also represent a hardware device such as a printer.

Typically an actor is someone who inputs information to the system or receives information from it or both. It is often referred to as the role someone plays in the use case. The actors in the use case diagram in Figure 3. The Receptionist issues the bike, the Administrator maintains the bike list and the customer list.

Neither Administrator nor Receptionist are job titles within Wheels because we are not representing any particular person, rather we are representing anyone who is authorized to use the system to do a particular job. Each actor can represent several different people and several different job titles. For example, the Administrator can be Naresh, the head mechanic, or Annie, the shop manager, or even Mike the owner.

Conversely, each person or job title can play several different roles. The Receptionist role will normally be played by Annie. However, on her day off, any of the mechanics or Mike can use the computer system as the Receptionist, i. Another way of thinking of it is that the users can be wearing different hats when they use the system; Naresh can use the system wearing the hat of an Administrator or a Receptionist.

Actors are identified during the requirements elicitation stage by asking such questions as: An actor description briefly describes the actor in terms of role and job title. The Receptionist can be the shop manager Annie , any of the mechanics or the owner Mike. The Administrator can be the head mechanic Naresh , the shop manager Annie or the owner Mike.

Use case relationships" communication association, include and extend Communication association. Communication associations tell us w h i c h actors are associated w i t h w h i c h use cases. Each actor may be associated w i t h m a n y use cases and each use case may be associated w i t h m a n y actors.

This is a similar idea to the p r o g r a m m i n g t e c h n i q u e of using procedures or subroutines to code cohesive bits of functionality that may be used in more t h a n one place in a program.

It is i m p o r t a n t to i d e n t i f y functionality c o m m o n to several use cases because it permits the developers to avoid wasting effort; a c h u n k of functionality can be identified, investigated and modelled once, t h e n reused as required. Figure shows a refined version of the original Wheels use case diagram see Figure 3. The use cases 'Maintain bike list', 'Handle enquiries', 'Issue bike' and 'Handle bike return' all need to find a particular bike from the list of bikes.

This tells us that each of these use cases will always use the 'Find bike' use case. Wheels system Notice that the dashed arrow points from the main use case to the one to be included, e. It usually documents functionality that the user can opt to use over and above the norm. Minor variations can be covered in the extended use case description. In Figure 3. W h a t this means is that sometimes returning a bike might involve printing a receipt, although this is not what normally happens.

Printing a receipt will only be necessary if the customer has kept the bike for more days than they originally paid for, or if the bike is returned damaged. Notice that now the dashed arrow points from the new extending use case to the main use case, i. Notice that the minor use case is always modelled as an extension of the major one, i.

The user sometimes has to select one of several options at a particular point in the use case; in such cases it may be useful to model each option as a separate extending use case. The 'alternative courses' section of the extended use case description see Figure 3.

downloading Options

W h i c h method you choose is a matter of judgement. We have drawn a separate diagram Figure 3. It is easy to get carried away with enthusiasm w h e n identifying legitimate uses for these relationships, but the resulting model is not always an improvement.

This is done using the k e y w o r d 'initiate'. For example, if the use case 'Issue bike' were to be modelled as specified in Figures 3.

Boundary In general the concept of the system b o u n d a r y is important as it delineates the domain of study. The system b o u n d a r y may be included on a use case diagram see Figures 3. The drawing of a b o u n d a r y on a use case diagram, however, adds very little to the meaning of the diagram as use cases are always inside the b o u n d a r y and the actors outside it.

The reason we have included the boundaries on our diagrams is simply that it comes as part of the CASE tool we used to draw the diagrams, i. Together TM. It is common practice, however, to omit the b o u n d a r y and other CASE tools, for example Rational Rose TM, do not draw a b o u n d a r y on use case diagrams.

The use case model gives the user coherent and detailed documentation of what the system does or will do. However, in addition to this, it also provides direct support for other parts of the software development process. Checking the system using the use case model.

The use case model provides an excellent basis for system testing. As each use case models a significant task, the use cases provide ready made testing units. The developer can take each use case in turn and check that the system does what it is meant to, i. The scenarios provide instances of the normal sequence of events in the use case and the main alternatives; exactly what is required for testing purposes.

The developer must check that the system can handle each scenario. Checking the design of the system can be done by walking through each use case to verify that it can be realized. When the system has been implemented, system tests can be derived from the use cases to check that the code produces the required functionality.

Estimating using use cases. Project managers find use cases useful for planning and estimating the development process. Once the system has been broken down into a set of use cases and the nature of each use case understood, the project manager will have a good idea of how long each will take to develop, how much risk is attached to each and how vital each is to the success of the project.

This helps the project manager to produce an informed project plan; the system can be developed use case by use case. If the project manager knows that the system is not going to be produced as quickly as the customer would like, he can make sure that the most vital use cases are tackled first. Basis for interaction diagrams.

Use cases are closely related to interaction diagrams, i. A use case provides a description of a particular task; the corresponding interaction diagram shows how that use case will work in terms of messaging between objects see Chapter 6.

Use case descriptions 55 and scenarios can provide the starting point for the identification of classes for the class diagram. One of the standard ways of finding classes is to examine the nouns in a clear and concise description of what the system does see Chapter 5.

One of the best places to find such a description is in the collection of use case descriptions provided by the use case model. Technical points The points discussed in this section may be ignored by readers who simply want a basic understanding of use case modelling.

However, for those who want to probe a little deeper, this section will provide a more complete understanding of the topic. Documenting extension points in a use case diagram.

For example see Figure 3. Extension points can be d o c u m e n t e d on the use case diagram as in Figure 3. Receptio details] Figure 3. Both use cases and actors can be specialized, i. In object-oriented development inheritance is primarily associated with class diagrams see section on inheritance in Chapter 4. If an inheritance relationship exists between two entities it means that one inherits the characteristics of the other.

For example, in a classification of animals, a horse is a specialization of animal and a cart-horse is a specialization of horse. Each specialization both inherits characteristics from its parent in the hierarchy and adds features to reflect its own specialization.

The parent has those features common to all of its descendants, those features they have in g e n e r a l - hence generalization.

Where use cases are concerned, the use of generalization is another way of specifying alternative courses of events. We could, for example, have modelled the situation shown in Figure 3.

If the Receptionist is issuing a bike to a completely new customer then she uses the specialized use case 'Issue bike to new customer'. This use case always executes the use case 'Maintain customer list'. However, if she is issuing a bike to an existing customer she uses the generalized use case 'Issue bike'. If she finds, in the course of executing this use case, that the customer has changed their address she can opt to execute the 'Maintain customer list' use case.

Actors can also be specialized if we wish to indicate that the specialized actor plays the same role as the generalized one but has some extra role. Initiating actor and participating actor. It is worth understanding the differences between types of actors without getting too bogged down in the details.

In any given use case, the initiating actor is the [Changecustomerdetails]'! The most important actor is the one k n o w n as the beneficiary, i. There is some controversy about who should be modelled as the actors associated w i t h a use case. Some practitioners like to show on a use case diagram everyone who is associated w i t h a use case. Some show only the initiating actor, some show only the beneficiary. In the Wheels case study we have not modelled Customer as an actor although it is often the customer who initiates a use case.

We could have modelled the system as in Figure 3. The choice of actors is to a large extent dictated by where we choose to draw the system boundary. If we are producing a high- level model of a whole business system with, for example, the purpose of making the business or c o m p a n y more efficient, the actors will be people outside the company, in the environment.

In the case of the Wheels system this would be the Customer and possibly also the Supplier. From this point of view the employees of the company are viewed as resources inside the system b o u n d a r y and are not modelled as actors.

If, on the other hand, we are talking about the automation b o u n d a r y of a computer system that is part of the overall business system, the actors will be the people who Wheels system zyxwv ecopt o zyxwvutsrqp ustomer Figure3.

The modelling we describe in this book is aimed at the design of computer systems and the boundaries we draw are automation boundaries; our actors are therefore the people who use the system.

In the Wheels system this would be the Receptionist and the Administrator. The important thing to remember is that what we really want to know about, at the stage where we are designing the use case model, are the use cases themselves. In the early stages of software development the identification of actors is done principally as a means of finding out about the use cases. Later on, when considering security aspects and when designing the user interface, we might like to think some more about the actors involved so that we can specify user privileges and design interfaces that are appropriate for each user.

The actors we show in this book are the ones who physically use the system, e.

This is zyx because, when we move on to doing the interaction diagrams, these actors are the only ones providing input directly to the system and reading the o u t p u t from the screen.

Our preferred use case model for the Wheels system, therefore, is that shown in Figures 3. Essential a n d real use cases. It is worth understanding the difference between essential and real use cases again without getting lost in the jargon. An essential use case is one that is completely free of implementation or detailed design decisions.

A use case will be in essential form in the early stages of software development before these decisions have been made. It is important to keep use cases free of implementation detail in the early stages so as not to constrain subsequent design decisions. Real use cases, by contrast, do show detail of design and implementation decisions insofar as they affect the user.

A real use case will show, for example, detail about the user interface. The use case descriptions in Figures 3.

The use case description in Figure 3. We have already come across several uses of stereotypes without identifying them as such.

Knowing about stereotypes is not essential to successful modelling, but it is useful to know what they are because you may come across them in your reading.

CASE tools, for example, often use the term. This means that they are relationships used in a highly specific way. This is not strictly necessary as the relationship between an actor and a use case can only be a communication association. Strictly speaking the actor icon is a stereotyped class. Instead of using the stick figure to model an actor such as the Receptionist, we could equally well use the UML class icon and label it as an actor stereotype see Figure 3.

Subsystems and packages. If we are modelling large systems we very soon get to the stage, w h e n drawing the use case diagram, where we can no longer fit all of our use cases on one screen. UML has a grouping notation k n o w n as a package to cope with this. Packages are simply a convenient notation for managing our models, they do not represent anything in the system, but are used to group elements that do represent things in the system. We can use packages to group any set of modelling elements: We can use packages simply as a way of managing models that get too big by grouping elements in convenient bundles, or we can use packages to represent specific logical units, e.

For example, a mail ordering system might be split into three subsystems: We would then place all the model elements relating to customer order processing into a customer order processing package, those to do with accounting in an accounting package, those to do with stock control into a stock control package see Figure 3.

Packages are discussed in more detail in Chapter 5. The development of a use case from the its initial identification during requirements elicitation to its implementation is k n o w n as use case realization. In other words, use case realization for a single use case requires a complete iteration t h r o u g h all of the development activities.

RUP see Chapter x is essentially use case driven which means that the software is developed incrementally by use case realization. During use case realization, once all the use cases have been identified and documented, each use case is analysed separately to identify the classes required by it. The group of classes involved in a particular use case is k n o w n as a collaboration. The classes in a particular collaboration are often grouped into a package.

The unified class diagram for the whole system is compiled from an analysis of the complete set of collaborations. Sometimes the same class will appear in more than one collaboration. In this book we are not going to adopt a use case realization approach to developing the Wheels system simply because the Wheels system is too small to warrant it. Common problems 1 Can more than one actor be associated with a use case? It is quite common for more than one actor to be associated with a use case in the sense that more than one actor can perform that particular task.

For example, in Figure 3. For example, in the Wheels system could we model the customer as an actor and then have both Customer and Receptionist involved in the use cases 'Issue bike', 'Handle enquiries' and 'Handle bike return'. The answer is that it is really a question of style see the discussion in the section on initiating and participating actors. In this book our boundaries represent the automation boundary, i.

The actors, therefore, are the people who use the system directly, i. Our models, therefore, do not show the Customer as an actor. If we made Wheels a more sophisticated system, where the Customer could make enquiries and hire a bike online, then Customer would also be modelled as an actor. The first and principal rule that dictates the size of a use case, i. A use case should represent a complete process; one end-to-end pass t h r o u g h the system, a job that the user sits down at the computer to achieve at one go.

Don't confuse steps or stages in a process with the whole use case. For example, we have modelled 'Customer pays amount due deposit plus rental charge ' as part of the use case 'Issue bike'. This is because we found that making a p a y m e n t was never an event that was done in isolation: Customers frequently phone up requiring information about the types of bike available and about the deposit and rental charges.

For this reason we have modelled it as a separate use case. From a practical point of view, the developer should beware of making use cases too small. Each use case spawns a large n u m b e r of other models. Each use case will potentially have associated with it a use case description, a n u m b e r of scenarios and several interaction diagrams.

If each use case models only a small amount of functionality we need more of them to model the whole system and the n u m b e r of models spawned increases exponentially. One common error, on discovery of the technique, is to use it over enthusiastically. However, the behaviour specified in 'Calculate total charges' would only ever be used by the 'Issue bike' use case; it is therefore unnecessary to model it as a separate use case.

The use case model consists of a use case diagram, supported by textual descriptions, use case and actor descriptions, and scenarios. Actors identified in the use case diagram represent users who interact with the system in some way, who use the system to achieve a particular task. Each use case represents a task or major chunk of functionality.

The use case description describes the task in more detail. There are several different ways of describing alternative paths through a use case. All routes through the use c a s e - what normally happens, minor variations and significant a l t e r n a t i v e s - can be illustrated in detail using scenarios. Minor variations can be documented as alternative courses in the use case description. Alternatively, a specialized use case can be used to model different behaviour within a use case. The use case model is a useful starting point for identifying classes and forms the basis of the interaction diagrams.

It is also useful as a guide for project management, for checking zyx requirements and for system testing. Bibliography Bennett, S. Brown, D. Fowler, M. Larman, C. Stevens, R, with Pooley, R.

Quick check questions zyxw You can find the answers to these in the chapter. Can you name them? W h a t w o u l d be a sensible set of scenarios for a developer to write?

Exercises 3. For each scenario w o r k out its use case and actor, t h e n draw the use case diagram for the whole library system.

A 9 A library m e m b e r chooses three books and takes t h e m to the librarian on the loans desk zyxwv 9 The librarian checks h o w m a n y books the m e m b e r has out on loan 9 The m e m b e r has no books already out on loan 9 The librarian registers the loans on the system and issues the books to the member.

C 9 A library m e m b e r chooses four books and takes t h e m to the librarian on the loans desk 9 The librarian checks how m a n y books the member has out on loan 9 The m e m b e r has six books already out on loan 9 The librarian will not allow the member to borrow any more books until she brings some back. D 9 A library m e m b e r brings back three books to the library 9 She takes then to the returns desk 9 The librarian registers the returns on the system.

E 9 A library m e m b e r looks up the online catalogue for a book She finds the title she wants 9 She checks the title availability and finds that there is a copy in the library 9 She notes d o w n the library reference n u m b e r for the book.

F 9 A library m e m b e r looks up the online catalogue for a book She finds the title she wants 9 She checks the title availability and finds that all copies are out on loan 9 She makes an online reservation for the book.

G 9 New books arrive in the library 9 The librarian allocates to each a library reference n u m b e r 9 She updates the online library catalogue w i t h the new titles. To confirm this read their associated scenarios described in Question 1 e and f.

B 9 Ed rings Cool Cuts for an a p p o i n t m e n t for a hair cut 9 Jasmine, the part-time receptionist, asks him who normally cuts his hair 9 Ed says he hasn't been before 9 Jasmine asks w h e n he w o u l d like to come 9 Ed says Thursday afternoon 9 Jasmine says Antonia has a free slot at 5. C 9 Jo rings Cool Cuts for an a p p o i n t m e n t to have highlights p u t in plus a cut and blow d r y 9 Michael, the manager, asks her w h o normally does her highlights 9 Jo says she w o u l d like Diana do her highlights and Michael to cut her hair 9 Michael says he can't find a time w h e n both are free until three weeks on M o n d a y at lO.

E 9 After her cut and blow dry Annie comes to the reception desk to pay 9 Jasmine, the part-time receptionist, says that will be s 9 The customer pays the amount due 9 Jasmine registers the a m o u n t paid on the system F 9 Jenni accepts a new delivery of hairdressing products shampoo etc. When customers come to the till to pay for their haircut, they sometimes also download hairdressing products shampoo, conditioner etc.

The junior on the till enters the product code and the system looks up the price of the product. The use case 'Handle customer payments' see Figure E. The use case 'Maintain product list' always involves doing this. The diagram in Figure E. However, these off-the-street customers want to pay for the products as a separate transaction. How would you alter the diagram in Figure E. Sometimes patients phone to cancel appointments or to change them. Mr Major keeps notes on the system about his patients' t r e a t m e n t s - these are updated each time he sees a patient.

The receptionist also makes out bills for patients and records payments on the system. Write scenarios for this use case, recording sequences of events that might occur when: A patient phones up for an appointment on a specific date. The Receptionist tells her what times are availa- ble on that date and she picks one. She picks one. He wants to make another appointment.

Validated Designs for Object-oriented Systems

The Receptionist offers him a list of possible slots. None are suitable so he doesn't make an appointment. How would you amend the diagram in Figure E. Each machine will be able to give passengers up-to-date train timetable and ticket price information.

The machines must also issue tickets and transfer statistics about ticket sales to a central computer system. Railway staff must be able to update ticket prices and timetable information.

Draw a use case diagram to model what the ticket machines must do. They use a computer system to deal with taking customer orders, assembling the order and then paying for it. Customers find a table and a waiter takes their order.

The waiter goes to the nearest till and keys in the order using a touch screen with icons on it showing possible food combinations. The table number is used to identify the order. In the kitchens a cook reads the order on his screen, assembles the meal on a tray, and prints a chit with the table number on it plus the details of the order. The tray is put in the food lift and the cook presses a key to indicate that the order is ready.

A large screen in the restaurant displays a list of orders that are ready, identified by table number. The waiter collects the tray from the food lift and takes it to the customer.

He also removes the order from the large order screen. W h e n customers have finished their meal the waiter keys the table number into the system and the bill is printed. Draw a use case diagram of this system. They have been asked by a video rental company, View Us, to convert their rather antiquated computer system to something more modern. James has just spent a morning rather nervously observing what goes on at View Us as customers and employees go about their normal business.

James jotted down the sequence of events that he observed, hoping to make sense of it later. Your first job is to separate the list of events into scenarios. Having done that, work out what the use cases will be. Finally, draw a use case diagram to model what happens at the video rental business, View Us. Ten days after his original visit he returns to View Us, this time accom- panied by Caitlin. While James discusses his model with Kim, Caitlin notices a customer complaining to Phil that all of the copies of the video he wants to borrow are out on loan.

Phil says that he can reserve that video for the customer. On further enquiry she finds that reserving videos is quite common.

What happens is that a video is marked on the system as reserved, then as soon as any copy of that video is returned it is put under the counter and a postcard sent to the member who reserved it.

W h e n the reserving member comes in he presents the postcard and is issued with the video in the normal way. Kim and Phil also remember that another thing they use the system for is to respond to customer enquiries about what videos they stock. Usually customers know the title of the video they want to borrow but sometimes these enquiries take the form of questions like 'Have you got a video of that film with Leonardo DiCaprio and Kate Winslet in it?

Caitlin comes up with the revised diagram shown in FigureE. She and James study the diagram and decide that there is probably some duplicated functionality in the use cases. To test this theory they need use case descriptions for the use cases 'Find video details', 'Loan a video' and 'Reserve video'.

Write high-level use case descriptions for these use cases. As they suspected, there is some duplication. Redraw the use case diagram shown in Figure E. Write expanded use case descriptions for these two use cases. Scenarios 1 and 2 and 7 see answer to Question 3.

There are significant differences b e t w e e n these sequences. W r i t e an e x p a n d e d use case description that identifies a typical sequence of events and incorporates the differences as alternative courses. We introduce the object as the fundamental building block of object-oriented software, i. We briefly summarize why the object-oriented community base their software decomposition on the object rather than on traditional top-down functional decomposition.

We explain the concept of a class and the relationship between objects and classes. Finally, we examine the different relationships that may exist between objects and explain what they mean in the context of the developing system.

Why a new development method was needed zyxw Problems with the structured approach to software development This section looks at the way in which systems were developed before object-orientation, and at some of the problems that resulted from using the traditional approach.

Functional decomposition. For many years, software systems were developed using a structured approach based on functional decomposition. This meant that developers decomposed and then constructed the system according to the main areas of a c t i v i t y - in other words, the subsystems that were identified corresponded directly to tasks that the system had to carry out. For example, in a bike hire system, such as the one used in this book, the system would probably be based on subsystems or processes dealing with issuing a bike, returning a bike, maintaining records for bikes and for customers etc.

Each of these processes would perform a separate function, and the data about bikes, transactions and customers would be passed freely between them. In functional decomposition, there was a clear separation between data and process, and data items could frequently be accessed by any part of the program. Figure 4. This is a potential source of problems, because the bike details are accessible to other parts of the system with no protection from processes that may access and modify them in error.

Structured software designed using functional decomposition brought with it big maintenance problems. Software developers became aware that if the data in the system was accessible to all parts of the code, it could be accidentally corrupted and this was what was causing the ripple effect. Software developers realized that to prevent this, data needed to be encapsulated protected from unauthorized access.

Poor modularity. However a system is decomposed, it is very important that each separate component or module is self- contained, with a well-defined purpose, and as independent as possible from other modules.

Unfortunately, decomposing a system using functional decomposition did not lead to modules with these characteristics.

A module in a system based on functional decomposition often was not internally cohesive and was heavily dependent on other modules in the program. With functional decomposition, making changes to code, either to correct software bugs or implement changes in the user requirements, was a very slow process. In order to understand enough of the code to make the change, preferably without causing side effects, the maintaining programmer had to read a great deal of the code.

This was because of poor modularity, the code modules were not independent enough, they were not autonomous. The maintaining programmer could not understand them in isolation, he had to read many peripheral modules to make sense of the one he was changing. This implied that there were hidden dependencies between the modules. What was needed were cohesive internally coherent modules that could function either independently or via well-defined interfaces to other modules. Software systems based on functional decomposition were still being delivered with errors in the code; they were perceived as unreliable and not sufficiently well tested.

It was thought that this might be partly because it was difficult to test units in isolation and manage rigorous integrated testing. This was again partly because units of code were too interdependent. Software reuse. Reuse of software had never taken off as it was expected to do. One of the principal reasons for this was that a suitable software construct didn't exist. A module that is heavily dependent on other software modules cannot easily be put in a software l i b r a r y - all the bits it depends on have to be in the library also.

To be reused, modules need to be independent. Useful library modules must also have a clear single purpose that is general enough to be useful in more than one system. Data versus function. The structured approach built systems based on their f u n c t i o n a l i t y - what the system had to do, the tasks that it had to carry out. The problem with this was that typically the functionality of a system is much more volatile and subject to change than its data.

Extensive studies have shown that the most common changes in user requirements are to the functionality of the system. Let us consider, for example, a system for allocating patients and staff to wards in a hospital.

We can imagine that over time the ways in which patients are assigned to beds in a ward and the way that the nurses' rota is worked out may change. In addition, it is likely that the system will be required to produce more and different reports for its users. Whatever these changes may be, however, the system will still be dealing with patients, beds, nurses and wards - in other words, the data remains the same. The data is much more stable than the functionality, and is a much sounder basis on which to build a system.

In functional decomposition the software architecture the way the system was divided up was based on its functionality, and over time the whole structure of the system eventually became unstable. The data in the system, however, remained relatively unchanged over the life-time of a system; it eventually became obvious to the software development community that a system based on data would be more robust.

Advantages of object-orienteddevelopment In order to address the problems associated with functional decomposition, developers needed a software construct that was: In addition to these characteristics, the software construct should also have: This type of unit would be easier to test thoroughly both in The object-oriented community proposed the object as a software construct which had the characteristics listed above.

It would more likely be reusable and could be included in a software library. Objects, although they provide functionality, are based on the data in the system. This provides a structure that is less subject to change. Well-designed objects are independent and autonomous, making them easy to test in isolation before being integrated into the system. A good object is cohesive, i. Use case decomposition and object-oriented decomposition Although objects are based on the data in the system, this does not mean that object-oriented software ignores the required functionality.

The objects we define must be capable of delivering that functionality. The use case model provides one decomposition of the system, based on the required functionality. However, the software structure of an object-oriented system is based on the object. In other words when we come to build the software and divide it up into separate parts we don't split it up according to use cases but by objects and groups of objects.

Another advantage of the object-oriented approach is that it provides a seamless development process. The objects we identify as part of the analysis stage persist through the development stages to the code.

This thread of continuity means the software objects have a certain p r e d i c t a b i l i t y - we have expectations, for example, of what an object representing a customer will look like and what it will do.

In well-designed object-oriented code our expectations will not be disappointed. This makes the code easier to understand and therefore easier to maintain. In the traditional structured approach to development some of the models that were used to capture user requirements such as the data flow diagram were abandoned at the design stage where a new modelling technique was used to specify the structure of the code for example, structure charts.

This made it hard to ensure that all of the user requirements were incorporated in the final implementation: In the object-oriented approach we identify objects which represent things in the problem domain and about which we need to store information. Later in the development process we add objects to provide the software structure we want to implement for example, control and boundary objects and objects that are to do with how the software will work buttons, windows, mouse- listeners etc.

However, the original objects, although they may gather some extra features in the development process, will still be identifiable in the code. What is an object? The object is the most important concept in object-oriented software development; object-oriented systems are based on the object. At its simplest, an object is a representation of something in the application area about which we need to store data to enable the system to do what the users want it to.

In the Wheels system, for zyxwv example, we will undoubtedly want to store data about bikes. Bikes, therefore, would be objects in our model of the Wheels system and eventually in the code. The bits of data we need to store about these bikes, such as the type, the daily hire rate and the deposit, are known as the attributes of the bike object. In the UML an object is represented as shown in Figure 4.

In the case of Figure 4. Object names are always underlined and can have two parts, either of which can be used on its own. The first part of the name, aBike, labels the object; the second part,: Biker identifies it as an object of the Bike class. There are a number of ways in which we can refer to an object: Bike' - all of these names mean the same thing in this context.

Every object belongs to a class which is a template or factory for producing objects. Classes are discussed in detail later in this chapter. Object diagrams can be drawn with attributes and their values displayed as in Figure 4.

In Figure 4. However, there is more to an object than its ability to record data. For the sake of completeness we are now going to give a more detailed definition of an object and discuss what is meant by the terms used in the definition.

Some of this discussion will involve concepts that we have not yet met, so don't worry if you do not understand it all at the moment; you might find it useful to return to this section once you have read about classes. An object is a concept, abstraction, or thing with clear boundaries and meaning in the current application area. We use objects both to model the real world characteristics of the application area and to provide us with a basis for the computer implementation.

An object is always an abstraction see Chapter 1 because although we want it to represent a real world thing, we are only interested in certain aspects of the real world thing. For example, a library member object will store information of interest in a library system: We are only including properties of the real world thing that have meaning for the problem at hand. Every object in a system has three characteristics: During design and implementation see Chapters 9 and I o we will meet objects that do not represent things in the real world, but artefacts we need for structural and implementation purposes.

So far the concept of an object will seem quite familiar to anyone used to entities in entity-relationship modelling see Howe, 2ool. However, unlike entities, objects don't just store information, they have behaviour. Historically, the reason that objects have behaviour is they were originally used in computer simulations. An aeroplane in a computer simulation stores information: It can also do certain things: Objects in an information system are not usually simulations in the same way our system won't have bikes whizzing round the screen but they do know certain things and they can do certain things.

A bike object knows stores its type, daily hire rate and deposit. W h e n we design the bike object we decide what it is able to do. We will also need to be able to work out the total cost of a hire for a given n u m b e r of days. In object-oriented development, processes that act on related data items are b u n d l e d together with the data. In fact, an object is little more than a bundle of data items and processes that manipulate them. These processes are called operations.

An object's behaviour is divided into operations, each of which represents something the object can do e. An object's behaviour is triggered in response to a message sent from another object asking it to perform one of its operations. We discuss messages later in this chapter. Most objects have attributes; e. These attributes have values, e. Normally attribute values can change - the dailyHireRate might go up or we might change the amount we ask customers to leave as a deposit.

The state of an object is determined by the values of its attributes and its links to other objects. We can tell, for example, if a bank account object is in the overdrawn state by looking at the value of the attribute balance.

The reason we are interested in the state of an object is that its behaviour may vary depending on what state it is in. An obvious example of this is the type of bank account where the account holder is not allowed to overdraw. In this case, how the account responds when a request is made to withdraw money depends on how much money is in the account. If there is enough money in the account, the withdrawal is allowed.

If not, the withdrawal is not allowed. State and its effect on object behaviour are discussed fully in Chapter 7. When we say that an object has identity, we mean that zy zyx 83 each object is unique, it has a separate existence and ultimately a separate space in the computer memory from every other object. Each bike in the Wheels system will be represented by a separate object in the code.

Even two objects whose attributes have identical values are totally distinct from one another.Sequence and collaboration interaction diagrams, showing how all the objects involved behave during a single use case. The tools offered by RUP allow a large part of the development process to be automated, including modelling, programming, testing, managing the project zy 11 and managing change.

The second part focuses on the activities of requirements gathering and systems analysis, as well as the basic notation of UML. If we are modelling large systems we very soon get to the stage, w h e n drawing the use case diagram, where we can no longer fit all of our use cases on one screen. OK, so just to get back to the actual hire procedures. This sort of information would be useful for marketing purposes and to simplify dealing with requests for the same bike see the Problem Definition Figure 2.