Logout

D—Object-oriented programming

D.1 Objects as a programming concept (6 hours)

The paradigm of object-oriented programming should be introduced through discussion and example.


D.1.1

Outline the general nature of an object.

 

Teaching Note:

An object as an abstract entity and its components—data and actions.

Familiar examples from different domains might be people, cars, fractions, dates and music tracks.


 

Sample Question:

sdfsdfsf

JSR Notes:

So from the teaching note - and projecting to actual code - we know that a "class" of objects is indeed defined by it's characteristics (its "data", or its "attributes") and the actions that act upon those attributes.

So with the general example of a person; every "instance" of a Person has:

- arms
- legs
- brain
- etc

and with them, they can:

+ wave
+ run
+ playBasketball
+ think

 

Taking one more of the examples above, a MusicTrack has:

- a length
- a singer/group
- a title
- a digital recording

and with them, we could:

+ output the length of the track
+ do a search through a bunch of tracks, coming up with all of the tracks of a certain singer/group
+ display the title
+ play the track on a device which can reproduce sound using digital files