An Ectropic Example: The clock, in ECode, ad nauseam

An Ectropic Example:
The alarm clock, in ECoDE, ad nauseam
• Order of Operations:
– I. Object Oriented Analysis (OOA).
– II. Object Oriented Design (OOD).
– III. Object Oriented Programming (OOP).
• This is a User Interface Walkthrough of the
ECoDE (pronounced “echcoed”) design
tool using the alarm clock example.
Starting ECoDE
From the workspace, type “EctropicDesign start.”
-Select new design.
The Main Window
Note:
-You start in
Analysis mode.
- In this mode,
you can create
new Scenarios
and CRC Cards.
New CRC
Cards
New Scenarios
Object Oriented Analysis
i.e. (Analysis Mode)
– 1. Create scenarios for use that satisfy specific
goals.
– 2. Brainstorm objects in the domain.
– 3. Apply responsibilities to objects (or several
objects via collaborators) that implement
scenarios.
OOA #1 – Create Scenarios
How will the alarm clock operate?
1.
Set the current time
•
•
2.
Update time
•
•
•
3.
User sets the time in the display
The internal time changes
Time advances one second
The internal time changes
The display updates
Change modes - Display the time in military or standard
time
•
•
•
User switches the display mode
The internal representation of time changes
The display updates
OOA #1 – Create Scenarios
How will the alarm clock operate? (cont.)
4. Create/Edit alarms with individual actions
•
•
Set the alarm time and action
Save the alarm
5. Execute alarms at the appropriate time
•
•
6.
When a second advances, check all alarms against the current
time
Execute all alarms that apply
Remove alarms
•
User selects the appropriate alarm and removes it
OOA #1 – Create Scenarios
1. Create a new
Scenario
New
Scenari
o
- Note: The naming
convention does not
allow punctuation in
most elements of
ECoDE
OOA #1 – Create Scenarios
2. Open the
Scenario, add
responsibilities
- Note: When you add
design notes, you must
save that screen with
“alt-s” or you will lose
your notes.
CRC Cards to
be named later
Design notes not
saved yet
OOA #1 – Create Scenarios
3. Finish all your
Scenarios
- Note: You can also
yellow button (“rightclick” in Windows) on
items for more
detailed menus.
“RightClick-Able”
OOA #2 – CRC Cards
(Brainstorm Objects)
Objects (post-filtering) for the alarm clock:
– Clock
– AlarmClock
– Alarm
– SecondsTicker
– Time
OOA #2 – Create CRC Cards
1. Create a new CRC
Card
New CRC
Card
OOA #2 – Create CRC Cards
2. Open the CRC
Card, add
responsibilities
-Note: These
responsibilities should
map to the scenario
responsibilities they
satisfy. In fact, you can
select the responsibilities
we created earlier in the
scenarios.
OOA #2 – Create CRC Cards
3. Finish creating
CRC Cards and begin
assigning
Responsibilities
-Note: “Time” became
“InternalTime” and
“Alarm” became
“AlarmSetting” because
ECoDE does not let you
create classes that already
exist in Squeak. You
could create the CRC
Cards, but you cannot
generate them.
OOA #3 – Assign
Responsibilities
1. Assign
collaborators and new
responsibilities to
accomplish our tasks
-Note: Because we add
“Execute all alarms that
match current time” to
AlarmClock, AlarmSetting
now needs “Execute alarm
action”
OOA #3 – Assign
Responsibilities
2. Break
responsibilities into
atomic units
-Note: “The internal
time changes” has been
divided into “Set time”
and “Set mode”. This
change was made in the
scenarios as well.
OOA # 3 – Assign
Responsibilities
3. Ensure that all
responsibilities in
the Scenarios have
been assigned to a
CRC Card.
-Note: We have
adjusted responsibility
names to reflect the
reduction into atomic
units.
Object Oriented Design
i.e. (Design Mode)
– 1. Assign method names to responsibilities.
– 2. Use ECoDE notes to build a UML class
diagram.
– 3. Check design integrity and make any
necessary changes.
OOD # 1 – Assign Method
Names
1. Switch to Design
Mode
Design Mode
Button
-Note: The color
changes.
OOD # 1 – Assign Method
Names
2. Open CRC
Cards and assign all
your responsibilities
a method name.
-Note: You will be
prompted for a method
category (within the
class) and a description
(general comments).
OOD # 2 – Build UML Class
Diagram
Use your design to build a UML Class Diagram.
-Note: This is a very limited design with glaring flaws. How would you design
the Alarm Clock?
OOD # 3 – Integrity Check
(Re)-Check the
integrity of your
design.
-Note: The most basic
checks will be made
when you switch to
Program Mode, but do
not rely on ECoDE to
find flaws in your
design.
Program
Mode
Button
Object Oriented Programming
i.e. (Program Mode)
– 1. Generate Classes and Method Stubs.
– 2. Ensure that you have met your design goals.
OOP # 1 – Generate Classes
1. Switch to
Program Mode
Generate
d Classes
-Note: (At the top) In
the left hand frame are
CRC Cards and in the
right hand frame are
classes that ECoDE has
generated for this
design.
CRC
Cards
OOP # 1 – Generate Classes
2. Select the CRC
Cards and click the
“Code” button.
-Note: You will be
prompted for parent
class and instance
variables.
-Note: I generated
“Clock” before
“AlarmClock” so I
could specify “Clock”
as the parent class of
“AlarmClock”.
“Code” this
CRC Card
OOP # 2 – Ensure Design Goals
At this point, you can
open classes, browse
classes, and open
scenarios within
program mode. This is
how you can make sure
the scenario
requirements are met
and the classes
implement them how
you want them too.
GOOD LUCK!!
Open
Class
Brows
e
Class