A Short Overview of Object Oriented Software Design

Demonstrated by implementing a Role-Playing Game’s classes

--

Introduction

Most modern programming languages support and encourage object-oriented programming (OOP). Even though lately we seem to be seeing a slight shift away from this, as people start using languages which are not heavily influenced by OOP (such as Go, Rust, Elixir, Elm, Scala), most still have objects. The design principles we are going to outline here apply to non-OOP languages as well.

To succeed in writing clear, high-quality, maintainable and extendable code you will need to know about design principles that have proven themselves effective over decades of experience.

Disclosure: The example we are going to be going through will be in Python. Examples are there to prove a point and may be sloppy in other, obvious ways.

Object Types

Since we are going to be modelling our code around objects, it would be useful to differentiate between their different responsibilities and variations.

There are three type of objects:

1. Entity Object

This object generally corresponds to some real-world entity in the problem space. Say we’re…

--

--

Stanislav Kozlovski
We’ve moved to freeCodeCamp.org/news

A generally curious individual — software engineer, mediterranean dweller, regular gym-goer and coffee lover