2026-07-27
In case you missed this week’s video, I covered the 3 tenets of object oriented programming. Here it is:
Now for your homework…
RECAP
So you just learned about the 3 tenets of object oriented programming. Here's a quick refresh:
Inheritance is inheriting the state, properties, and behavior from a more abstract parent class.
Polymorphism is an abstract or virtual method or property exposed by a parent class that a more specific, derived class can implement, override, or extend.
Encapsulation is hiding the internal state and behavior of a class so the user/consumer doesn't need to know how it works in order to use it.
HOMEWORK
Estimated completion time: 1 to 2 hours.
You're building a rudimentary game engine for 2D fixed area games. Game developers will use your game engine as the foundation for making their artistic 2D simpleton games come to life.
Think 80s style retro games…

Your first task is to provide a way for users to create different shapes that's extensible and robust. You will offer 2 basic shapes out of the box: a rectangle and circle.
Users need the ability to position the shape within a 2 dimensional space and change the position to create movement. In addition, they need to be able to set and change the dimensions of the shape. Finally, users need to calculate the area the shape takes up.
You'll need to make decisions about how the shape's position works. For example, for the rectangle, will you use the top left corner as the position, bottom right, or some other method?
You'll also need to decide what the shape's dimensions mean, considering the variation between shapes. For example, a rectangle has a length and a width, but a circle only needs a radius. How will you implement and communicate that to the user?
For now, don't worry about rendering or implementing collision detection or any other game engine basics. The end users just need a way to manipulate shapes and implement their own if they desire.
Use the 3 principles of object oriented programming as a guide: inheritance, polymorphism, and encapsulation. You're free to use whatever OO programming language you want…except fucking python! Please for the love of god, not python!
Please don't put your code in a public repo or otherwise make it available on the innerweb. Treat it like it's proprietary that you may, one day, sell to the hungry 2D fixed area game shops.
You can email me your finished code at [email protected], or ask a clarifying question. Depending on the volume of responses, I will offer feedback, and may even make a follow up video highlighting your excellent 2D game engine solution. Just be sure to include how to setup an environment to build and run the damn thing.
I will NEVER do a "tear down" or "public humiliation" of your code, because that doesn't help anyone. But I will give brutal feedback to you and only you to help you improve your programming skills. So do your worst!!
Ok, that's it for this week. See ya next time.
Analog Aron
Don't miss what's next. Subscribe to Aron's I Hate Computers Weekly: