Programming planning, setup and correct approach

Hey all

I got a question about programming.
I know how to program, learned it for some time now.
The problem i always run into is, i dont know how to actually plan a project or build it up so i always end up in a total mess of referencing classes all over the place to get variables.

So the problem is, i learned how programming works, but not how programming projects are made.

Does anyone know good tutorials, or other ressources which explain how this works?
What is the correct approach?
Why do i these operations in this class and not in an other class etc.

Thank you very much for your help.
best regards, Inmeining

Game Programming Patterns

this has helped me ^

it is hard to understand a problem described with jargon if you haven’t faced it yourself. Experience helps.

What is helping me a lot is to be able to answer a few key questions about each class.

  • What is it responsible for?
  • Who does it communicate with, and why?
  • What information does it require to operate?

In general, I am using interface for class->class communications. This way nobody needs to know about each other. In cases where one class is intrinsically tied to another, then I just make a hard reference because that is a little faster to work with compared to going through an interface.

When I am diagramming my communications, I try to make it all flow one way. Either a manager puts out info and it goes down to the minions who are listening, or the minions in the field report to some manager.

That’s simplified but the point is, I try to simplify communications such that each class is either a reporter or a listener, but not both.

I also caution against getting carried away trying to do things “correct.” You can never hold it all in your head. As long as there is consistency to your design architecture, I think that is as good as you can do - e.g. when you open the project a month later you cannot remember how things work, but you can easily remember the basic flow of information and which classes broadcast info, which listen and respond, and so long as you are following single responsibility the class name should be enough to remind you what it is responsible for (and thus where it’s scope ends).

Use grain of salt, I am not doing this very long and I don’t even write “real code”, just using blueprints. But this is general thought process that helped me wrangle my project into something much more efficient and easy to maintain.

I would strongly suggest https://www.amazon.com/Clean-Architecture-Craftsmans-Software-Structure/dp/0134494164

it is awesome book. If you follow S.O.L.I.D. principles, you will be on a good path.

1 Like

Thank you all very much for your answers.
I think, software architecture was the word i was looking for.
i bought now two books, the one @Bojann recommended is one of them :slight_smile:

Thanks again :slight_smile:

You are welcome. I just recently finished reading it and it’s really awesome. I am not sure how much experience you have, but his book Clean Coder is also really good one, that is recommended even to experienced developers.

One thing you should note is that everything explained in the book is like perfect enviornment, that will not be the case in your project. So don’t get demoralized if you don’t follow it all the time. Sometimes it’s just like that. But knowing S.O.L.I.D. principles in details, following them, will help you a lot. Combining that with Clean Archieteture is just a Win Win :slight_smile:

1 Like