Recitation 7 Godfrey Tan March 21, 2002. Administrivia PS6 due Tuesday right after break Final Project descriptions will be handed out Monday after break.

Slides:



Advertisements
Similar presentations
Identity and Equality Based on material by Michael Ernst, University of Washington.
Advertisements

The Substitution Principle SWE 332 – Fall Liskov Substitution Principle In any client code, if subtype object is substituted for supertype object,
Written by: Dr. JJ Shepherd
AbstractClassesInterfacesPolymorphism1 Abstract Classes, Interfaces, Polymorphism Barb Ericson Georgia Tech April 2010.
C8: Understanding Inheritance. Intuitive description Intuitive: FLORISTS are SHOPKEEPERS, inheriting various shopkeeper behaviors Tension in OOP languages:
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
1 Chapter 6 Inheritance, Interfaces, and Abstract Classes.
OOP Week 3 1 Object Oriented Programming in Java Monday, Week 3 Interface PinBallTarget OOP Concepts Last Week’s Assignment Arrays Collection Class --
From Theory to Practice 1 OOP Overview Reminder – some OOD principles from previous lessons: –Class Inheritance vs. Object Composition –Program.
Subclasses and Subtypes CMPS Subclasses and Subtypes A class is a subclass if it has been built using inheritance. ▫ It says nothing about the meaning.
9/4/2015Abstract classes & Interface1 Object Oriented Design and Programming II Chapter 10 Abstract classes and Interfaces.
Cs2220: Engineering Software Class 11: Subtyping and Inheritance Fall 2010 University of Virginia David Evans.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Chapter 8: Writing Graphical User Interfaces
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION MIDTERM REVIEW Autumn 2011.
Objected Oriented Programming & Design JAVA Shishir Gupta (704) (704)
Effective C#, Chapter 1: C# Language Elements Last Updated: Fall 2011.
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
Session 11 Border Layout, using Panels, Introduction to PinBallGame.
1 Computer Science 340 Software Design & Testing Inheritance.
CSSE501 Object-Oriented Development. Some OO Design Principles  Majority principles here come from: Design Principles in Java, Bob Tarr.
1/20/03A2-1 CS494 Interfaces and Collection in Java.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Implications of Inheritance COMP206, Geoff Holmes and Bernhard Pfahringer.
More Implications of Inheritance COMP204, Bernhard Pfahringer.
Project 1: Animation System Assigned: 01/17/06 Due: 01/31/06.
Chapter 14 Abstract Classes and Interfaces. Abstract Classes An abstract class extracts common features and functionality of a family of objects An abstract.
Type Abstraction Liskov, Chapter 7. 2 Liskov Substitution Principle In any client code, if the supertype object is substituted by a subtype object, the.
Type Abstraction SWE Spring October 05Kaushik, Ammann Substitution Principle “In any client code, if supertype object is substituted.
Session 13 Pinball Game Construction Kit (Version 3):
Inheritance and Access Control CS 162 (Summer 2009)
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
This recitation 1 An interesting point about A3: Using previous methods to avoid work in programming and debugging. How much time did you spend writing.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Recitation 5 Enums and The Java Collections classes/interfaces 1.
Effective Java, Chapter 4: Classes and Interfaces Last Updated: Fall 2011.
Subtype Polymorphism, cont. Parametric Polymorphism and Java Generics.
Topics Inheritance introduction
Inheritance Type/Subtype Relationship. Inheritance Idea: An object B of one type, termed child class, inherits from another object A of another type,
Team Member Assessments Preliminary Round Second and Third can Influence Grade CSE 403, Winter 2011, Alverson, Brun.
March 1, 2004CS WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004.
Written by: Dr. JJ Shepherd
CSSE501 Object-Oriented Development. Chapter 10: Subclasses and Subtypes  In this chapter we will explore the relationships between the two concepts.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 11: Subtyping and Inheritance.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
CSCE 240 – Intro to Software Engineering Lecture 3.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
Zach Tatlock / Winter 2016 CSE 331 Software Design and Implementation Lecture 12 Subtypes and Subclasses.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Parametric Polymorphism and Java Generics. Today’s Lecture Outline Subtype polymorphism Subtyping vs. subclassing Liskov Substitution Principle (LSP)
The LAST Recitation Godfrey Tan.
Design Principles.
CSE 331 Subtyping slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia
EECE 310: Software Engineering
Week 4 Object-Oriented Programming (1): Inheritance
Type Abstraction SWE Spring 2009.
Subtype Polymorphism, Subtyping vs
CSE 331 Software Design and Implementation
Abstract Class As per dictionary, abstraction is the quality of dealing with ideas rather than events. For example, when you consider the case of ,
Type Abstraction Liskov, Chapter 7.
Effective Java: Classes and Interfaces
CSE 331 Software Design & Implementation
CSE 331 Software Design & Implementation
EECE 310: Software Engineering
Border Layout, using Panels, Introduction to PinBallGame
Type Abstraction SWE Spring 2013.
Presentation transcript:

