Class Design: Abstraction - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Class Design: Abstraction

Description:

Class Design: Abstraction. Datatype classes. Abstraction. Reducing to only the fundamental aspects. ... abstraction doesn't represent anything. Example: ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 7
Provided by: jacobh
Category:

less

Transcript and Presenter's Notes

Title: Class Design: Abstraction


1
Class Design Abstraction
  • Datatype classes

2
Abstraction
  • Reducing to only the fundamental aspects.
  • What makes a chair a chair?
  • What makes a clock a clock?
  • What makes a location a location?
  • What makes a task a task?

3
Two types of classes
  • Datatype class
  • blueprint for objects
  • abstracts some concept
  • Examples DrawingTool class, SketchPad class
  • Procedural class
  • just holds methods
  • like a machine
  • no abstraction doesnt represent anything
  • Example DrawHouse class

4
Example Datatype class
  • What is an appointment?
  • How can we abstract an appointment?

5
Example Datatype class
  • public class Appointment
  • private int year //2007, 2008, etc.
  • private int month //0January, 1Feb, etc.
  • private int dayOfMonth //careful with this!
  • private int dayOfWeek // 0Sunday, 1Monday,
    etc.
  • private int startHour //military time 0 23
  • private int startMin //0 59
  • private int endHour //military time 0 23
  • private int endMin //0 59

6
Example Procedural Class
  • public class CalendarInterface
  • public void processAppointments()
  • Appointment app new Appointment(2007, 10, 3,
    1, 13, 0, 14, 0)
  • public boolean validateAppointment()
  • Appointment app calendar.getAppointment(4)
  • public boolean updateAppointments()
Write a Comment
User Comments (0)
About PowerShow.com