ATHENA
Object-Oriented Programming Foundations / Smart Reader
THE ATHENA LIBRARY

Object-Oriented Programming Foundations

Selam Tesfaye & R. Lindqvist · textbook

Chapter 1 · Thinking in Objects

Modelling the world

Object-oriented programming begins with a shift in perspective. Instead of asking which steps a program should perform, we ask which things exist in the problem and how they collaborate. A library system has books, members and loans; each becomes a class.

Objects combine identity, state and behaviour. A particular book has an identity (its catalogue number), state (on loan or available) and behaviour (it can be borrowed or returned).

Good object design keeps each class focused on a single responsibility. When a class tries to do everything, it becomes difficult to understand, test and change.

Fictional educational sample written for the Athena demo · Page 12 of 298.

25%saved