Low Level Programming Session Summary
22nd September
This session I started out knowing little about modularisation and class structures. Granted, we had done classes in the past, however inheritance and modularisation was still a very abstract concept. I certainly knew that modularisation helped clean the code, but I didn't quite see how much it could be effected with the use of classes. I now know that in order to keep my code clean and running well, I should try to use modularisation.
Inheritance I also knew only the theory side, however now I can see and start to build on my knowledge using this inheritance approach to avoid recycling unnecessary code. It also means that I can closely relate and group game objects. I can manage the game objects and use functions and variables of other classes, helping to create a more general template for objects.
I now know about Virtual Functions, which are unique functions which are used in inheritance. They are defined in the derived class and passed on to each of its children. A virtual function is a generic template for a function, however it can be modified in each of the class' children, allowing you to change that function slightly in order to better fit that specific scenario.
Cohesion is an important factor when defining classes. In order to ensure cohesion, each class should only be doing things that relate to their game objects. Hacking things in is not a good idea, a character should not be responsible for the rendering etc. Keeping cohesion means a class structure does not get needlessly complicated or messy, everything should only be doing what it specifically relates to.
I also recapped on private and protected variables. Public variables are able to be used by all classes, protected variables are only able to be used by the class and their derived children, private variables are only able to be used by that class.
Looking forward to next week and seeing what else I will learn. I certainly found this session helpful, especially as we could recap classes. They were a little fuzzy in my memory before this session, but now I remember it clearly.
No comments:
Post a Comment