Recipe for success

1) write out your code on paper.

 2)Create your superclass’s and your subclasses, and figure out what’s special about each subclass. 

3)figure out what varies, and apply them to an interface, creating classes for each different variation that will implement the interface.

4) Create the necessary methods, remembering the empty body abstract methods in the superclass,  and the variable methods that will be overridden in the interfaces implementers.   

5) Create reference variables in your superclass

6) allow your reference variables to allow you to delegate method calls to the behavior (your interface classes) thus your actuall subclasses do very little work.

7) if necesarry, you can create set methods, which will take in a new behavior and reference to a new class. This allows you to set behaviors and changes in general dynamically as new subclasses are thought up and set up.

8) put it all together, and voila, you have a program that is organized to allow expansion and all around change.

6)

Advertisement

2 Responses to “Recipe for success”

  1. Hi Trevor,

    Most of your recipe is good, one thing I can’t understand why “write out your code on paper”?

    Chen

  2. trevmeister Says:

    um, to elaborate, writing your code down on paper, at least in psuedo code form, really helps makes sure that your logic and approach are correct, get that right, and your golden, just need to translate your intentions to java then.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.