Design and UML Class Diagrams



Similar documents
Design and UML Class Diagrams. Suggested reading: Practical UML: A hands on introduction for developers

How To Design Software

Object Oriented Programming. Risk Management

Introduction. UML = Unified Modeling Language It is a standardized visual modeling language.

ATM Case Study OBJECTIVES Pearson Education, Inc. All rights reserved Pearson Education, Inc. All rights reserved.

UML Tutorial: Part 1 -- Class Diagrams.

Software Development: An Introduction

Sequence Diagram Tutorial. From: UML Distilled, Third Edition, Chapter 4 M. Fowler

11 November

players on one side of the table and a place for the dealer on the opposite side.

Menouer Boubekeur, Gregory Provan

UML basics: An introduction to the Unified Modeling Language

Using UML Part One Structural Modeling Diagrams

Combinatorics 3 poker hands and Some general probability

RULES FOR TEXAS HOLD EM POKER

How to Play Blackjack Alex Powell, Jayden Dodson, Triston Williams, Michael DuVall University of North Texas TECM /27/2014

UML: Unified Modeling Language

IRA 423/08. Designing the SRT control software: Notes to the UML schemes. Andrea Orlati 1 Simona Righini 2

UNDERGROUND TONK LEAGUE

How To Draw A Cell Phone Into A Cellphone In Unminimal Diagram (Uml)

How to Make a Domain Model. Tutorial

CS 341 Software Design Homework 5 Identifying Classes, UML Diagrams Due: Oct. 22, 11:30 PM

Casino Gaming Rule 2010

Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design

Tutorial - Building a Use Case Diagram

3D Animation of Java Program Execution for Teaching Object Oriented Concepts

BAD BEAT. Bad Beat will reset at $10,000 with a qualifier of four deuces beaten. Every Monday at 6:00 AM the Bad Beat will increase by $10,000.

CHAPTER_3 SOFTWARE ENGINEERING (PROCESS MODELS)

on a table having positions for six players on one side of the table 1. A true to scale rendering and a color photograph of the

Object Oriented Software Models

Artificial Intelligence Beating Human Opponents in Poker

Champion Poker Texas Hold em

Programming Language Constructs as Basis for Software Architectures

Types of UML Diagram. UML Diagrams OOAD. Computer Engineering Sem -IV

Classes and Objects. Agenda. Quiz 7/1/2008. The Background of the Object-Oriented Approach. Class. Object. Package and import

Data Modeling Basics

Unit I Page No. 1 System Development Object Basics Development Life Cycle Methodologies Patterns Frameworks Unified Approach UML

RULES FOR PLAY TEXAS HOLD EM

Casino Control (3 Card Poker) Approval 2006 (No 1)

UML Tutorial. Table of Contents. 1. Introduction Problem Proposed Solution Assumptions Dependencies

Business Modeling with UML

Comparison between Traditional Approach and Object-Oriented Approach in Software Engineering Development

2016 POKER TOURNAMENT CONTEST RULES

1 Class Diagrams and Entity Relationship Diagrams (ERD)

Analysis and Design with UML

A UML Introduction Tutorial

1. General Black Jack Double Deck Black Jack Free Bet Black Jack Craps Craps Free Craps...

History OOP languages Year Language 1967 Simula Smalltalk

TEXAS HOLD EM POKER FOR SIGHT

ACEY DEUCEY-21 Copyright 2007 Warren Montney WAR ACEY DEUCEY

Masters of Science in Software & Information Systems

1 Bet Threat Texas Hold Em Gaming Equipment Rules of the Games Temporary Amendments: N.J.A.C. 19:40-1.2; and 19: , 1.18 and 1.

In this Lecture you will Learn: Systems Development Methodologies. Why Methodology? Why Methodology?

TDDC88 Lab 2 Unified Modeling Language (UML)

How to Play. Player vs. Dealer

PENNSYLVANIA GAMING CONTROL BOARD REMAINING TEMPORARY TABLE GAMES REGULATIONS TITLE 58. RECREATION CHAPTERS: 581, 583, 585, 587, 588, 589,

Training Manual. Shuffle Master Gaming Three Card Poker Training Manual R

1 Hour, Closed Notes, Browser open to Java API docs is OK

UML basics. Part III: The class diagram. by Donald Bell IBM Global Services

Terms and Conditions for Charitable Texas Hold em Poker Tournaments

SPANISH Player blackjack always beats a dealer blackjack and is paid 3 to 2.

