Software Architecture is all about creating and using abstractions to describe what we want the hardware to do.
For instance, you probably don't even think about the abstraction provided by a simple function call like playVideo(introVideoAsset);
The playVideo
function hides away a lot of details about how to decode a video stream, how to render that to the hardware, and so on. But before you even get to that, the compiler is going to choose a register to place introVideoAsset
where the playVideo
function is going to read it; it's going to store the memory location to return to once the video finishes playing; and it's going to jump to the correct memory location for the playVideo
routine.
At the point where you're trying to play the intro video, you don't want to think about any of that, so you keep it all buried under several layers of abstraction.
Breaking code into classes has exactly the same aim: to allow you to express high-level relationships between different parts of your application. For instance, maybe you need to support loading multiple different texture formats, but you also need to support using a texture once it's loaded. If all the texture loading code is in its own class, you don't need to think about it when you're just using a texture; and when you are changing that class, you can see clearly which parts are "private", and can be changed without impacting other code.
The more code you have inside one function, or one class, the harder it is to reason at a high-level about that function or class. In an ideal world, you can just look at the name, and know immediately what its high-level purpose is. At the other extreme, a class called "Utilities" forces you to look at the list of methods it contains, because the name gives you no clue.
it’s difficult to tell what should and shouldn’t be put into its own class
Yes, this is fundamentally a difficult problem. There is no perfect level of abstraction; deciding how much to break things down, and how to track the relationships, is a skill and an art. Many books have been written about approaches and patterns which people have found helpful, and there are many debates about which one is best in which circumstances.
You will find that sometimes you break things down in a way you hope will be helpful, then find it makes your life harder, and have to decide whether to go through the pain of rewriting it, or live with it. Don't be discouraged and think you're doing something fundamentally wrong; just keep learning from those mistakes, and seeking the right balance for your particular situation.