Hi I am a student working on an application for my final year project. I am at the stage in my programming skills of understanding more than I can do! I have produced use cases and some class diagrams but am struggleing to understand how to find and use patterns in my design. I bought the Shalloway and Trott book and this has helped a bit but working on my own its hard to be sure if I have got something right or not. Are there any mentors out there who can guide novices like me into the world of pattern use?
When eating an Elephant take one bite at a time.<p>Ian...........
It is hard to mentor long distance and hypothetical. The best place to start is to know the patterns. If you know them you can very easily spot them. Factory/Observer/Iterator/Command etc are used all over the place. HTH Sanjay
I recently completed a course on OO design that included some work on patterns and frameworks but as Sanjay says when the work is hypothetical it is difficult to get a good grasp of the concepts. Could someone provide a concrete example of how one pattern would be used in practice? any comment is appreciated. scott
A common pattern I find effective is the Factory pattern. Basically, defer the implementation of a particular object to the actual creator at runtime. For example, say you have an interface representing a car. Your code will utilize this interface, but it may not care of its actual implementation (i.e. If it�s a 4 wheel car or 18 wheeler). In this case, you could use a factory to give you a particular instance of a car so that your code is plug and playable at runtime. Your code could say:
<code> Car myCar = CarFactory.manufacture(�FourWheelCar�); </code>
where �FourWheelCar� is a runtime creation of a class representing a 4 wheel car which implements the interface, car. You can see with some minor effort that your code is changeable with out recompilation.