Is there such thing as having too many classes?

Godot Version

4.3

Question

I am still learning around in Godot, and with composite patterns, imagine a gun could be a pistol, shotgun, rocket launcher, etc. I have a feeling I will create many many more classes for different behaviors.

Normally, is there such thing as having too many classes? Is there a limit and is there anything to consider if having too many classes?

I dont think you should worry about that, but you can consider to resuse the same class for similar things by using export variables or using resources to alter the behaviour

2 Likes

In my experience, there is no such thing as too many classes. There is no arbitrary limit on how many classes you can create and use in a project, and generally your game (or application in general) can function just the same with few or many classes.

Classes exist to help you write and organize code, not to help the code itself run. That said, do me mindfull to create “good” classes by getting familiar with the classic OOP principles (DRY, KISS, SOLID, etc).

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.