Course Code and Name Year - Semester. Number of marks

Object-oriented design methodologies

Lecture 12: Entity Relationship Modelling

THREE CARD BRAG (FLASH)

UML Class Diagrams. Lesson Objectives

Using Rational Rose to Create Object-Oriented Diagrams

Fundamentals of Java Programming

The Role of Requirements Traceability in System Development

Object Oriented Design

The Business Process Model

ATM Case Study Part 1

UML Class Diagrams (1.8.7) 9/2/2009

MA-WA1920: Enterprise iphone and ipad Programming

Automatic generation of fully-executable code from the Domain tier of UML diagrams

Laboratory work in AI: First steps in Poker Playing Agents and Opponent Modeling

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

How To Develop Software

Development models. 1 Introduction. 2 Analyzing development models. R. Kuiper and E.J. Luit

Fundamentals of Probability

Probabilities of Poker Hands with Variations

Ultimate Texas Hold'em features head-to-head play against the player/dealer and an optional bonus bet.

An Introduction To UML Class Diagrams Classes

Guide To Creating Academic Posters Using Microsoft PowerPoint 2010

Java CPD (I) Frans Coenen Department of Computer Science

LAB 3: Introduction to Domain Modeling and Class Diagram

Using Use Cases for requirements capture. Pete McBreen McBreen.Consulting

UML FOR OBJECTIVE-C. Excel Software

CPS122 Lecture: State and Activity Diagrams in UML

The Normal Approximation to Probability Histograms. Dice: Throw a single die twice. The Probability Histogram: Area = Probability. Where are we going?

Chapter 3. Data Analysis and Diagramming

Applying Use Cases to Microcontroller Code Development. Chris Gilbert Cypress Semiconductor

Texas Hold em. From highest to lowest, the possible five card hands in poker are ranked as follows:

Math Games For Skills and Concepts

Transcription:

Design and UML Class Diagrams 1 Suggested reading: Practical UML: A hands on introduction for developers http://dn.codegear.com/article/31863 UML DistilledCh. 3, by M. Fowler

How do people draw / write down software architectures?

Example architectures person sea agent VerizonWireless UW student lake agent GPS satellite CSE 403 student amphibious agent Cell phone

Big questions What is UML? Why should I bother? Do people really use UML? What is a UML class diagram? What kind of information goes into it? How do I create it? When should I create it?

Design phase design: specifying the structure of how a software system will be written and function, without actually writing the complete implementation a transition from "what" the system must do, to "how" the system will do it What classes will we need to implement a system that meets our requirements? What fields and methods will each class have? How will the classes interact with each other?

How do we design classes? class identification from project spec / requirements nouns are potential classes, objects, fields verbs are potential methods or responsibilities of a class CRC card exercises write down classes' names on index cards next to each class, list the following: responsibilities: problems to be solved; short verb phrases collaborators: other classes that are sent messages by this class (asymmetric) UML diagrams class diagrams (today) sequence diagrams...

What is UML? UML: pictures of an OO system programming languages are not abstract enough for OO design UML is an open standard; lots of companies use it What is legal UML? a descriptivelanguage: rigid formal syntax (like programming) a prescriptive language: shaped by usage and convention it's okay to omit things from UML diagrams if they aren't needed by team/supervisor/instructor

Uses for UML as a sketch: to communicate aspects of system forward design: doing UML before coding backward design: doing UML after coding as documentation often done on whiteboard or paper used to get rough selective ideas as a blueprint: a complete design to be implemented sometimes done with CASE (Computer-Aided Software Engineering) tools as a programming language: with the right tools, code can be auto-generated and executed from UML only good if this is faster than coding in a "real" language

UML In an effort to promote Object Oriented designs, three leading object oriented programming researchers joined ranks to combine their languages: Grady Booch (BOOCH) Jim Rumbaugh (OML: object modeling technique) Ivar Jacobsen (OOSE: object oriented software eng) and come up with an industry standard [mid 1990 s].

UML Unified Modeling Language Union of all Modeling Languages Use case diagrams Class diagrams Object diagrams Sequence diagrams Collaboration diagrams Statechart diagrams Activity diagrams Component diagrams Deployment diagrams. Very big, but a nice standard that has been embraced by the industry.

Object diagram ( class diagram) individual objects (heap layout) objectname: type attribute = value lines show field references Class diagram: summary of all possible object diagrams

Object diagram example

