CS3340:   Intro OOP and Design

 

OOP Design

Example Architecture

Example - Login App

Design Stages/Steps

     Analysis

  1. Requirements Analysis
  2. Identify Business Objects
  3. Diagram/Prototype GUI

    Design

  4. Design Classes for Business Objects
  5. Design Class for Data/Database
  6. Design Classes for GUI


    Implementation


  7. Plan Coding and Testing of Classes
  8. Code Classes
  9. Test Classes



    Deployment

  10. Document Application
  11. Deploy Application

 

Think Object Oriented

Build hierarchies of classes.

Abstract the essence of related classes by identifying where they have common responsibilities -- where they do the same thing, but do it differently -- same "what", different "how".

Look for opportunities for the classes to use polymorphism to implement the same responsibility differently.

The new parent classes may be abstract classes. That is, no actual objects may ever exist of that type. The abstract class exists to link together similar concrete types of objects.

 

ATM example: Create an abstract class Transaction that is a superclass for Withdrawal, Deposit, etc. It can have an abstract responsibility "execute a financial transaction", that is implemented differently for each subclass.

Hierarchy Identification Tips

 

1. Explore is-a ("kind-of") relationships.

ATM example: Withdrawal is a (kind of) Transaction. Withdrawal is not "part of" Transaction.

2. Name key abstractions.

3. Separate mixed classes where necessary.

4. Place super/subclass sets in hierarchies.

5. Look for reusable behaviors

reuse existing patterns and frameworks

record new patterns and frameworks for reuse within project or in future

 

© Lynne Grewe