Do you see any objects that we can use in our OO model for the equation editor?.Now try to answer the following questions: Let's first have a real deep look at a couple of equations typeset using Math Editor: It is time to turn to the specific case we have decided to tackle and see if we can find our objects and their responsibilities and relationships. You may even need to experiment with a few different models before you decide which one to pick! Designing the OO Model for the Equation Editor The only good strategy in such cases is to give yourself a bit of time and keep looking for the invisible objects and the links between them. Even the best of the best can find themselves quite perplexed at times (ask the MFC people!). Sometimes the boundaries are so blurry that we have hard time figuring out how to devise a convenient OO model. Do the inheritance chains in those platforms really represent a natural underlying system? Did they just pop up from a real existing hierarchy or you think there was some effort needed to build them the way they are? I am sure the answer is obvious to you! However, we are not always so fortunate to have that kind of natural inheritance hierarchy in real world problems. The following figure is a typical example of such a case:Īs we can see, the relationship chain given in the above figure is quite natural and there is hardly any effort required on our part to define it. In a typical example found in text books the objects are almost clearly visible and there is hardly any work needed to define their roles and responsibilities. The biggest challenge in OO design and programming is identification of objects and inheritance and delegation of responsibilities to different classes. Only finishing a few examples given in the tutorials and books is not really sufficient as the examples presented there are usually very superficial. The best way to learn OOP is to apply the techniques in real programs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |