Object-Oriented Design. CSE 5236: Mobile Application Development Course Coordinator: Dr. Rajiv Ramnath Instructor: Adam C.



Similar documents
Teaching Object-Oriented Software Design within the Context of Software Frameworks

11 November

Object-Oriented Design

How To Design Software

E27 SPRING 2013 ZUCKER PROJECT 2 PROJECT 2 AUGMENTED REALITY GAMING SYSTEM

A Systematic Approach for Constructing Static Class Diagrams from Software Requirements

Java: Learning to Program with Robots. Chapter 11: Building Quality Software

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

Chapter 5: Requirements Analysis and Validation Organizational Requirements Engineering

Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page:

Integration of Application Business Logic and Business Rules with DSL and AOP

How to Make a Domain Model. Tutorial

Math Board Games. For School or Home Education. by Teresa Evans. Copyright 2005 Teresa Evans. All rights reserved.

Object Oriented Databases (OODBs) Relational and OO data models. Advantages and Disadvantages of OO as compared with relational

Object Oriented Design

Why & How: Business Data Modelling. It should be a requirement of the job that business analysts document process AND data requirements

Design Patterns for Games

Announcements. HW due today, 2 to grade this week Welcome back from Spring Break!

D6 INFORMATION SYSTEMS DEVELOPMENT. SOLUTIONS & MARKING SCHEME. June 2013

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

How to Win at Tic-Tac-Toe

Ingegneria del Software Corso di Laurea in Informatica per il Management GRASP. Davide Rossi Dipartimento di Informatica Università di Bologna

LAB 3: Introduction to Domain Modeling and Class Diagram

Introductory programming course: motivating students with prior knowledge

JOURNAL OF OBJECT TECHNOLOGY

MAKING MATH MORE FUN BRINGS YOU FUN MATH GAME PRINTABLES FOR HOME OR SCHOOL

Game 9. Overview. Materials. Recommended Grades 3 5 Time Instruction: minutes Independent Play: minutes

MATHEMATICS Y6 Geometry 6750 Use co-ordinates and extend to 4 quadrants Equipment MathSphere

GAMES WITH ONE DIE Games where you only use a single die can be plenty exciting indeed. Here are two good examples of this!

Ready, Set, Go! Math Games for Serious Minds

Software Development: An Introduction

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

Object-oriented design methodologies

The first program: Little Crab

How To Play The Math Game

Sticky Note Bingo (Cover Up)

2 The first program: Little Crab

Lab 2.1 Tracking Down the Bugs

Swirl. Multiplayer Gaming Simplified. CS4512 Systems Analysis and Design. Assignment Marque Browne Manuel Honegger

Third Grade Math Games

Cornerstones: Click, Clack, Moo Flash Card Games: Instructions

3. How many winning lines are there in 5x5 Tic-Tac-Toe? 4. How many winning lines are there in n x n Tic-Tac-Toe?

Roulette: Inheritance Case Study

Math Games For Skills and Concepts

Unit #3: Investigating Quadratics (9 days + 1 jazz day + 1 summative evaluation day) BIG Ideas:

Server-Side Scripting and Web Development. By Susan L. Miertschin

Design and UML Class Diagrams

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

KS2 Missing Digits Non-Calculator Level 3/4 Number of practice sheets: 9 MathSphere MathSphere

Assignment # 2: Design Patterns and GUIs

HOW THE GAME IS PLAYED

Building A Very Simple Web Site

Anwender- Dokumentation

Penny Stacking. A contest to see who can stack the pennies the highest

Chapter 4, Requirements Elicitation

SKILL BUILDING MATH GAMES & ACTIVITIES

2. Create the User Interface: Open ViewController.xib or MainStoryBoard.storyboard by double clicking it.

Modeling the User Interface of Web Applications with UML

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

MicroStrategy Quick Guide: Creating Prompts ITU Data Mart Support Group, Reporting Services

How To Understand The Software Development Lifecycle

Options. Acquiring an application. Custom development. Off-the-shelf. Trade-off. Outsourcing development

Object Oriented Analysis and Design and Software Development Process Phases

Contents. Introduction and System Engineering 1. Introduction 2. Software Process and Methodology 16. System Engineering 53

Use Cases. Reference: Craig Larman, Applying UML and Patterns, Ch. 6

Mille Bornes Rules. About the Theme

M a t h a c t i v i t i e s

Agile Software Development

Five Pronunciation Games for Brazil

