CIS224 Software Projects: Software Engineering and Research Methods

Slides:



Advertisements
Similar presentations
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Advertisements

1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 4 Class Models (Based on Fowler (2004, Chapters 3 & 5) and Stevens and Pooley.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Use Case - Example University library system requirements
Object-Oriented Analysis and Design
Introduction To System Analysis and Design
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Lecture 4 Class Responsibility Collaboration Cards
Software Engineering Lecture 9 Object-Oriented Design II.
Object-Orientated Design Unit 3: Objects and Classes Jin Sa.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
CS 501: Software Engineering Fall 2000 Lecture 12 Object-Oriented Design II.
UFCEPM-15-M Object-oriented Design and Programming Jin Sa.
Introductory case study. 2 The problem The most difficult part of any design project is understanding the task you are attempting You have been contacted.
Software Engineering Case Study Slide 1 Introductory case study.
Use Case Diagram : Library System
Object-Oriented Analysis and Design
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
CIS224 Software Projects: Software Engineering and Research Methods
1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 5a CRC Cards & Sequence Diagrams (Based on Stevens and Pooley (2006, Section.
Use Cases Why use ‘em? How do they work? UC diagrams Using them later in the software development cycle.
Why Analysis Process Refer to earlier chapters Models what the system will do makes it easier for understanding no environment considered (hence, system.
CS2110: SW Development Methods Design of methods (functions) Class design – CRC cards – UML class and sequence diagrams Software Design.
High-Level Design With Sequence Diagrams COMP314 (based on original slides by Mark Hall)
1 Object orientation. 2 What benefits does OO give? Primarily –Encapsulation (Associates data & operations) –Types & specialisation –Software re-use.
Introduction To System Analysis and Design
Object-Oriented Analysis and Design An Introduction.
Key Takeaway Points A use case is a business process; it begins with an actor, ends with the actor, and accomplishes a business task for the actor. Use.
Copyright 2002 Prentice-Hall, Inc. Chapter 2 Object-Oriented Analysis and Design Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey.
University of Southern California Center for Systems and Software Engineering Model-Based Software Engineering Supannika Koolmanojwong Spring 2013.
Lecture 3 Uses Cases Topics UML Use Cases pop quiz Readings: Chapter 3 January 24, 2008 CSCE 492 Software Engineering.
Systems Analysis and Design in a Changing World, 3rd Edition
Object-Oriented Analysis and Design Fall 2009.
Requirements as Usecases Capturing the REQUIREMENT ANALYSIS DESIGN IMPLEMENTATION TEST.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Chapter 1 Applying UML and Patterns. The Need for Software Blueprints Knowing an object-oriented language and having access to a library is necessary.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Object Oriented Design Jerry KotubaSYST Object Oriented Methodologies1.
UML as a Specification Language for Embedded Systems. By, Mir Ahmed Ali, Asst. Professor, ECM department, SNIST. By, Prof. Narsiah sir, Director of School.
2/6/03C-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Requirements and Use Cases.
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Lecture 14 22/10/15. The Object-Oriented Analysis and Design  Process of progressively developing representation of a system component (or object) through.
Object-Oriented Analysis and Design Use cases Finding classes Collaboration and Sequence diagrams Associations between classes.
CSCI 383 Object-Oriented Programming & Design Lecture 7 Martin van Bommel.
Object Oriented Analysis & Design By Rashid Mahmood.
WELCOME TO OUR PRESENTATION UNIFIED MODELING LANGUAGE (UML)
Chapter 4 – System Modeling Lecture 1 1Chapter 5 System modeling.
1 M206 Chapter 31: An Overview of Software Development 1.Defining the problem 2.Analyzing the requirement – constructing initial structural model 3.Analyzing.
Chapter 5 – System Modeling Lecture 1 1Chapter 5 System modeling.
Engineering Quality Software Week02 J.N.Kotuba1 SYST Engineering Quality Software.
Chapter 5 – System Modeling
Elaboration popo.
Chapter 5 System modeling
Chapter 5 – System Modeling
Unified Modeling Language
Start at 17th March 2012 end at 31th March 2012
System Modeling Chapter 4
Copyright 2007 Oxford Consulting, Ltd
CIS224 Software Projects: Software Engineering and Research Methods
Engineering Quality Software
Applying Use Cases (Chapters 25,26)
Applying Use Cases (Chapters 25,26)
Chapter 4 System Modeling.
Lecture 8 Object Concepts
CS 501: Software Engineering
Presentation transcript:

CIS224 Software Projects: Software Engineering and Research Methods Lecture 2b Introducing the Unified Modeling Language (UML) (Based on Fowler (2004, Chapter 1) and Stevens and Pooley (2006, Preface & Chapter 3)) David Meredith d.meredith@gold.ac.uk www.titanmusic.com/teaching/cis224-2007-8.html CIS224 Software Projects: Software Engineering and Research Methods

What is UML and why should we bother with it? UML is a graphical notation system for designing and describing component-based and object-oriented software graphical modeling languages for software development have been around for a long time textual programming languages not abstract enough for discussing high-level design diagrams good at communicating design without lots of detail not a replacement for a textual programming language UML is an open standard controlled by the Object Management Group (OMG) www.uml.org OMG set up to build standards to support interoperability of object-oriented systems This course will focus on the current standard which is UML 2.0 Familiarity with UML has become a core skill for software engineers

Modes of using UML Sketch mode Blueprint mode most common forward engineering: make UML diagram then write code reverse engineering: derive UML diagram from code focus on important features and leave out detail Blueprint mode emphasis on completeness forward engineering: build detailed design for programmers to implement like architect designing a building which is built by construction company Programming language mode draw UML diagrams that are automatically compiled into executable code Model Driven Architecture (MDA) (Kleppe et al., 2003) standard approach to using UML as a programming language Three stages PIM - platform-independent model (in UML) PSM - platform-specific model (e.g., different for .NET or Java, probably also in UML) executable code Executable UML (Mellor and Balcer, 2002) Model compiler compiles UML directly into executable code without passing through PSM stage Uses a subset of full UML is it more productive than using a textual programming language?

Using UML from two perspectives Software perspective Using UML to model software systems Direct mapping from UML elements to software elements Two levels of abstraction (but not clear-cut demarcation between them) Interface Specification how an object behaves (i.e., what it does) how we interact with an object Implementation how an object achieves its behaviour (i.e., how exactly it does what it does) Conceptual perspective Using UML to represent concepts in some non-software domain (e.g., business processes)

We will be using UML… …from a software perspective …at the interface level of abstraction …in sketch and blueprint mode

Views on a design When we want to express a design, we do not try to express all aspects of it at once Build different models to describe different aspects Express models as diagrams in a modelling language like UML

Three basic types of model Use case model describes system from the point of view of the users Static structural model describes elements of the system and the relationships between them Dynamic behavioural model describes behaviour of the system over time

UML 2.0 diagrams 13 official diagram types in UML 2.0 Box represents a diagram type Open-headed arrow indicates generalization Will only cover a small fraction of the complete UML in this course, concentrating on the more commonly used diagram types

Legal UML normative UML conforms to the standard specification conventional UML may not conform to standard (i.e., may be non-normative) but commonly used in practice UML rules are treated as descriptive, not prescriptive but must have well-defined meaning, even if not strictly legal UML otherwise the diagrams cannot be interpreted reliably

Suppression in UML Anything may be suppressed in a UML diagram Therefore cannot assume that something is not in the system simply because it is not in the diagram! Unless it conflicts with what is in the diagram

Using non-UML diagrams Don’t need to use UML all the time! Sometimes non-UML diagrams are useful Screen flow diagrams Flow charts Decision tables Class-Responsibility-Collaboration (CRC) cards

Using UML in requirements analysis Use case diagram to describe how people interact with the system Class diagram for building up vocabulary of domain Activity diagram to describe how humans interact with software in the organisation State diagram for describing complex life cycle of a concept Have to communicate with users and customers who may not be experts in software engineering Keep notation to a minimum Avoid implementational details Domain experts (users) must understand your diagrams

Using UML in design Class diagrams from a software perspective Sequence diagrams and CRC cards for common scenarios Package diagrams for large-scale structure of software State diagrams for classes with complex life-cycles Deployment diagrams to show physical layout of software

Using UML in documentation Use UML diagrams in sketch mode to highlight and illustrate interesting features Remember: “Comprehensiveness is the enemy of comprehensibility”

Using UML to study other people’s code Use UML in sketch mode to make graphical notes about the structure and behaviour of a piece of software or code that you are studying

Introductory case study: Initial problem statement “You have been contracted to develop a computer system for a university library. The library currently uses a 1960s program, written in an obsolete language, for some simple bookkeeping tasks, and a card index for user browsing. You are asked to build an interactive system which handles both of these aspects online.” (Stevens and Pooley, 2006, p. 27)

Clarifying the requirements Initial problem statement is vague Need a more detailed analysis before agreeing to tackle the problem Requirements engineering is difficult because Different users have different priorities Users are not good at imagining or expressing what an ideal system would be like Managers who talk to developers might not be users and so might not have experience of doing the jobs that the system is supposed to help with

Requirements in more detail Books and journals Library contains books and journals May have several copies of a given book Some books are for short-term loan Other books can be borrowed by any library member for 3 weeks Only members of staff may borrow journals Ordinary library members may borrow up to 6 items at a time Members of staff may borrow up to 12 items at a time New books and journals are added to the library and old ones are sometimes disposed of Current year’s journals are sent away to be bound into hardback volumes at the end of each year

Requirements in more detail Borrowing System must keep track of when books and journals are borrowed and returned System should produce reminders when a book is overdue In the future, users may need to be able to extend a loan if the item is not reserved

Requirements in more detail Browsing Users should be able to search for a book on a particular topic, by a particular author, etc. in order to Check if a copy of the book is available Reserve a copy if it is not Anyone can browse in the library

Users and tasks High quality system must meet its users’ needs Need to identify users of a system Need to identify tasks each user must carry out with the system Need to prioritise tasks in order of importance So that we can plan development

Actors and use cases In UML Actor Use case User is modelled by an actor Task is modelled by a use case Actor User of a system in a particular role e.g., library member as book borrower External system which interacts with our system E.g., bar-code reading machine Use case Task that actor needs to perform with the help of our system E.g., borrow a copy of a book May involve a complex process E.g. Checking that the library member has not borrowed the maximum number of books Checking that the book can be borrowed May include two or more scenarios, each with a different type of outcome User allowed to borrow book User refused permission to borrow book Name use case after what happens in “normal” or main success scenario E.g., “Borrow copy of book”

Documenting a use case Document each use case in third person, active voice, e.g. “Borrow copy of book A BookBorrower presents a book. The system checks that the potential borrower is a member of the library, and does not already have the maximum permitted number of books on loan. This maximum is 6 unless the member is a staff member, in which case it is 12. If both checks succeed, the system records that this library member has this copy of the book on loan. Otherwise, the system refuses the loan.” In use case description, say what system must achieve, not exactly how it should achieve it E.g., don’t say exactly how system stores information about a loan

Use case diagram Avoid adding use cases that the customer or users haven’t told you to include!

Using use cases to determine goals of iterations Decide what most important use cases are and provide these in early iterations For example in library case study, most important use cases might be Borrow copy of book Return copy of book Borrow journal Return journal So aim to provide these at end of first iteration

Limited use case analysis for first iteration Books and Journals: The library contains books and journals. It may have several copies of a given book. Some of the books are for short term loans only. All other books may be borrowed by any library member for three weeks. Members of the library can normally borrow up to six items at a time, but members of staff may borrow up to 12 items at one time. Only staff members may borrow journals. Borrowing: The system must keep track of when books and journals are borrowed and returned, enforcing the rules described above.

Identifying classes Classes correspond to key domain abstractions Domain is application area that we’re working in (e.g., the library) Abstraction represents only relevant important properties of a domain concept or thing Can use noun identification technique to help with identifying appropriate classes

Noun identification technique Take a clear concise statement of requirements or use case descriptions Underline all nouns and noun phrases This gives us candidate classes Remove inappropriate classes to get initial class list for the system

Example of noun identification technique Books and Journals: The library contains books and journals. It may have several copies of a given book. Some of the books are for short term loans only. All other books may be borrowed by any library member for three weeks. Members of the library can normally borrow up to six items at a time, but members of staff may borrow up to 12 items at one time. Only members of staff may borrow journals. Borrowing: The system must keep track of when books and journals are borrowed and returned, enforcing the rules described above. Initial class list: Book, Journal, Copy, LibraryMember, (Item?), StaffMember

Objects representing actors There isn’t always an object in a system representing each actor (e.g., StaffMember or LibraryMember objects) Can make objects representing actors responsible for carrying out actions on behalf of those actors E.g., send message borrow(theCopy) to LibraryMember object representing Jo Bloggs when Jo borrows a copy of a book In library system, need to know how many books each member has on loan, so makes sense to have a LibraryMember object for each member

Associations between classes Having identified initial class list, then identify important real-world relationships or associations between the classes Clarifies understanding of domain Reveals coupling in the system OK for closely-related domain objects to be associated since expect one class to depend on the other Examples of real-world associations in the library system a copy is a copy of a book a library member borrows or returns a copy a member of staff borrows or returns a copy a member of staff borrows or returns a journal

Class model for the library system

Class model for library system (improved version)

Dynamic behavioral models Class model describes static structure of system Also need to describe dynamic behaviour of system How classes work together to provide the behaviour required by the use cases Interaction diagrams show how messages pass between objects to realize a use case

Library member borrows a book Human library member (BookBorrower actor) comes to issue desk with physical copy of book (represented by theCopy: Copy). Library member (represented by theLibraryMember : LibraryMember) and copy of book identified borrow(theCopy) message sent to theLibraryMember. theLibraryMember checks that the library member is permitted to borrow the book (might send an okToBorrow() message to itself). If theLibraryMember can borrow the copy of the book, then a beBorrowed(theLibraryMember) message is sent to theCopy which updates itself with the information that it has been borrowed by theLibraryMember. It may also be necessary for the theCopy to send a copyBorrowed(theCopy) message to an object, theBook: Book, which represents the book of which theCopy is a copy.

Sequence diagram of “Borrow copy of book” use case

State machine diagram of Book

Going further Having worked out sequence diagram and state machine diagram, can go back to class model and add attributes and operations to some of the classes Once identified how all use cases are realized, down to level of which messages are passed, can then implement the classes and complete the first iteration

Summary UML is a graphical notation system for designing and describing component-based and object-oriented software can be used in sketch mode, blueprint mode or programming language mode can be used from a software perspective or a conceptual perspective three basic types of model use case models static structural models dynamic behavioural models UML standard is descriptive not prescriptive but must be comprehensible with well-defined meaning almost anything can be suppressed in a UML diagram UML can be used in requirements analysis, design, documentation and for studying legacy code considered a simple case study which involved designing a library system Requirements analysis using UML use case diagrams Using the use case analysis to determine goals of iterations Identifying classes using noun identification technique Using class model to represent classes and associations between them Using a sequence diagram to represent the dynamic behaviour of the system when it realizes a use case Using a state machine diagram to represent how the state of a class changes when it receives messages