While we don’t have plans for this, the good news is that I’m covering this course as well as the RPG series, and am more than happy to assist and answer questions involving integration for students interested in blending the two.
Ooh, I like this idea a LOT
Easy stuff to integrate. I’d suggest giving it a go, and ask questions as issues arise.
Discuss? Certainly. Agree? No, and that’s ok!! Hugo and I have competing philosophies on both Singletons and Namespaces, but that doesn’t actually mean that either of us are wrong, just that we use different tools to achieve the same result.
In the case of Namespaces, the project in this course is small enough that namespaces aren’t necessarily helpful. The RPG course is massive, so we introduced namespaces early in the course, knowing that the four or five namespaces in the first course balloons into a couple dozen by the time the project is done. The RPG series is actually the only one in our catalogue that emphasizes the use of namespaces. I think, when integrating the two projects, that it’s beneficial to apply namespaces.
Singletons have been a point of debate since the dawn of OOP, and have been hailed as both the perfect solution for global state problems to an actual article entitled “Singletons are Pathological Liars” (I kid you not, Google it). We’re not going to solve that debate here. The fact is that sometimes Singletons are necessary. To prove it, I’ll point back to the RPG course. In that course, as well as the Design Patterns course, there is a lecture “Better than a Singleton”… I’m going to let you in on a little secret: The PersistentObjectsPrefab in the RPG course is a Singleton.
Singletons do come with some inherent problems that need to be addressed. It’s harder to spot cross dependencies when using Singletons, and execution order can be an issue (you’ll note that Hugo tackles the execution order issue in this course). I have a version of this course that I wrote without a single classic Singleton, but even then, I needed to use static events to make it work, and static events are actually an object shared by all instances of a script, and are technically… Singletons. Sometimes, you just need them in one form or another. Am I recommending that everybody here ditch the Singletons as Hugo is using them? Absolutely not! It’s quite the undertaking, and in the end, I don’t know that I realized any benefit in my version of the game besides being able to say that I did it.