17
Object Oriented Design

Object Oriented Design. Goal Introduction to UML: u what are classes and instances? u Basic project analysis Introduction to Prototyping/AgentSheets

  • View
    215

  • Download
    1

Embed Size (px)

Citation preview

Object Oriented Design

Goal

Introduction to UML: what are classes and instances? Basic project analysis

Introduction to Prototyping/AgentSheets Game #1: Frogger

Why Object Oriented Design?

UML = Unified Modeling Language helps you specify, visualize, and document

models of object-oriented software systems, including their structure and design.

More information: http://www.omg.org

How much UML is enough?

Diagrams Structural Diagrams (represent static application structure)

Class Diagram (examples) Object Diagram (examples) Component Diagram Deployment Diagram

Behavior Diagrams (represent different aspects of dynamic behavior) Use Case Diagram Sequence Diagram Activity Diagram Collaboration Diagram Statechart Diagram

Model Management Diagrams (ways you can organize and manage your application modules) Packages Subsystems Models

Game 1: Frogger

You are a frog. Your task is simple: hop across a busy highway, dodging cars and trucks, until you get the to the edge of a river, where you must keep yourself from drowning by crossing safely to your grotto at the top of the screen by leaping across the backs of turtles and logs. But watch out for snakes and alligators! (Sega, 1980)

Problem Analysis

What are the Object Classes/Instances?

Step #1: Mark nouns You are a frog. Your task is simple: hop across a

busy highway, dodging cars and trucks, until you get the to the edge of a river, where you must keep yourself from drowning by crossing safely to your grotto at the top of the screen by leaping across the backs of turtles and logs. But watch out for snakes and alligators!

What are the Operations/Methods?

Step #2: Mark verbs You are a frog. Your task is simple: hop across a

busy highway, dodging cars and trucks, until you get the to the edge of a river, where you must keep yourself from drowning by crossing safely to your grotto at the top of the screen by leaping across the backs of turtles and logs. But watch out for snakes and alligators!

Class 1: Frog Class name

Attributes

Operations

Frog

X: integer

Y: integer

hop ()

leap ()

drown ()

Class 2: Highway Class name

Attributes

Operations

Highway

X: integer

Y: integer

Class 3: Truck Class name

Attributes

Operations

Truck

X: integer

Y: integer

Direction: String

drive ()

Class Diagram

Put all these boxes on one sheet of paper and you have the Class Diagram

Object Diagram

The AgentSheets Worksheet IS THE Object Diagram Shows ALL the instances Indicates the relationships between instances

(spatially)

Homework 2

Download AgentSheets Key will be emailed to you Build Frogger game Email project (Alex & Andri)

Windows: use “email project” feature Mac: stuff project folder

Due: Sept. 10 Read UML introduction: http://www.omg.org/

gettingstarted/what_is_uml.htm

Announcements

Office hours change THIS WEEK ONLY Instead of Wednesday: Thursday, Sept 5, 2-

3pm