ecommerce User Guide LS Nav 2013 (7.1) Copyright 2014, LS Retail ehf. All rights reserved. All trademarks belong to their respective holders

Abstraction in Computer Science & Software Engineering: A Pedagogical Perspective

TEACHER S GUIDE TO RUSH HOUR

A PRELIMINARY REPORT ON ADAPTING SOFTWARE DEVELOPMENT INDUSTRY BEST PRACTICES FOR UNDERGRADUATE CLASSROOM USE

After 3 races the player with the highest winnings has won that day s racing.

The Design and Implementation of an Android Game: Foxes and Chickens

Introduction Solvability Rules Computer Solution Implementation. Connect Four. March 9, Connect Four

USA Volleyball Scorer Test A

2014 HSC Software Design and Development Marking Guidelines

Everyday Math Online Games (Grades 1 to 3)

Iteration 3 Kick Off, Domain Model Refinement. Curt Clifton Rose-Hulman Institute of Technology

Announcements. SE 1: Software Requirements Specification and Analysis. Review: Use Case Descriptions

Calculus JEOPARDY Instructions

Min. Art.No.: RIO524 Made in Germany Copyright

A GRADUATE S ROLE IN TECHNOLOGY TRANSFER: FROM REQUIREMENTS TO DESIGN WITH UML

MiniDraw Introducing a framework... and a few patterns

Tasks in the Lesson. Mathematical Goals Common Core State Standards. Emphasized Standards for Mathematical Practice. Prior Knowledge Needed

English lesson plans for Grade 1

Using Library Dependencies for Clustering

Design and Functional Specification

XXI. Object-Oriented Database Design

BASIC RULES OF CHESS


Accounting Games and Hands-on Activities. By Linda Welsh, Business Educator Whitehall High School

Database Design Methodology

BEST / Act 230 Funding

In school, time is precious. There is never enough of it to educate students as well as teachers and administrators. Sharing. Secrets.

English lesson plans for Grade 3

Object-Oriented Design Guidelines

OOP? What is OOP? Why? OOP in a nutshell. Stéphane Ducasse 2.1

Conditionals: (Coding with Cards)

Transcription:

Object-Oriented Design CSE 5236: Mobile Application Development Course Coordinator: Dr. Rajiv Ramnath Instructor: Adam C. Champion

Elements of Good Object-Oriented Design Idea: Capture the complexity of real world problems and solutions in objects Classes and responsibilities Polymorphism helps represent the real-world Achieve system goals through collaboration Principles: Loose coupling, high cohesion Abstraction Encapsulation and information hiding Methodology: Scenario-Driven Design Implement the objects needed for vertical slices of the system Technique: CRC Card Based Design Partnership for Performance

Terminology Check Class Object Method Function Class method Subclass (implementation) Subtype (interface) Interface Abstract class Virtual method Partnership for Performance

OO Design Process Capture narratives of the environment and the application Through observations, conversations with domain experts, other stakeholders, including end-users Identify specific circumstances where an app would be used Capture using text, storyboards, sketches, descriptions Identify domain classes and assign responsibilities. Where possible, identify collaborators. Evaluate using the OO Checklist Develop the application flow: use cases and screen flows. Map domain model to Android Framework model to create framework specific domain model. Map application flow to framework specific model. Connect UI to domain model. Identify collaborators, update model and flow as needed. Add contracts Evaluate again using the OO Checklist Partnership for Performance

Identify Objects and Classes Examine nouns, noun phrases Examine adjectives as candidate attributes or subtypes Group into categories these are potential abstract or super-classes. Write down the purpose of each class Eliminate redundant or non-domain classes Partnership for Performance

Identify and Assign Responsibilities Start with verbs and verb phrases (i.e. actions) Assign to the appropriate classes Try to distribute evenly don t give a class too much work Don t break the class definition Locate responsibility with information Locate related information together Partnership for Performance

Map Domain Model to Core Framework Patterns Usually a variation of MVC

Identify Collaborations Examine narratives, storyboards, use cases Create scenarios Walkthrough scenarios Identify interactions between classes These are the collaborations Partnership for Performance

Evaluate Using Design Checklist Each class must have: Clear name Cohesive description of responsibility Long-lived state Collaborators Partnership for Performance

