Which pattern did you choose?

Object Pool Pattern

Why did you choose each pattern? (Justify your use of it).

I was initially uncertain as to what pattern to choose and was going to incorporate the singleton and the private data class pattern, which I partially did, but as was programing the doors for my game, I came to the realization that the object pool pattern worked really well as an efficiently way to manage when the doors were activated and were the doors were going to go.

The object pool pattern takes multiple instances of an object or in this case my doors and has them reused by some sort of management program, in my case the map manager itself. The map manager then tells them to activate or deactivate if a room is adjacent to the current room on all sides and tells each door where to go if the player uses them. The object pool works most efficiently when there are few instances of reusable objects. So, in my case because the rooms never change size and there are always four walls, I have only four doors spawn in the four needed locations at the beginning of the game and activate or deactivate them when needed my the map manager. Those four doors are then reused over and over again by my map manager making my feature generally speaking quite efficient.

Draw the class diagram for your pattern(s):

Source Code
Based off
Object Pool Pattern

Would something else have worked as well or better than this pattern?
When would be a bad time to use this pattern?

The doors in Grombo’s Bad Day in their current implementation I do not believe could be seen as any other pattern, but there are lots of patterns that could have been used if I took a more traditional approach to them.