The problem is that every workout can be different. Even if the person is doing the same thing. Such as riding a bike. You can ride a bike for leasure but others will ride for time and traing purposes or warm up for the main excersise! Same goes with weight lifting. You can weight lift for X amount of reps or weight lift for a certian amount of time, depending on what the coach orders up. Also, my coaches have about 1000 different types of weight lifting exercises and many different variations to them.
So I am at a loss where to start with an OO diagram.
It seems as if this might fit a decorator pattern? The base is a workout then the person can plug any number of exercises in the workout object?
How do I instantiate a workout that has 5 different exercises versus a workout that has only one workout (riding a bike)? Do I have to have 1 Billion Constructors?
What about each of the variations, ie pushups versus one-armed pushups? Two seperate Objects?
Any articles etc would be very helpful.
Thanks in advance.
Bryan
Guest UserPosted Jan 6, 2008, 7:13 PM
You could have a Workout object that contains a Collection of objects that are subclassed from a generic Exercise object.
The Exercise object could contain those properties and methods common to all exercises (time, # of reps, etc.) and then each subclass (i.e. PushUp, WeightLift, Jog, StairMachine, etc.) can each have their custom properties.
Instead of two separate PushUp objects, just create one and use a property to set the type of pushup (one-hand, two-hand etc.)