Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington UML for design: Class Diagrams.

Slides:



Advertisements
Similar presentations
MiniDraw Testing COMP 102 # T1
Advertisements

Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Creating and using Objects.
Computer Science 111 Fundamentals of Programming I Introduction to Object-Based Programming.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington UML for design: Class Diagrams.
10 Software Engineering Foundations of Computer Science ã Cengage Learning.
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Use Case Diagram © copyright 2001 SNU OOPSLA Lab..
Introduction To System Analysis and Design
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
Lecture 11: Chapter 22 Topics –Object Oriented Modeling –UML –Use case.
Documenting Requirements using Use Case Diagrams
1 Basic Object Oriented Concepts Overview l What is Object-Orientation about? l What is an Object? l What is a Class? l Constructing Objects from Classes.
1 Lecture 2: Elaboration Tasks and Domain Modeling.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
IEG 3080 Tutorial 1 Wilson Ip. Outline Lecture reviews: Some basics of Software Engineering principle Some basics of OOP How to use Visual Studio.NET.
Copyright W. Howden1 Lecture 2: Elaboration Tasks and Domain Modeling.
Copyright W. Howden1 Lecture 4: Elaboration Tasks and Domain Modeling.
Use Case Analysis – continued
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 More on use cases System sequence.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Object Oriented Design. Goal  Introduction to UML: u what are classes and instances? u Basic project analysis  Introduction to Prototyping/AgentSheets.
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.
Chapter 9 Domain Models 1CS6359 Fall 2012 John Cole.
Software Engineering Case Study Slide 1 Introductory case study.
Chapter 9 Domain Models. Domain Model in UML Class Diagram Notation A “visual dictionary”
Introduction To System Analysis and design
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Object Oriented Software Development
M1G Introduction to Programming 2 1. Designing a program.
Lesson 7 Guide for Software Design Description (SDD)
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
Computer Science Victoria University of Wellington Copyright: david streader, Victoria University of Wellington Simple Design COMP
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1-1 Welcome to: CSC225 Introduction to Computer Organization.
OHTO -99 SOFTWARE ENGINEERING LECTURE 5 Today: - An overview to OO Analysis and OO Design - Introduction of Assignment 2.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 21.
Introduction To System Analysis and Design
Art 315 Lecture 6 Dr. J. Parker. Variables Variables are one of a few key concepts in programming that must be understood. Many engineering/cs students.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
1 Systems Analysis and Design in a Changing World, Thursday, January 18, 2007.
Systems Analysis and Design 8 th Edition Chapter 6 Object Modeling.
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Domain Classes – Part 1.  Analyze Requirements as per Use Case Model  Domain Model (Conceptual Class Diagram)  Interaction (Sequence) Diagrams  System.
Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
DBMS ER model-2 Week 6-7.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences.
Object Oriented Analysis & Design By Rashid Mahmood.
Requirements capture: Using UML Use Cases David Millard and Yvonne Howard {dem,
Computer Science Victoria University of Wellington Copyright: david streader, Victoria University of Wellington Simple Design COMP
DOMAIN CLASSES – PART 1 BTS430 Systems Analysis and Design using UML.
Chapter 5 – System Modeling Lecture 1 1Chapter 5 System modeling.
UML for design: Class Diagrams ENGR 110 #
Chapter 9 Domain Models.
Object-Orientated Design: Part 2
Object-Oriented Analysis and Design
UML for design: Class Diagrams ENGR 110 #
Unified Modeling Language
Object Oriented Programming
OO Domain Modeling With UML Class Diagrams and CRC Cards
OO Domain Modeling With UML Class Diagrams and CRC Cards
SYS466 Domain Classes – Part 1.
Copyright 2007 Oxford Consulting, Ltd
Handout-2(a) Basic Object Oriented Concepts
Presentation transcript:

Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington UML for design: Class Diagrams ENGR 110 #

© Peter Andreae ENGR : 2 Design Requirements analysis treats the system as a black box. Design has to open it up and say what’s inside, and how it will work. COMP 102/112 didn’t talk much about design! we gave you the design of the programs – you just had to turn the design into code why? What does the design of a software system look like? How the system is broken down into components What the components do. COMP102 programs: classes, methods

© Peter Andreae ENGR : 3 Modularity Central problem in most engineering tasks: Complexity Key technique to handle it: Modularity Break the task up into chunks chunks should be as independent as possible solve/design/build each chunk separately assemble them together Used in all branches of engineering

© Peter Andreae ENGR : 4 OO Design and Class Diagrams Key principle in Object Oriented design for software systems: Primary Modularity = objects and classes Given a task, need to identify  the different objects and classes that will make up the system  what is in the objects and what they do  how they are related and how they interact

© Peter Andreae ENGR : 5 OO Design and Class Diagrams UML provides a language for this design step: object diagrams class diagrams  most common and most important UML diagram First step: Domain analysis Working out what are the kinds of things in the domain and what we know about them. Object Diagrams: Start by identifying objects Give them names Work out what types they are Work out what we need to know about them.

© Peter Andreae ENGR : 6 The Frog game The FrogGame class is a simple game that lets a player try to hop their frogs to the other side of a three-lane road without being hit by the cars driving along the road. Frogs start just below the road and have to hop to the far side (past lane 4). Cars drive along the road at different speeds and with different sized gaps. The player has only one frog at a time, and can make it hop forward or back (one lane at a time). If the player gets a frog to the far side of the road, they gain 10 points, the frog hops off into the field, and the player gets another frog. When a frog is hit by a car, it dies, and the player gets a new frog if they have any lives left. The game keeps track of how many lives the player has left (initially 5) and the current score. The game ends when the player has run out of lives.

© Peter Andreae ENGR : 7 Object Diagram for FrogGame What are the objects in the world: frog: Frog car1: Car car2: Car car3: Car lane1: Lane lane3: Lane lane2: Lane name, type,

© Peter Andreae ENGR : 8 Object Diagram: attributes What are their attributes? frog: Frog lane: nearSide status: alive car1: Car lane: 3 direction: east position: 350 car2: Car lane: 2 direction: west position: 230 car3: Car lane: 1 direction: east position: 511 lane2: Lane lane3: Lane lane1: Lane name, type, attributes and types nearSide: Lane farSide: Lane

© Peter Andreae ENGR : 9 Object Diagram for FrogGame What are the associations between objects: frog: Frog status: alive car1: Car direction: east position: 350 car2: Car direction: west position: 230 car3: Car direction: east position: 511 lane2: Lane lane3: Lane lane1: Lane nearSide: Lane lane farSide: Lane

© Peter Andreae ENGR : 10 Object diagrams What is the ontology of Object diagrams? Objects: entities in the world – frogs, buildings, books, people events – enrolment, return, transaction intangible entities – courses, companies, images roles – client, manager, member, surgeon entities that can do stuff – searcher, sorter, components – windows, buttons …. Attributes of objects information/values describing the objects (other than other objects) Associations (relationships) between objects

© Peter Andreae ENGR : 11 Object Diagram What happens when the problem gets bigger? Gets very messy!!! frog1: Frog lane: 0 status: alive car6: Car lane: 3 direction: east position: 30 car1: Car lane: 3 direction: east position: 350 car3: Car lane: 1 direction: east position: 511 lane1: Lane lane3: Lane lane2: Lane car2: Car lane: 2 direction: west position: 230 car5: Car lane:1 direction: east position: 260 car7: Car lane: 3 direction: east position: 300 car8: Car lane: 2 direction: west position: 430 car9: Car lane: 1 direction: east position: 20 frog2: Frog lane: 3 status: dead frog3: Frog lane: 2 status: dead car10: Car lane: 2 direction: west position: 120 car4: Car lane: 2 direction: west position: 280

© Peter Andreae ENGR : 12 Class diagrams More useful for real design Abstract from individual objects to classes of objects. What is the ontology of Class diagrams? Classes: categories of objects all of the same type, with the same behaviour Attributes of the objects in the classes Associations (relationships) between objects in the classes Actions/behaviour of objects in the classes lane Frog status: boolean

© Peter Andreae ENGR : 13 Class Diagrams Describe the categories of the objects, rather than the objects themselves: Notes Associations can have additional information on them Behaviour specifies the actions that can be done on the objects Frog Lane lane status: boolean class name, attributes incl associations behaviour direction: string position: integer colour: Color speed: float Car

© Peter Andreae ENGR : 14 Designing Class Diagrams How do you work out what classes there should be? No mechanical algorithm: it is a design issue Starting point: the nouns/noun phrases in the specification eg, the initial text description, the use cases, etc. note: this is not enough: Some nouns don’t need to be classes Some things classes aren’t

© Peter Andreae ENGR : 15 Lab sign-up system System should allow students to sign up for lab streams for their courses. Each course will have one or more lab streams. Each stream will have a time, duration, lab, and a maximum capacity. A course administrator needs to be able to set up the lab streams for their course. Students should be able to specify the lab streams that they could make, and a preference order. When sufficient students have entered their preferences, the system should show which streams students are likely to be assigned to, along with the likelihood. The course administrator can “commit” to an allocation, at which point, the system will permanently allocate signed up students to streams. Students should be able to withdraw from lab streams, and enter new preferences, but they won’t be actually assigned until the next time the administrator “commits”. Administrators should be able to get lists of students in each stream of their course.

© Peter Andreae ENGR : 16 What are the objects and classes? Next lecture: techniques, and more details.