Record on CRC Cards (1) Source: K. Beck and W. Cunningham, A Laboratory For Teaching Object-Oriented Thinking, Proc. ACM OOPSLA, 1989. (http://c2.com/doc/oopsla89/paper.html)

Record on CRC Cards (2) Sources: K. Beck and W. Cunningham, A Laboratory For Teaching Object-Oriented Thinking, Proc. ACM OOPSLA, 1989; C. Larman, Applying UML and Patterns, 3rd ed., Addison-Wesley, 2004 (on Safari Books online) Partnership for Performance

Tic-Tac-Toe Exercise Tic-tac-toe, also spelled tick-tack-toe, or noughts and crosses, as it is known in the UK, Ireland, Australia, New Zealand, is a pencil-andpaper game for two players, who take turns marking the spaces in a 3 3 grid with the symbols X and O respectively. The X player usually goes first. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game.# We extend this below by adding a narrative about playing the game on the Android device: Tic-tac-toe for Android will implement the Tic-tac-toe paper game as an Android app. In it, human users will be able to play Tic-tactoe against the computer. Multiple games may be played in each session, with either the computer playing first or the human playing first on an electronic board that will be displayed on the device s touch screen. Scores for each session will be accumulated. If the user quits the session, scores will be reset.#

Nouns and Verbs Nouns: pencil, paper, game, nought, cross, player, X, O, space, symbol, grid, mark, vertical row, horizontal row, diagonal row, human user, human, computer, session, board, touchscreen, score. These are candidate objects and classes. Verbs: take turn, mark, goes, place, win, implement, play, playing first, display, accumulate, quit, reset. These are candidate responsibilities.

Consolidate: Nouns Remove pencil, paper, touchscreen physical objects Symbol and mark identical retain symbol. User vs. player retain player Remove one of board and grid Remove touchscreen physical Row is a component Session is an instance of game

Consolidate: Verbs Take turn, goes, play retain play Mark vs. place vs.? Use place symbol Remove implement irrelevant to game Retain display, accumulate, exit and reset

Candidate Classes and Responsibilities Classes: Symbol, Player, Human, Computer, Board, Row, and Game (with attribute Score) Instances: O, X of the class Symbol Responsibilities: play, place, display, accumulate (scores), quit, and reset.

Allocate Responsibilities to Classes Class Game is allocated the responsibilities: play, accumulatescores, quit, and reset. Class Board has Display responsibilities. Class GameGrid has Place. Symbol, Player, Human, Computer, and Row have no responsibilities yet. Keep?

Map Domain Model to Core Framework Patterns Controller classes map to Activities, e.g. GameSession Visual elements (if any, remember we re doing domain object design) map to views. Pure domain objects map to POJO hierarchies.

General Scenario Start a new game. Decide and set who plays first: the human or the computer. The first player gets assigned the X as a symbol, while the second player gets assigned the O. The first player places his (or its) symbol at an empty location on the board. The second player does likewise. Repeat until one player has three of his (or its) symbols in a row, column or diagonal, or there are no more squares to play, in which case the game ends in draw. Accumulate the scores for the players. The winning player gets 1 added to his/its score. No change is made to a losing player s score. Also, both players scores stay the same if the game ends in a draw. If the user wishes, start a new game, else, quit.

Screens and screen flows in Tic-Tac-Toe

Scenario Walkthrough Verification, Identifying Collaborators No class to respond starting a new game. Create one: GameController? GameController and Game collaborate Symbol creation and placement? Symbol and Board. placesymbol invokes Play? Game needs checkresult? Board, GameGrid and Game are collaborators. Etc.

Final Classes and Responsibilities Game: Represents a single Tic-Tac-Toe game. Responsibilities: play, checkresult Collaborators: GameSession, GameView, Grid. GameView: Represents the visual display of a Tic-Tac-Toe game. Responsibilities: placesymbol, showscores Collaborators: Game GameGrid: Represents the 3x3 Tic-Tac-Toe grid. Responsibilities: placesymbol, getemptysquares Collaborators: Game GameSession Represents a Tic-Tac-Toe playing session consisting of multiple games. Note that we Responsibilities: playnewgame, quit, decideplayers, accumulatescores Collaborators: Game, GameView Symbol represents a Tic-Tac-Toe symbol, i.e., an X or an O. Responsibilities: None Collaborators: Game

Contracts Game: play(grid, Symbol, x, y) returns Success, Failure checkresultandsetstate(grid) returns nothing isactive() returns true or false iswon() returns true or false isdrawn() returns true or false GameView: placesymbol(symbol, X, Y) returns Success, Failure showscores(playeronescore, PlayerTwoScore) returns nothing.

Thank You Questions and comments?