CSC 213 – Large Scale Programming Lecture 2: Object-Oriented Analysis & Object-Oriented Design.

Slides:



Advertisements
Similar presentations
COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
Advertisements

CSC 213 – Large Scale Programming or. Today’s Goals  Begin by discussing basic approach of quick sort  Divide-and-conquer used, but how does this help?
Introduction to Programming Using simple games to convey introductory concepts MERLOT International Conference 2004 Tracey Jensen Assistant Professor,
Introducing While loops (and random numbers too) Alice.
Ch 12: Object-Oriented Analysis
Design Example. Requirements Make a program that simulates the game of blackjack For now, we ignore money/betting…. just simulate game play But… this.
Computer Science II Recursion Professor: Evan Korth New York University.
1 Chapter 1 Object-Oriented Programming. 2 OO programming and design Object-oriented programming and design can be contrasted with alternative programming.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
CS70 L23 Hashing (1)Dan Garcia © UCB Dan Garcia ( inst.eecs.berkeley.edu/~cs70/ 1 Handout: notes Computer Science.
Recursion Road Map Introduction to Recursion Recursion Example #1: World’s Simplest Recursion Program Visualizing Recursion –Using Stacks Recursion Example.
Exam Questions Chain of Responsibility & Singleton Patterns Game Design Experience Professor Jim Whitehead February 4, 2009 Creative Commons Attribution.
1 CS1001 Lecture Overview Object Oriented Design Object Oriented Design.
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
Domain Modeling (with Objects). Motivation Programming classes teach – What an object is – How to create objects What is missing – Finding/determining.
Software Reengineering 2003 년 12 월 2 일 최창익, 고광 원.
CSC 213 – Large Scale Programming. Today’s Goal  Learn Unified Process to design programs  Understand what are the “types” of Java classes  Methods.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Lecture 2: UML Class DIAGRAM
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
1 CSC 221: Computer Programming I Fall 2004 course overview  what did we set out to learn?  what did you actually learn?  where do you go from here?
1 Some Patterns of Novice Programs Author : Eugene Wallingford ; Dan Steinberg ; Robert Duvall ; Ralph Johnson Source : PLoP 2004 Advisor : Ku-Yaw Chang.
OBJECT-ORIENTED ANALYSIS PHASE
Slide 12.1 © The McGraw-Hill Companies, CS 4310: Software Engineering Lecture 7 Systems Analysis Object-Oriented Design.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2011 See online syllabus (also available through BlueLine): Course goals:
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 21. Review ANALYSIS PHASE (OBJECT ORIENTED DESIGN) Functional Modeling – Use case Diagram Description.
CSC 213 – Large Scale Programming Lecture 3: Object-Oriented Analysis.
1 Principles of Computer Science I Prof. Nadeem Abdul Hamid CSC 120 – Fall 2005 Lecture Unit 10 - Testing.
CSC 313 – Advanced Programming Topics. Design Pattern Intent  Each design pattern is a tool  Like all tools, have reason for being.
Software Life Cycle Requirements and problem analysis. –What exactly is this system supposed to do? Design –How will the system solve the problem? Coding.
CS3320::CH111 OBJECT-ORIENTED ANALYSIS Chapter 11.
1 Analysis Extracting from Use Cases to Create Diagrams.
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
Lecture 14 & 15: Object- Oriented Analysis Anita S. Malik Adapted from Schach (2004) Chapter 12.
CSC 213 – Large Scale Programming. Today’s Goal  Improve design skills to make usable designs  Noun extraction & UML class diagram reviewed  Connections.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
LECTURE 14: USE CASE BASICS CSC 212 – Data Structures.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
1 CSC 222: Computer Programming II Spring 2004 See online syllabus at: Course goals:
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Chapter 12: Design Phase n 12.1 Design and Abstraction n 12.2 Action-Oriented Design n 12.3 Data Flow Analysis n Data Flow Analysis Example n
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
Machine Learning for an Artificial Intelligence Playing Tic-Tac-Toe Computer Systems Lab 2005 By Rachel Miller.
Design Concepts By Deepika Chaudhary.
Slide 12A.1 © The McGraw-Hill Companies, 2005 Object-Oriented and Classical Software Engineering Sixth Edition, WCB/McGraw-Hill, 2005 Stephen R. Schach.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
Code reading skills LEVEL GAME.  Common scenario:  Students raise hand. Point to code, say they don’t understand why it’s not working.  public void.
CSC 212 – Data Structures Lecture 17: Stacks. Question of the Day Move one matchstick to produce a square.
JETT 2005 Session 5: Algorithms, Efficiency, Hashing and Hashtables.
Polina Alex Eviatar Roey Andrea Erez.  For those that heard but don’t know exactly:  Scrabble is a word game for two and more players on a square board.
Petri Nets Invented by Carl Adam Petri in 1962 Concurrent systems with timing problems  Synchronization, race problem, deadlock A petri net consists of.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
THE ANALYSIS WORKFLOW  The specification document  Informal specifications  The analysis workflow  Extracting the entity classes  Functional modeling:
Use Case Textual Analysis
Software Engineering Zhang Shuang
CSC 212 – Data Structures Lecture 2: Primitives, References, & Classes.
Introduction to Object-Oriented Design Concepts. Object-Oriented Design Overview Object-Oriented design is basically a set of guidelines/concepts for.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Session 3 How to Approach the UML Written by Thomas A. Pender Published by Wiley Publishing, Inc. October 5, 2011 Presented by Kang-Pyo Lee.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
CSC 213 – Large Scale Programming. Today’s Goal  Understand why testing code is important  Result of poor or no testing & embarrassment caused  Learn.
Playing Tic-Tac-Toe with Neural Networks
CHAPTER 12 OBJECT-ORIENTED ANALYSIS. Overview Extracting the entity classes Object-oriented analysis: The elevator problem case study Functional modeling.
High Level Design Use Case Textual Analysis SE-2030 Dr. Mark L. Hornick 1.
CSCE 240 – Intro to Software Engineering Lecture 3.
CS223: Software Engineering Lecture 34: Software Maintenance.
Lecture 9: Birds + BEES = CLASSES?
Presentation transcript:

CSC 213 – Large Scale Programming Lecture 2: Object-Oriented Analysis & Object-Oriented Design

Today’s Goal Discuss traits that make programmers great Learn Unified Process to design programs “Types” of Java classes Methods of selecting the potential classes Models which test if the class design will work

Secrets to Success What separates the good from the great: Innate intelligence? Decades of experience? Eating cans of spinach before class? Habits, traits, & skills of great programmers:

Designing Programs Designing a program is hard Good design makes the programming simple May not be able to implement a bad design Design also easiest stage to make changes Need not worry about implementation issues Changes are simple; only requires an eraser

Designing Programs Ultimately, program design like any other skill What’s the quickest way to Carnegie Hall? Get many opportunities with this in CSC213 Will begin discussion today & Monday Unified Process helps develop design Begins by figuring out the potential classes Figures out methods needed for each class Exposes design problems before writing code

3 “Types” of Classes Unified Process concept to simplify designs Entity classes hold the long-lived data Boundary classes defined for input & output Control classes do complex processing in the program “Types” exist only for purposes of design Within Java, a class is a class is a class

Entity Classes Design starts with program requirements In a class, this is the assignment handout Noun extraction finds entity classes Identify nouns in requirements – these are the candidate classes Eliminate classes that are external to problem Ignore abstract nouns (nouns that do not define a physical object) and nouns used in communication Usually become fields or boundary classes

Identify the nouns in the requirements Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed. Eliminate classes external to the problem Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed. Ignore Abstract Nouns Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed. Button, Elevator, Floor Designing Elevator Controller Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed.

Boundary Classes Boundary class exists for each input & output Inputs and outputs are often complex May record many individual details Each detail defines own boundary class Boundary class also defined for record Go from simplest classes to complex class Complex class just has fields of simple class Much harder to break complex class up into simple classes

Each input and output is a boundary class Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed. Movement, Illumination, Request Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed. Designing Elevator Controller Each input and output is a boundary class Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed.

Skipping Boundary Classes Boundary classes may duplicate primitive type Illumination is on or off Movement is up or down Both of these are boolean Can skip defining classes duplicating primitive Hard-code primitive throughout the code Saves javadoc for class, field, getter & setter But if you need to make a change, must find code to change and/or replace all the primitives Nearly always ends up worth writing the class

Control Classes Defined for each non-obvious algorithm that uses multiple items What is “non-obvious” is not always… obvious Rule of thumb: algorithm is non-obvious if algorithm is not named in the assignment Defined for all plural nouns in requirements If exact number known, can use an array Otherwise need collection class of objects Depending on access pattern, may want Stack, ArrayList, Dictionary, Set, …

Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed. Non-obvious algorithms or plurals Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed. Designing Elevator Controller Skip plurals with exact count Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed. Buttons, Requests

Daily Activity Design classes needed for a tic-tac-toe controller: Game is played on a board. The board is a 3-by-3 grid of squares. Game has 2 players alternately making a move. For a move, a player selects a square. If the selected square is not empty, the player loses. Otherwise, the square is marked for the player. A player wins if they mark a line of 3 squares. If the entire board is marked without a player winning, the game is a tie.

For Next Lecture Will finish design discussion on Monday Illustrate a design using a language called UML Converting between UML and Java Test to see if the design works and makes sense Debugging methods when a design does not work