Object oriented programming has been quickly adapted by Computer Scientist as yet another method for approaching a programming problem because it allows you to model the real world.
Our Newspaper assignment presented us with an opportunity to test our ability to model our solution after the real world. As I describe our design process, I hope to clearly illustrate how we accurately modeled the real world and to demonstrate how we applied the concepts behind Object Oriented Analysis and Design. It is our hope that having a concrete example of design process will aid with your future analysis/design endeavors.
Before completely understanding the specific problems our solution would have to address, the Coredumps conferred on a working model for a generic newspaper. We decided to have the following classes:
At the time, our design seemed logical and we were confident that we would be able to solve any problem using this base design as our foundation0. However, as we soon found out, it was inadequate and would not fulfill the requirements as described in the milestones. On the other hand, brainstorming of this nature may help in future design because the programmer is aware of possible solutions to problems he may encounter.
What we needed to do was thoroughly familiarize ourselves with the problem we were attempting to solve before doing any design at all. Put in OO termsÖ always start the OOD stage with a solid OOA foundation.
After understanding the problems we would have to address, we came up with the following conclusions:
After revising the object oriented analysis as described above, we came up with this design. Note that our model and view are separated. One major flaw with this design is flexibility. It was not easy to add more news sources because they were basically hard coded in. Nonetheless, this design did not thoroughly address an acceptable way to implement the reporters
Thus, it was necessary to revisit the object oriented analysis stage before we proceeded with development.
We realized that in order to model the real world, we should have separate reporters for each source. After all, an ESPN reporter would be more knowledgeable about sports than a CCN finance reporter. The Coredumps (signal 11, bus error and myself (seg fault)) decided to implement a reporter for each source. This gave us a practical advantage from a coding perspective in that we could customize each reporter to handle a specific task. However, a downfall was that we had an unreasonable number of classes (24 in all) which basically performed the same task using different algorithms. Nonetheless, we decided to continue with this design decision. However, we DO NOT recommend it because it does not promote reusability. On the other hand, it proved beneficial because we were able to easily adapt our reporters to specific tasks as will shortly be explained. In spite of these drawbacks, we had a design which would allow up to address a partial solution to our problem and provide a template for us to begin coding. Please feel free to critique our new design.
After implementing our new design we were able to successfully generate the liner text file.
Once again we found it necessary to revisit the OOA stage. In order to implement a web based version of our current interface, we needed only modify our reporters to generate an HTML story rather than a text story. Because we modeled the real world when designing our original newspaper, we were also able to reuse a lot of our code when designing our HTML newspaper.
We have not completed this project to date and so we are currently updating our design to allow up to implement a solution which shows good design.
In summary, we hope to have shown the following:
¸ Have a clear understanding to the problem before starting any design.
¸ Once you have started design, it is okay to return to the analysis stage as many times as necessary.
¸ Modeling the real world allows for code reusability.
As a side note we would like to point out that modeling the real world while in the analysis/design stages allowed us to easily distribute responsibility among programmers once development started.