Low Level Programming Sessions Summary 9,
23rd November
This session we talked a lot about software design patterns and their implementation and use in coding structures. They are essentially just a tool used to create a solid and cohesive codebase. There are times that one should use them and there are times one shouldn't. If you overuse design patterns the code base can become bloated and complicated. Object orientated design is one such design pattern which enables the use of modularisation. Once more, it is a good idea but it can overcomplicate if overused.
Another software pattern we talked about was the use of a singleton. It ensures that the class only has one instance and it has all global variables. This can be quite useful if you only ever want a single instance to be created. It also makes the instance global which is bad from a cohesive standpoint. Making this a manager might be useful, but as always, global variables should be avoided unless necessary.
We also talked about the factory template which is essentially a whole class which is dedicated to making objects. It is divided into subclasses to decide what to make. It is essentially a tool which relates to a class or function which creates and allocates objects. They essentially load an object from a file and ID into the correct subclass, all objects are managed internally.
We also talked about other patterns like the facade. This is a pattern which essentially hides code from the user and allows them to implement basic functionality with little effort. All the hard work is done before hand. It is used a lot with libraries and is quite good if you're duplicating code. All of it can be wrapped up as a simple utility.
A game loop is perhaps the most easy one of these structures. It is essentially, a simple loop which keeps everything running. They are feedback loops which loop around and we can use multithreading to make sure that we loop around and wait for user input.
Overall, these design patterns look fairly useful, if situational. They all seem to be slightly flawed in some way or another which is odd. I will certainly try to implement one of these in my code, but again, I still have no real idea of where to begin.
No comments:
Post a Comment