INFSY 535

Small systems

Larger systems
Planning,
design, and testing
1. Understand the program
requirement-what
Analysis
I/O is critical
3. Write and test
each part (unit testing)
implementation
2. Specify the solution-how
Model/design
(UML comes into
play)
4. Maintenance
deployment
The
Waterfall Model
what
how
Write
The
Spiral Model : deals with errors from
previous phase (Boehm)
Rational Unified Process
•
Development process methodology by the inventors of UML
Extreme
•
Programming
Focuses on best practices
•
•
•
•
•
•
•
•
Realistic planning
Small releases
Metaphor
Simplicity
Testing
Refactoring
Pair programming
Collective ownership
Continuous integration
40-hour week
on-site customer
coding standards
Levels
of Abstraction: Black Box
•
Interaction of a black box with outside
world is well-defined
•
Encapsulation
Big
Java by Cay Horstmann
Copyright © 2008 by John Wiley &
Sons. All rights reserved.
Encapsulation
◦ Blackbox concept
methods called
Interface
Data and method(s)
Hidden details
class
Effect(s)
A Class Example (from Chapter 3)

Behavior of bank account (abstraction):
• deposit money
• withdraw money
• get balance
Specifying
the public Interface of a Class
Methods
of BankAccount class:
•
deposit
withdraw
•
getBalance
•
Support method calls such as the following:
harrysChecking.deposit(2000);
harrysChecking.withdraw(500);
System.out.println(harrysChecking.getBalance());
Public Interface of a Class or
Method Definition
access specifier (such as public)
return type (such as String or void)
method name (such as deposit)
Parameters list (double amount,
double deposit)
 method body { }

Method Definition
Format
accessSpecifier returnType methodName(parameterType
parameterName, . . .)
{
method body
}
Method Definition
Example
Example:
public void deposit(double amount)
{
. . .
}
Public Interface of a Class: Constructor Definition
public BankAccount()
{
// body--filled in later
Javadoc
Method Summary
Model/design/represent the
solution?
Show class relationships









Class Diagram
Object Diagram
Use Case Diagram
State Diagram
Sequence Diagram
Activity Diagram
Collaboration Diagram
Component Diagram
Deployment Diagram



Rectangles
Three sections:
◦ Class/object name
◦ Class attributes (data)
◦ Operations (methods)
Arrows that indicates the
relationship
Class Diagram with Variables and Methods
Class Name
Visibility:
private -
Attributes/
characteristics:variables
public +
(chapter 3)
Methods/capabilities
Click on VISIO
 Select the Software Category


Visio Tutorial
Inheritance
Aggregation
Dependency
Relationships
Between Classes
Preparation:
◦ Verbally describe the situation (what)
◦ (How)
 Find objects (methods) that will be
part of model
 Describe properties of the objects
 Establish relations between the
objects
 Place the objects in groups
Terminology:
 Objects are abstractions

Objects are manipulated by classes
• May be 1 or many class instances
of any particular class/object.
• Each instance is instantiated.
UML
Relationship Symbols
Line
Style
Arrow
Tip
Inheritance-is-a
Solid
Triangle
Interface
Implementation
Dotted
Triangle
Aggregation-has-a
Solid
Diamond
Dependency
Dotted
Open
Relationship

Symbol
Aggregation is a stronger form of dependency-see page 467
 Establishes has-a relationship/association
between classes
 BankAccount
 One can navigate from one class to another
 instantiation in Java – (note NOT inheritance)
Arrow with diamond head: one class
uses the other by linking methods of the other class.
 The arrow indicates the direction of the aggregation
•
Place multiplicity notations near the ends of an
association.
Program
Exercises P3.1
and P3.2


Inheritance : allows a
developer to derive a new
class from an existing one
Parent class, or superclass, or
base class.

Thechild class or subclass.

Component hierarchy:
 Establishes an is-a relationship
between a more general class
(superclass) and a more specialized
class (subclass or base class)
Deposit
child
Is-a component of
BankForm
parent
Inheritance should create an is-a relationship, meaning the child is a
more specific version of the parent