Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Exploding Kitty Kats
Going from M1 to M2 ....
Our Milestone 2 was an extension of M1–a Simple Drawing Editor. M2 added the following functionalities (in a nutshell):
- In addition to drawing a line, rectangle, and circle, we were required to draw an ellipse and a polygon.
- We also had to be able to move, resize, and delete objects.
- Buttons should be selected when clicked on it and should remain selected until the shape is drawn or another button is selected.
- We had to be able to export our image into a jpeg file.
Since M1 was an individual assignment, each member in our group had their own idea of designing and implementing this project. Here, I am going to lay out the modifications as well as the new concepts we decided on:
Firstly, most of us had one class for M1 (which was the God class). We had to figure out a better way of dividing the responsibilities of each task. Hence, we came up with several other classes. We had a separate class for the view (GUI), a separate class for handling events (MyEventHandler class which inherited from Squeak's EventHandler class), a Shapes class, a MyMorphs class, an EllipseMorph2 class, a CircleMorph2 class, a RectangleMorph class, a PolygonMorph2 class, and a LineMorph2 class (later, we realized that this naming convention was far from perfect! And we ended up changing them in M4 to make them more concise and clear).
Secondly, in M1, a lot of us copied code around and thus, when we came to M2, we realized right away that inheritance would be the perfect solution. Hence, we implemented a MyMorphs class and all the other morphs inherited from this class. We also realized that all of the shapes except for polygon required the selection of only two points, whereas for a polygon, several points could be chosen. Thus, we had one method, getPoints, and this method was overriden by the PolygonMorphs2 class.
Undoubtedly, the task that took us the longest was figuring out a way to make a halo come up on the shape when it was clicked. This halo would then be used to resize the shape. Our first approach was to try to modify Squeak's Halo class but we finally gave up on that. We realized that making our own halos would be more feasible for us and thus, we ended up doing just that.
We tried to make our design such that very few, if any, modifications would have to take place in order to add other tasks to it. We realized that though our design was not perfect, we didn't need to modify it much for our future projects. This was a big plus point for us! It saved us both time and effort, and it gave us more confidence in our design!
Link to this Page
- Cases last edited on 30 July 2011 at 2:33 am by r59h132.res.gatech.edu