This is not a current assignment. If you are currently enrolled in SE1010, do not do this assignment expecting to receive credit for it.

Lab 0: Introduction to Object Oriented Programming

Objectives

  • Identify the main features of the object-oriented programming paradigm
  • Identify the principal methods and attributes of a class
  • Sketch a UML class diagram, illustrating a class's methods and attributes
  • Sketch a UML sequence diagram, given the messages sent to an instance of a class

Overview

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”).

Procedure

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!

  • Sketch (by hand is good enough if you are neat, but you can use a program such as Powerpoint if you wish) a UML class diagram illustrating your class's methods and attributes.
  • Write the sequence of messages you'd have to send (via the methods) to a PlotterDriver object (give your object a name) in order to get it to draw a blue square and a red triangle (the dimensions of these shapes is up to you).
  • Sketch (again by hand) a UML sequence diagram illustrating the sequence of these messages; one sequence for each shape.
  • Show these sketches to your instructor.
  • Submit the sketches after your instructor approves them.

If you have any questions, always ALWAYS ask!

se1010labs/lab0.txt · Last modified: 2009/06/03 11:22 (external edit)
 

This website is not owned or managed by the Milwaukee School of Engineering.

© 2003-2010 Dr. Christopher C. Taylor, et. al. • Office: L-343 • Phone: 277-7339 • npǝ˙ǝosɯ@ɹolʎɐʇ • -> RSS <-