Homework 1

Homework 1 consists of answering the questions below and submitting your assignment to the moodle as well as bringing a hard copy to class for peer review. This homework is worth 40 points (10 points for each question).

  1. 1. Provide definitions for the following terms.
    • abstraction
    • encapsulation
    • cohesion
    • coupling
    How does each of these terms apply to the object-oriented notion of a class? Provide examples of both good and bad uses of these terms in the design of a class or a set of classes.
  2. 2. A company has asked us to design a payroll system that will pay employees for the work they perform each month. Using a level of abstraction, similar to that shown in Chapter 1 of the textbook and as shown on slide 4 of lecture 2, develop a design for this system using the functional decomposition approach. You can assume the existence of a database that contains all of the information you need on your employees. For your answer, first describe the functional decomposition approach, discuss what assumptions you are making concerning this problem, and then present your design.
  3. 3. Now develop a design for the payroll system using the object-oriented approach, keeping in mind the points discussed on slides 24-27 of lecture 2 as well as the discussion in Chapter 1 of the textbook. Identify the classes you would include in your design and their responsibilities. (As before, you can assume the existence of a database and that you'll be able to create objects based on the information stored in that database.) Then, identify what objects you would instantiate and in what order and how they would work together to fulfill the responsibilities associated with the payroll system.
  4. 4. Write a simple OO program that implements the Shape example discussed in Lecture 2 on slide 4 but using an OO design rather than the presented functional decomposition solution. Your program should simply print out (to the console) the number of shapes in the “database” and then ask each shape to “display itself” which will also cause a line of output to be generated to the console, one for each shape. The word “database” is in quotes in the previous sentence because you should not actually use a database to write this program. It is perfectly acceptable for your main program to create a collection of shapes before moving on to sorting that collection and displaying the shapes. Your program should support circles, triangles, and squares but should use polymorphism so that the main program doesn't know the type of shape it is dealing with, but instead treats shapes uniformly (similar to the example program in Lecture 2 that involved different types of students). You may use any OO language that you'd like to write this program, just be aware that the grader may have to meet with you if you use a language that she doesn't have access to.)

Notes on Grading: One aspect of grading in this class is related to your thoughtfulness and your completeness in answering the questions above, along with the overall quality of the work you submit. Do not go overboard in developing answers for these questions, but, on the flip side, don't take short cuts or turn in incomplete work. If you have questions, don't hesitate to ask me questions via e-mail.

Due Dates: Homework 1 is due by class on Thursday, September 6, 2012. Any homework submitted after that time but by 12:30 PM on Thursday, September 13, 2012 will be graded but will receive a 15% penalty. After that, submissions of Homework 1 will be ignored.

Group Work: I strongly encourage you to start forming groups to work on homework assignments. When working in a group, it is “ok” to assign each problem to a different member of the group to work on individually but you should make sure that you come together as a group at least once to discuss all of the answers and to ensure that a high level of quality is achieved in each answer. You also want to ensure that you understand the answer to each question because similar questions may arise on the midterm and you will ultimately be expected to demonstrate that you personally understand the concept or technique involved.

Having said that, in-class students can work as an individual on this assignment if you want, though you will eventually need to join a team for work on the semester project later in the semester.

With respect to CAETE students, I expect that you will be working individually on all assingments. If you are a CAETE student but desire to work on a team, let me know and I'll do what I can to facilitate connecting you to a group of in-class students.

Any questions? Send them to me via e-mail.


© Ken Anderson 2012