Programming structure

Hello,

I´m searching for a book or an article, which describes, how a efficient and easy programm has to be set up.
I want to programm a game and it has already over 50 classes and structs. There are no compilition errors or sideeffects or memory leaks or any other error, because I consider a lot of OOP programming rules.
But, because of the fact, I´m considering all this rules, it is very hard for me to create new code and this is a huge problem for me.I have spend much more time reading books about programming than I have actually produced code.

Now I´m searching for a book or an article, how real Programmers are implementing there code. For example: I have never used a global variable in bigger programm, but if I would use one I coulde save a lot of parameters to a lot of methodes of classes and structs.
In many books and in university it is told, that avoiding global variables, is a very good thing, but for me it is only very very complicated to avoid global variables.

The only one, who is reading my own code, is myself, so there hasn´t to be considered so much rules of "good coding".

But I realy don´t know, how to create code, which is much more efficient and easier to produce.

It would be very helpfull to me, if somebody could give me an advice, how to write efficient ( and not readable code) and easy code or to suggest a book or an article.

If somebody wants to write about how greate readable code is, then he should not write this in this topic, because these wouldn´t help me.
I want to finish my programm and I don´t want always to think about: " Oh, is this code ok?"

If this text contains a lot of mistakes in spelling or in grammar, then I´m sorry, but I am not a native speaker and I my english grades were not so good.(actually the grades were very bad )
Last edited on
I would recommend you read design patterns and see which all patterns would fit into the kind of work/code you are writing. The book by gangs of four is a good book to start.
Also, before starting to code, it would be good if you do some high level design of what you would be doing. So some class diagrams and sequence diagrams can help. How different class would interact or communicate. Having a broad picture will help you to find out bigger issues early or any limitations which will come later in the middle of the work. All this should not be in depth but can be high level (HLD) and then you can make a low level design (LLD) from your HLD.

Design patterns are not always good to implement because they can generally be slow. Some design patterns can be complex and not easy to understand.

About globals, you can use them. Its not a rule that they should not be used. They should be used less because they can be confusing and are casues of some serious and untraceable bugs. They have more harm when the code is multi-threaded. But this doesnt mean, that they should not be used.

But if you feel like that you need to use lots of gloabls, then your code has some serious flaws and you should consider redesigning related parts of code.

But whatever you read, programming is about experience and cannot be taught. The more you code and design applications, they more better you will get.

Topic archived. No new replies allowed.