lecture8

lecture8 - Monday, Feb 1st How to design an Object Oriented...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Monday, Feb 1st How to design an Object Oriented program Recursion One day A mad poet with little to say Gave a poem away That started: One day A mad poet with little to say Gave a poem away That started: One day A mad poet with little to say Gave a poem away That started: One day etc-Martin Gardner (famous mathematician) Object-Oriented Design So, how does a computer scientist go about designing a program? Mad EE scientist How do you figure out all of the classes , methods , algorithms , etc. that you need for a program? (Well, its not easy! Many senior engineers ar horrible at it!) At a high level, its best to tackle a design in two phases: First , determine the classes you need, what data they hold, and how they interact with one another. Second , determine each classs data structures and algorithms. Class Design Steps 2. Determine the outward-facing functionality of each class. How do you interact with a class? 1. Determine the classes and objects required to solve your problem. 3. Determine the data each of your classes holds and 4. How they interact with each other. An Example Often, we start with a textual specification of the problem. For instance, lets consider a spec for an electronic calendar . Each users calendar should contain appointments for that user. There are two different types of appointments, one-time appts and recurring appts. The user of the calendar must supply a password before accessing the calendar. Users of the calendar can get a list of appointments for the day, add new appointments, remove existing appointments, and check other users calendars to see if a time-slot is empty. Each appointment has a start-time and an end-time, a list of participants, and a location. Step #1: Identify Objects Start by identifying potential classes . The easiest way to do this is identify all of the nouns in the specification! Each users calendar should contain appointments for that user. There are two different types of appointments, one-time appts and recurring appts. The user of the calendar must supply a password before accessing the calendar. Users of the calendar can get a list of appointments for the day, add new appointments, remove existing appointments, and check other users...
View Full Document

Page1 / 66

lecture8 - Monday, Feb 1st How to design an Object Oriented...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online