Skip to content

Object-Oriented Modelling

Estimated time to read: 2 minutes

What is OOM?

When solving a problem, OOM involves the practise of representing key concepts through objects in your software. Depending on the problem, many concepts, even instances of people, places, or things, become distinct objects in the software.

Objects

Objects are all around us, looking around the room for examples... the following are all objects.

  • Tables
  • Door
  • Mugs
  • People
  • The room itself

Objects are a way of keeping your code organised, flexible and reusable. It keeps the code organised by having related details and specific functions in distance, easy to find places. This creates flexibility, as you can change details without affecting the rest of the code.

What does OOM look like

What's in the room?

Screenshot 2022-07-12 at 13.49.01.png Screenshot 2022-07-12 at 13.50.29.png

Consider the images above. The first object to identify is the room itself, the room has details such as the room number, the number of seats, number of tables, etc.

There are also objects contained within the room, there are many physical objects such as the chairs, the tables, the projector and the whiteboard.

Object details

Each of these physical objects could be represented by objects in software; there are specific details associated with each object. For example:

  • Projector
  • Resolution
  • Brightness
  • Dimensions

  • Chair

  • Dimensions
  • Seat Padding
  • Back Rest

Object responsibilities

Objects can also have individual responsibilities or behaviours. For example:

  • Projector
  • Responsible to power on
  • Responsible to take a video input
  • Responsible to display an image

OOM Example

Class / Object Attributes Methods
Person - Name - Age - Gender - Occupation - Write on Whiteboard - Turn on Projector - Sit on Chair - Open Laptop

In OOM, A person object knows their name. However, even inanimate objects know their information! For example, a chair knows its dimensions and its location; a door will know its frame height and the angle that the door is ajar; a whiteboard knows its height and width as well as if it is blank or contains writing.