Advertisement

Comment on wrapper for memory management functions

Started by October 30, 2016 07:28 PM
10 comments, last by Alberth 8 years ago
Thank you for the input.
I am writing a game engine as a school project. One of the main objective is to design something that is extensible; efficiency is towards the bottom of the totem pole (largely immaterial but not completely irrelevant)
My rationale for creating the PMemoryBase class is to show that I foresaw the need for custom memory management. Does this make sense?

I am writing a game engine as a school project. One of the main objective is to design something that is extensible
Fair enough. Unfortunately for you, extensibility in the real world has a lot more sides than they teach in class.

My rationale for creating the PMemoryBase class is to show that I foresaw the need for custom memory management. Does this make sense?
To me it doesn't, but I don't do your school project nor do I grade your assignment, so my considerations are fully irrelevant for your problem.

I think you are right that a game engine may want custom memory management. However, I would argue that C++ itself already provides the hooks that you need, at least for some forms of extensibility. (Your PMemoryBase class proves that, in fact, if C++ would not be extensible, you would not be able to do what you did with PMemoryBase class.) As such, just using C++ already gives you the extension option, you don't need to do anything for it, ie you don't even see it in the code.

Another form of extension is refactoring. We don't design everything up-front, and then simply extend the relevant classes when needed. Instead, we don't know what features will be needed, so we don't design for them. When we find new features are needed but they don't fit, we modify the code by refactoring, such that the new feature gets a proper place in the entire system.

So while all the above (and more) are valid forms of extending a program in the real world, they may not count as such in your school project. I would advice you read carefully what kind of extensions count as 'extension' in your project, and try to find a few examples of that, which gives you a good grade. (And if PMemoryBase class works for that, use it.)

This topic is closed to new replies.

Advertisement