Object-oriented (OO) programming is a very powerful paradigm that may seem strange to students who have had previous experience with non-OO languages. However, the main ideas are based on intuitive concepts, and some “experts” think it is easy to grasp when students have not been “corrupted” with non-OO programming experience. Whether you have prior experience in non-OO programming or not, this lab will help your understanding of some of the key concepts of the OO programming.
You are probably somewhat familiar with the concept of configuring your PC to connect to a printer. Invariably, you have to install a “driver” - a software component that “hooks” into the operating system. Any software program running on your PC, such as Word, Powerpoint, or Internet Explorer, uses the driver to command the actual physical printer what to output - whether text or graphics.
Before the days of inkjet and laser printers, Line Printers were used to output simple text, and Pen Plotters were used to output simple graphics. You can view a YouTube video of a Pen Plotter in operation here (or just search “pen plotter”).
Building upon the concepts discussed in the introductory exercises of today's lab, design a “PlotterDriver” class. PlotterDriver objects (instances of the PlotterDriver class) can be directed to command a physical Pen Plotter device to draw simple shapes (such as squares or triangles), using a variety of different color pens, by moving the pen to specific x,y coordinates on the page. Don't worry about the low-level details regarding what has to go on inside the PlotterDriver class (like how the motors work) - just think about the commands that you'd want a program like PowerPoint to send to the driver.
In creating your class design, consider what instructions you would need to send to a PlotterDriver object in order for it to control a Pen Plotter to draw a blue square and a red triangle. If you're not sure, ask!
If you have any questions, always ALWAYS ask!