Index
Overview
Steps
Problem Statement
Methods Needed (To-Do List)
Crossroads
Look For Helpful Component
Circle Method Listing
Updated Design
Example Delegation for "moveTo"
Ideas Doc
Overview
The challenge is to come up with design ideas for a game graphic.
Steps
Problem Statement
We're to code up a GameGraphic.
It should have a simple circular shape.
It should be worth a variable
score
.
Methods Needed (To-Do List)
Here are all the behaviors it needs to have.
We have a lot of coding to do.
Crossroads
We are again at a crossroads.
Resisting the temptation to go code heads down, we take the detour down the road to look for code reuse.
Look For Helpful Component
We find a
Circle
class in our toolbox of available components.
We grab it.
Circle Method Listing
We look over the circle method listing.
Indeed, it will be helpful as it offers many of the behaviors we need to code.
Updated Design
Almost all of our methods are now
delegated
.
Only two methods are not delegated. We'll need to code those in the normal way.
Example Delegation for "moveTo"
This is what delegation looks like.
We are just passing the work to our child component.
Ideas Doc
The "Ideas Doc" completed for this example is shown below or
downloadable here...
.
Coding Fundamentals
Chapter 201 - Ideas-Mode (Code Evaporation)
Example 2
Search Site
Home
Back To Top