Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Coding 8 David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. Object-Oriented Design Examples.

Similar presentations


Presentation on theme: "Java Coding 8 David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. Object-Oriented Design Examples."— Presentation transcript:

1 Java Coding 8 David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr Object-Oriented Design Examples

2 IMPORTANT… Students… This presentation is designed to be used in class as part of a guided discovery sequence. It is not self- explanatory! Please use it only for revision purposes after having taken the class. Simply flicking through the slides will teach you nothing. You must be actively thinking, doing and questioning to learn! Instructors… You are free to use this presentation in your classes and to make any modifications to it that you wish. All I ask is an email saying where and when it is/was used. I would also appreciate any suggestions you may have for improving it. thank you, David. David

3 Alarm Clock As an example of Object Oriented Design

4 Product Idea… An alarm clock! Brainstorm requirements… Design User Interface… Detailed Design… Implement & Test…

5 Brainstorm requirements… Show time – hours/mins/secs 12 hour (am/pm) and/or 24 hour format Set alarm time – hours/mins/secs Disable alarm Stop alarm ringing Snooze option Multiple alarms, with different sounds Text description for each alarm International offsets for travelers Show alarm time – hours/mins/secs Set time – hours/mins/secs

6 Design User Interface…  12 : 03 : 10         

7 A Simple UI

8 MVC - Design Pattern View model controller View Multiple Views 14:30 Half past two hours: 14 mins: 30 secs: 25 1 sec. timer Reset

9 MVC – Alarm Clock 14:30 Alarm: 14:30:00 1 sec. timer Menu setTime setAlarm turn on/off hours: 14 mins: 30 secs: 25 Msg: Wake up! Status: On hours: 14 mins: 35 secs: 00 Wake up! Alarm Ringing Alarm: 14:30:00 Wake up! Alarm Settings 14:30:00 Clock Settings

10 Alarm Class Constructors Alarm( Time, Msg) Alarm( Time) Methods isAlarmTime( theTime) getAlarmTime() setAlarmTime( time) getAlarmMsg() setAlarmMsg( msg) snooze() isOn() setStatus( status) Alarm alarmTime alarmMsg status

11 AlarmClock Class AlarmClock time alarm Constructors AlarmClock() Methods turnAlarmOn() turnAlarmOff() isAlarmOn() setAlarm( time) setAlarmMsg( msg) setTime( time) ?getDisplayPanel() ?update() time.tick() & if isOn notify alarm listeners

12


Download ppt "Java Coding 8 David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. Object-Oriented Design Examples."

Similar presentations


Ads by Google