UML class diagrams UML class diagram: a picture of the classes in an OO system their fields and methods connections between the classes that interact or inherit from each other Notrepresented in a UML class diagram: details of how the classes interact with each other algorithmic details; how a particular behavior is implemented

Diagram of one class class name in top of box write <<interface>> on top of interfaces' names use italics for an abstract class name attributes (optional) should include all fields of the object operations / methods (optional) may omit trivial (get/set) methods but don't omit any methods from an interface! should not include inherited methods

Class attributes (= fields) attributes (fields, instance variables) visibility name: type[count] = default_value visibility: + public # protected - private ~ package (default) / derived underline static attributes derived attribute: not stored, but can be computed from other attribute values specification fields from CSE 331 attribute example: -balance : double = 0.00

Class operations / methods operations / methods visibility name(parameters) : return_type visibility: + public # protected - private ~ package (default) underline static methods parameter types listed as (name: type) omit return_type on constructors and when return type is void method example: + distance(p1: Point, p2: Point): double

Comments represented as a folded note, attached to the appropriate class/method/etc by a dashed line

Relationships between classes generalization: an inheritance relationship inheritance between classes interface implementation association: a usage relationship dependency aggregation composition

Generalization (inheritance) relationships hierarchies drawn top-down arrows point upward to parent line/arrow styles indicate whether parent is a(n): class: solid line, black arrow abstract class: solid line, white arrow interface: dashed line, white arrow often omit trivial / obvious generalization relationships, such as drawing the Object class as a parent

Associational relationships associational (usage) relationships 1. multiplicity (how many are used) * 0, 1, or more 1 1 exactly 2..4 between 2 and 4, inclusive 3..* 3 or more (also written as 3.. ) 2. name (what relationship the objects have) 3. navigability (direction)

Multiplicity of associations one-to-one each student must carry exactly one ID card one-to-many one rectangle list can contain many rectangles

Association types aggregation: is part of symbolized by a clear white diamond 1 1 Car Engine aggregation composition: is entirely made of stronger version of aggregation the parts live and die with the whole symbolized by a black diamond dependency: uses temporarily symbolized by dotted line often is an implementation detail, not an intrinsic part of that object's state Lottery Ticket composition dependency Book 1 * Page Random

Composition/aggregation example If the movie theater goes away so does the box office => composition but movies may still exist => aggregation

Class diagram example No arrows; info can flow in both directions Aggregation Order class contains OrderDetail classes. Could be composition?

UML example: people Let s add the visibility attributes

26 Class diagram: voters

Class diagram example: video store Multiplicity Class Customer 1 Simple Aggregation Abstract Rental Invoice Class Rental Item 1..* 1 0..1 Generalization Composition Simple Association DVD Movie VHS Movie Video Game Checkout Screen

Class diagram example: student StudentBody + main (args : String[]) Address - streetaddress : String - city : String - state : String - zipcode : long + tostring() : String 1 100 Student - firstname : String - lastname : String - homeaddress : Address - schooladdress : Address + tostring() : String

Tools for creating UML diagrams Violet (free) http://horstmann.com/violet/ Rational Rose http://www.rational.com/ Visual Paradigm UML Suite (trial) http://www.visual-paradigm.com/ (nearly) direct download link: http://www.visual-paradigm.com/vp/download.jsp?product=vpuml&edition=ce (there are many others, but most are commercial)

Design exercise: Texas Hold empoker game 2 to 8 human or computer players Each player has a name and stack of chips Computer players have a difficulty setting: easy, medium, hard Summary of each hand: Dealer collects ante from appropriate players, shuffles the deck, and deals each player a hand of 2 cards from the deck. A betting round occurs, followed by dealing 3 shared cards from the deck. As shared cards are dealt, more betting rounds occur, where each player can fold, check, or raise. At the end of a round, if more than one player is remaining, players' hands are compared, and the best hand wins the pot of all chips bet so far. What classes are in this system? What are their responsibilities? Which classes collaborate? Draw a class diagram for this system. Include relationships between classes (generalization and associational).

Class diagram pros/cons Class diagrams are great for: discovering related data and attributes getting a quick picture of the important entities in a system seeing whether you have too few/many classes seeing whether the relationships between objects are too complex, too many in number, simple enough, etc. spotting dependencies between one class/object and another Not so great for: discovering algorithmic (not data-driven) behavior finding the flow of steps for objects to solve a given problem understanding the app's overall control flow (event-driven? web-based? sequential? etc.)