Hi I am reading Head First Design
Pattern book and learning what is Strategy pattern.
I have changed the example given in the book and applied it to a RaceCar. Here is my thinking...
To apply strategy pattern for an abstract RaceCar class first I need a reference in my RaceCar class to a Moveable interface. I draw it to explain my confussion easily for ranchers....
I need to give Move capability to my racecar with the help of an interface and the concrete classes should provide me this functionality. However my confussion is that are these concrete classes (? ones) be related to directly racecar. For example BMW move or AUDI move or they should be general and can have functions that take RaceCar instance in it?
Which solution is the best ? How can I design a racecar that its move cabability can change easily ?
My question is; Are these strategies can be more specific to the real objects(BMW Move)or they can be applied many objects (MOVEIT class) easily ?