Recitation 7 Godfrey Tan March 21, 2002

Administrivia PS6 due Tuesday right after break Final Project descriptions will be handed out Monday after break Each group must agree on the common project If you are not satisfied with your group assignment, you should complain to me by the end of recitation.

Final Project Choice of two projects: Gizmoball, Anti-chess Equal difficulty/amount of work Each TA will provide help on one of two projects A “spec amendment” will be introduced halfway through your project

Gizmoball Ball bounced around by gizmos (demo) Physics package will be provided can be extended (e.g. magnetic field, relativity) Open-ended goal pin-ball, visual effect, physics simulation, etc. GUI/graphics intensive Competition?

Antichess Like Chess but the winning objective is to lose all your pieces Involves: chess board design, AI player, referee Algorithmically intensive Anti-chess tournament

Choosing Your Project Preliminary descriptions will be posted on April 1 People without a group should indicate their preference by this afternoon to help us assign groups will be sent to the class soon

True Subtyping Substitution priniciple Subtypes must be substitutable for supertypes The rep invariants and specification constraints of the supertypes must not be violated by the subtypes Subtypes may have more methods and properties so long as they abide by the substitution principle.

Subclassing in Java Pure implementation inheritance Does not worry about the behavioral constraints

Problems with subclassing Break encapsulation May lead to abuse: sub-classing things that are not subtypes (e.g. Stack extends Vector) Should only be used when a true sub- type relationship exists

Example class IHashSet extends HashSet { private int addCount; … public void add(Object o) { addCount++; super.add(o); } public void addAll(Collection c) { addCount += c.size(); super.addAll(c); }

Example class IHashSet extends HashSet { private int addCount; … addCount … public void add(Object o) { addCount++; super.add(o); }

Composition and Forwarding Composition: A class that contains another class (a wrapper) Forwarding: A class that calls methods of the other class that it contains No longer a subtype; rather, it is a different implementation of the same interface IHashSet extends Set vs IHashSet implements Set Gives programmer more control with method dispatching (vs Java’s default) Drawback: more code; less efficient (added level of indirection)

Example class IHashSet implements Set { private HashSet s; private int addCount; … public void add(Object o) { addCount++; s.add(o); } public void addAll(Collection c) { addCount += c.size(); s.addAll(c); }

pset 6 Design, implement GUI and then integrate it with your backend Testing GUI Use state machine to model GUI events Decouple GUI testing from backend testing Insert println statements before and after you call backend API method or, create a dumb backend “stub”

State Machine Directed graph: nodes represent a state and arcs represent a transition (action) caused by an input (event) Initial Portfolio Name Input Add Portfolio Button Pressed

Testing Excite all transitions with all boundary inputs (e.g., adding a Portfolio with new name, with an existing name, etc.) GUI should handle exceptional inputs (e.g. entering alphabets instead of numbers for number of stocks to purchase)

Integration Testing Repeat your GUI test (using the same input values from your backend tests if possible), and check if your program still works! Hopefully, you will have repChk() in your backend to catch your bugs.