Object Oriented Design
Object Oriented Oriented Object Design Design
L
U
niversal
Object Oriented Design is the creation of objects in such a way that they fit perfectly into the game environment. Object Oriented Design has a 3 step set of instructions to the creation and use of an object.
M o d e l l i n g
The first step is to design the object, it’s position, size and what it does. The second part is to code the object so it works like how it was designed. Once these steps are completed, the final step is to build the rest of the game.
anguage
Each object has two parts, and these parts have different names but mean the same thing. These parts are Variables and Methods OR Properties and Actions OR Data and Code. Variables and properties are what an object is such as position and height. Actions and methods, or behaviours, are what and object does such as moving or attacking the player. Objects are an instance of the class, and classes are the definition to create objects. An object can only exist when the game is running, and when code is being written that is working on the class. Bringing variables and methods together to make the object and create the class is known as the UML or Universal Modelling Language. UML is used whenever focussing on Object Oriented Design.
Inheritance not the money kind $$$ $$$$
A time saver for programmers focussing on Object Oriented Design is inheritance. This is the ability to create new classes from already existing classes. It helps programmers save time as they can use an already existing class that does 80% of what they need and write the 20% of the code that they need to add.
Existing and new classes, like objects, come in two parts. These are Super and Sub classes OR Base and Derived classes OR Parent and Child classes. Common and shared variables would belong to a parent class whereas unique and specific variables would belong to a child class. Inheritance reduces the amount of code a programmer writes.