Fundamentals of Software Development 1Slide 1 Outline of this exercise Learning objectives:Learning objectives: –After this exercise, a student should.

Slides:



Advertisements
Similar presentations
Noadswood Science,  To know how to use Python to produce windows and colours along with specified co-ordinates Sunday, April 12, 2015.
Advertisements

Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
Chapter 7 Structuring System Process Requirements
Stereotypes Stereotypes provide the capability to create a new kind of modeling element. –They can be used to classify or mark modeling elements. –A type.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Software Engineering COMP 201
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
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.
UML – Class Diagrams.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Essentials of interaction diagrams Lecture 23 & 24.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Chapter Day 10. © 2007 Pearson Addison-Wesley. All rights reserved4-2 Agenda Day 10 Questions from last Class?? Problem set 2 posted  10 programs from.
Unified Modeling Language (UML)
Lecture a: Additional UML Models: Package, Activity, Deployment Lecture b: Generalization, Aggregation and Additional Domain Model Notation Copyright W.
Chapter Day 9. © 2007 Pearson Addison-Wesley. All rights reserved4-2 Agenda Day 8 Questions from last Class?? Problem set 2 posted  10 programs from.
Fundamentals of Software Development 1Slide 1 UML class diagrams: Outline Why types / classes are importantWhy types / classes are important –Why types.
Fundamentals of Software Development 1Slide 1 Iterative enhancement plan Such a plan ensures that you always have code that worksSuch a plan ensures that.
PRJ566: PROJECT PLANNING AND MANAGEMENT Class Diagrams.
Chapter 7 Structuring System Process Requirements
Object-Oriented Analysis and Design
Test. A software house decides to develop a DVD renting program. The product manager identifies the following requirements: Every DVD will have a title,
CSE 331 Software Design & Implementation Hal Perkins Autumn 2012 Java Classes, Interfaces, and Types 1.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Fundamentals of Software Development 1Slide 1 Outline of this exercise Learning objectives of the tutorial:Learning objectives of the tutorial: –After.
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.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 8 Objects and Classes.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
Object Oriented Programming Lecture 5: BallWorld.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
Fundamentals of Software Development 1Slide 1 UML class diagrams: What are they? Unified Modeling Language (UML)Unified Modeling Language (UML) –“A family.
Software Engineering Lecture 10 UML vs. ERD.
CS Lecture 00 Swing overview and introduction Lynda Thomas
Using COMET with Visio Visio UML Modeling. Creating a Drawing After opening Visio, you will see a list of templates available.
Example: object diagram for Scheduler, v What is wrong with this diagram? Seems like a lot of similarity between Task and UnplannedTask Can use.
1 Kyung Hee University Diagram Editor : Design View Spring 2001.
Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1.
Design Model Lecture p6 T120B pavasario sem.
CS2110: SW Development Methods Inheritance in OO and in Java Part 2: Topics: Forms of inheritance Interfaces in Java.
JAZLER SHOW2 JAZLER SHOW2 AUTOMATION SOFTWARE. EASY PLAYBACK JAZLER SHOW2 AUTOMATION SOFTWARE Jazler Show is a program that lets you load audio files.
© 2006 Pearson EducationDesign Patterns1 of 20 A Final Example: A Traffic Light Let’s model a traffic light! – here’s the spec: Have a column of two circles.
Review_6 AWT, Swing, ActionListener, and Graphics.
Object-Oriented Analysis and Design Use cases Finding classes Collaboration and Sequence diagrams Associations between classes.
Programming Paradigms Different paradigms Procedural paradigm, e.g. Pascal Basic Functional paradigm, e.g. Lisp Declarative paradigm, e.g. Prolog Object-Oriented.
Chapter 3: Introducing the UML
Lecture Model View Controller s/w architecture AND general tips on structuring classes.
Fundamentals of Software Development 1Slide 1 Team project: Forthcoming ideas We have already seen ALL the fundamental ideas needed for your project except:We.
Diagram Editor : Use Case VIew
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
Swing GUI Components So far, we have written GUI applications which can ‘ draw ’. These applications are simple, yet typical of all Java GUI applications.
View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user interface element (the user interface.
1 Kyung Hee University Interaction Diagrams Spring 2001.
1 M206 Chapter 31: An Overview of Software Development 1.Defining the problem 2.Analyzing the requirement – constructing initial structural model 3.Analyzing.
Fundamentals of Software Development 1Slide 1 Recap: Key ideas in BallWorlds so far Writing a class:Writing a class: –structure –process Writing methods:Writing.
Requirements solicitation
Requirements solicitation
A First Look at GUI Applications
Object-Oriented Analysis and Design
Requirements To Design In This Iteration
ECE 352 Digital System Fundamentals
Presentation transcript:

Fundamentals of Software Development 1Slide 1 Outline of this exercise Learning objectives:Learning objectives: –After this exercise, a student should be able to: Read a UML class diagramRead a UML class diagram Describe the basic process for developing a UML class diagramDescribe the basic process for developing a UML class diagram Explain what is easy about the process and what is hardExplain what is easy about the process and what is hard Explain the iterative nature of the design processExplain the iterative nature of the design process Process:Process: –Review the specification of BallWorld –Develop a UML class diagram for BallWord Together (in groups), step by stepTogether (in groups), step by step

Fundamentals of Software Development 1Slide 2 Specification of BallWorld BallWorld is just that -- a world that contains various kinds of ballsBallWorld is just that -- a world that contains various kinds of balls –along with hotspots and perhaps other things eventually Each of the buttons represents a Java class that you will writeEach of the buttons represents a Java class that you will write –Pressing a button creates a ball of that type Types of Balls might include:Types of Balls might include: –Dud: does nothing –DudThatMoves: just moves in a constant, random velocity –Dragger: the user can drag it around and kill (delete) it –Mover: like a Dragger, but moves like a MovingDud Questions? You cannot design software unless you know what it is supposed to do! –Bouncer: like a Mover, but bounces off the walls of the World –Shrinker: A Bouncer that grows and shrinks in size –Exploder: Grows, then explodes and replicates itself!

Fundamentals of Software Development 1Slide 3 Design BallWorld, by drawing a UML class diagram for it Review the specification, then: 1.Identify kinds of objects – these become classes 2.Identify relationships between classes is-a (extends), is-a (implements), has-ais-a (extends), is-a (implements), has-a Identify interfaces that specify what is needed for the classes to relateIdentify interfaces that specify what is needed for the classes to relate 3.For each class, determine its attributes and operations 4.For each class, for each attribute/operation, determine its type We frequently retrace our steps and fine tune our design.

Fundamentals of Software Development 1Slide 4 List the classes in BallWorld List the kinds of things – classes – that you think belong in the BallWorld design:List the kinds of things – classes – that you think belong in the BallWorld design: –Some are visual –Some are internal –Some are relevant Java library classes like JFrame When done, compare your list with other lists around the roomWhen done, compare your list with other lists around the room

Fundamentals of Software Development 1Slide 5 The classes that I chose Visual things:Visual things: –BallWorldFrame –WorldPanel –ButtonsPanel –BallButton A single class, with several instances with different labelsA single class, with several instances with different labels Non-visual things:Non-visual things: –BallWorld The class that contains mainThe class that contains main –Ball –Various subclasses of Ball –HotSpot –World The class that manages all the Balls and HotSpotsThe class that manages all the Balls and HotSpots Relevant Java library classes:Relevant Java library classes: –JFrame –JPanel –JButton Question: Why not just let the WorldPanel play this role? Answer: I choose to separate function from display of that function

Fundamentals of Software Development 1Slide 6 Design BallWorld, by drawing a UML class diagram for it Review the specification, then: 1.Identify kinds of objects – these become classes 2.Identify relationships between classes is-a (extends), is-a (implements), has-ais-a (extends), is-a (implements), has-a Identify interfaces that specify what is needed for the classes to relateIdentify interfaces that specify what is needed for the classes to relate 3.For each class, determine its attributes and operations 4.For each class, for each attribute/operation, determine its type We frequently retrace our steps and fine tune our design. We just did our first iteration of Step 1 Now we’ll do our first iteration of Step 2, beginning with the is-a (extends) relationship

Fundamentals of Software Development 1Slide 7 BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton World BallHotSpot Is-a relationships Draw the is-a relationships between the classes shown Notation: A is-a B, that is, A extends B This means that A inherits all the attributes (data) and operations (behaviors) of B AB

Fundamentals of Software Development 1Slide 8 BallWorldFrame BallWorld JFrame ButtonsPanelWorldPanel JPanel BallButton JButton Questions on is-a so far? Is-a relationships World Ball HotSpot Draw the is-a relationships between the classes shown Notation: A is-a B, that is, A extends B This means that A inherits all the attributes (data) and operations (behaviors) of B AB

Fundamentals of Software Development 1Slide 9 Ball Dud Bouncer Shrinker Exploder... MovingDud Dragger Is-a relationships Types of Balls might include:Types of Balls might include: –Dud: does nothing –MovingDud: just moves in a constant, random velocity –Dragger: the user can drag it around and kill (delete) it –Mover: like a Dragger, but moves like a MovingDud –Bouncer: like a Mover, but bounces off the walls of the World –Shrinker: A Bouncer that grows and shrinks in size –Exploder: Grows, then explodes and replicates itself! Mover Draw the is-a relationships between the types of Balls Notation: A is-a B, that is, A extends B This means that A inherits all the attributes (data) and operations (behaviors) of B AB

Fundamentals of Software Development 1Slide 10 Ball Dud Bouncer Shrinker Exploder... MovingDud Dragger Is-a relationships Types of Balls might include:Types of Balls might include: –Dud: does nothing –MovingDud: just moves in a constant, random velocity –Dragger: the user can drag it around and kill (delete) it –Mover: like a Dragger, but moves like a MovingDud –Bouncer: like a Mover, but bounces off the walls of the World –Shrinker: A Bouncer that grows and shrinks in size –Exploder: Grows, then explodes and replicates itself! Mover Questions on is-a relationships? Draw the is-a relationships between the types of Balls Notation: A is-a B, that is, A extends B This means that A inherits all the attributes (data) and operations (behaviors) of B AB

Fundamentals of Software Development 1Slide 11 Has-a relationships Draw the has-a relationships in which objects are created, for the classes shown Notation: A has-a B, here, A creates a B Indicate the multiplicity on each end: 1.. * (one or more) 3 (exactly 3) (blank often means 1) AB We also use color (here, lime green, but more often I use red) to indicate has-a relationships that involve object creation. This is not standard UML. BallWorldFrame BallWorld JFrame ButtonsPanelWorldPanel JPanel BallButton JButton World Ball HotSpot

Fundamentals of Software Development 1Slide 12 BallWorldFrame BallWorlds JFrame ButtonsPanel WorldPanel JPanel BallButton JButton Has-a relationships World BallHotSpot 1..* I chose to have the BallWorlds create each World, which creates the two panels (WorldPanel and ButtonPanel). Why? Who else might I have chosen to create the World? The Panels? Part of an answer: I envision a single frame, but possibly many Worlds and associated Panels. Do you see why that leads to my choices? At this point, we need to ask ourselves – what remains to be created? Who should create them? Notation: A has-a B, here, A creates a B Indicate the multiplicity on each end: 1.. * (one or more), blank for exactly 1 AB

Fundamentals of Software Development 1Slide 13 BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton Has-a relationships World BallHotSpot 1..* We have yet to create the Balls and HotSpots? Who should create the HotSpots? Notation: A has-a B, here, A creates a B Indicate the multiplicity on each end: 1.. * (one or more), blank for exactly 1 AB 0..* Answer: the World seems a natural choice. Who creates a new Ball, e.g., a new Exploder? How? Answer: the human user, by pressing a BallButton.

Fundamentals of Software Development 1Slide 14 BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton Has-a relationships World BallHotSpot 1..* Notation: A has-a B, here, A creates a B Indicate the multiplicity on each end: 1.. * (one or more), blank for exactly 1 AB 0..* So the human user creates each Ball (e.g. an Exploder), by pressing a BallButton. When the human presses a BallButton, a Ball of the appropriate type must be: Constructed Added to the World Drawn In the current design, the latter two are impossible. Explain.

Fundamentals of Software Development 1Slide 15 BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton Has-a relationships World BallHotSpot 1..* Notation: A has-a B, here, A creates a B Indicate the multiplicity on each end: 1.. * (one or more), blank for exactly 1 AB 0..* So the human user creates each Ball (e.g. an Exploder), by pressing a BallButton. When the human presses a BallButton, a Ball of the appropriate type must be: Constructed Added to the World Drawn In the current design, the latter two are impossible. Draw the has-a relationships that are needed – who needs to know whom? These are has-a relationships, but do NOT involve creation of objects. How are these relationships going to be implemented?

Fundamentals of Software Development 1Slide 16 Relationships BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton World Ball DudBouncerBloaterExploder... is-a has-a 1..* Draw links to enable the construct/add/draw actions. Revise your answers to the “who-should” questions as needed, as you design. When a new Ball is created, it must be: Constructed Added to the World Drawn Who should construct the Ball? Add it to the World? Draw it?

Fundamentals of Software Development 1Slide 17 Relationships BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton World Ball DudBouncerBloaterExploder... is-a has-a 1..* Draw links to enable the construct/add/draw actions. Revise your answers to the “who-should” questions as needed, as you design. Here are my decisions, as I made them. BallButton: construct the new Ball. No links needed. (Why?) BallButton: tell the World to add the Ball. What does that imply is needed in the diagram?

Fundamentals of Software Development 1Slide 18 Relationships BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton World Ball DudBouncerBloaterExploder... is-a has-a 1..* BallButton: construct the new Ball. No links needed. BallButton: tell the World to add the Ball. Hence: BallButton must have the World World must be able to add a Ball What has-a relationships does that imply need to be added, for the BallButton to have the World? How does the BallButton obtain the World? Answer: BallWorldFrame creates the World, then sends it to the ButtonsPanel, who sends it to each BallButton. Do you see why it was a good decision for BallWorldFrame to create the 3 big things?

Fundamentals of Software Development 1Slide 19 Relationships BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton World Ball DudBouncerBloaterExploder... is-a has-a 1..* The World is intended to hold all of the balls. What has-a does that imply? Draw it. Who creates a new Ball, e.g., a new Exploder? How? Answer: the human user, by pressing a BallButton.

Fundamentals of Software Development 1Slide 20 Relationships BallWorldFrame BallWorld JFrame ButtonsPanel WorldPanel JPanel BallButton JButton World Ball DudBouncerBloaterExploder... Animatable interface WorldManagement interface Drawable interface is-a has-a 1..* What about interfaces? – This is a chance to give the design strategic consistency by defining up front how the interacting entities should talk!

Fundamentals of Software Development 1Slide 21 More questions Attributes:Attributes: –What does a Ball have? When the human user clicks a BallButton, should the World become aware of the constructed Ball? If so, how?When the human user clicks a BallButton, should the World become aware of the constructed Ball? If so, how? How is drawing done?How is drawing done? –WorldPanel gives info to Ball, or Ball gives info to WorldPanel? How do Balls “act”? What else should the human user be able to do to Balls? How is that accomplished?How do Balls “act”? What else should the human user be able to do to Balls? How is that accomplished? Who should act independently (i.e., what threads should exist)?Who should act independently (i.e., what threads should exist)? What interfaces would be useful in the above? In particular, what should the following be able to do:What interfaces would be useful in the above? In particular, what should the following be able to do: –Ball HotSpot ManagerOfBalls ManagerOfHotSpots

Fundamentals of Software Development 1Slide 22 Design BallWorld, by drawing a UML class diagram for it Review the specification, then: 1.Identify kinds of objects – these become classes 2.Identify relationships between classes is-a (extends), is-a (implements), has-ais-a (extends), is-a (implements), has-a Identify interfaces that specify what is needed for the classes to relateIdentify interfaces that specify what is needed for the classes to relate 3.For each class, determine its attributes and operations 4.For each class, for each attribute/operation, determine its type We frequently retrace our steps and fine tune our design. We just did our first iteration of Step 1 & 2 Now we’ll continue with our first iteration of Step 3 & 4