Académique Documents
Professionnel Documents
Culture Documents
Methods
Software Design
Old problems
Before OO, many languages followed the procedural
paradigm
A program was based on functions that worked like static
methods in Java
A main function started things
functional decomposition
Break problem down
Function deals with subproblem
Hierarchical. Levels of abstraction
Problems:
Functions:
What we call them:
functions, methods, modules
Functions are a core construct in OO and
non-OO programs
Principals of good functions apply in either
language
But less of a problem in OO can you think
why?
Some rules?
Returning Errors
Return value? Output argument?
Burden on caller?
Classes
So far weve just talked about objects
We note that many objects are a
type of the same kind of thing
The same abstraction
E.g. 1, 2, 7 and 10 whole numbers
E.g. 1, 3.5, 25, pi numbers
Bob, Sally, Joe Students
But, they are Persons too, arent they?
Classes, Type
Classes define a set of objects with the same
properties (state, behavior)
A class definition serves as a cookie cutter for
creating new objects
Instantiation of an object of a certain class
In Java, we do this with new and a constructor is
called
Creates an individual object, also called an instance
Class Identification
What are possible classes here?
Why?
<your answers here>
How do you recognize classes?
What makes a good class name?
Class Relationships
Do any classes have structural links
to other classes?
link might mean part-of relationship.
This is a static relationship
Are such links one-to-one, one-to-many?
Relationships
Static connections to other objects
Dynamic interactions with other objects