I do not understand how to identify classes when developing a program. Worse, I just can’t understand how classes should interact and what classes should do. Although the PLO is taken from our lives, still somehow nothing is obvious. Well, take the key words from the description of the future program - it is still possible to find out the behavior, how the program works in steps, but there's no point, because I cannot understand how classes should interact and what classes should do.
Try to write a couple of very simple classes consisting of a couple of methods and try to link them, as already mentioned above. No need to immediately raise a non-strong niche by re-reading tons of theory and practice. It is better to do this and that gradually, rather than vice versa.
If it is difficult for you to design from above, then once try to write a program from below in Chinese style without declaring classes and functions at all, leaving only variables, mathematical expressions and built-in libraries of the language. As soon as it grows in size so that you can no longer debug, start to merge repeating sections of code into functions. Saw repeating variable bursts unite them in structures. Once realized that the same functions are applied to the same structures, it's time to declare a class. Has the Project expanded to such an extent that there are several classes similar to each other? It is worth thinking seriously about inheritance, polymorphism and the separation of interfaces from implementation. Was the project just huge? It's time to release the STL data type independent algorithms. Developing an iterative process and if you have enough patience you will sooner or later come to the desired class hierarchy. Far from the fact that it will coincide with the one that you assumed at the very beginning. In order to immediately ensure such a coincidence, a great deal of design experience is needed.
For example, the version with Tetris that was offered to you in the comments is a good example of OOP over-engineering and incorrect design. With proper skill, this whole game can be reduced to a one-dimensional byte array storing the playing field and dozens of functions above it without declaring a single class. Generating the desired figure, deleting full lines, lowering the entire image one cell down, rotating the figure (the figure is not a separate class, but just 4 bytes in the array), determining whether the figure collides with the main structure, etc.
My answer will be quite unexpected. To learn how to design classes and their interaction, you need to study philosophy. Of course, it does not contain any ready-made recipes, but it teaches you to think in the right way. Designing classes requires advanced abstract thinking, the ability to distinguish the essential features of an object from the non-essential, the ability to identify common properties from a whole host of classes. Philosophy is doing just that. Only the subject of her research are the objects of the real world and how they interact with each other.
Well, or you can go a simple way. There is a very practical rule that helps in 99% of cases. The fact is that abstract thinking is closely related to language. Very closely. In fact, when a person thinks, he thinks in some language (experienced programmers immediately think in C ++). Therefore, philosophy is very closely connected with linguistics. And it can be used as follows. The rule is very simple: if you manage to come up with a simple name for a class that fully reflects its essence, then the class is designed more or less successfully. Of course, when adding something new to the class, you need to ensure that the name still matches. The trick is based on the fact that in a language that has developed over the centuries, there are already convenient names for all the necessary abstractions. If the name cannot be picked up, then something is wrong with the class.
I would say that about design. This is, in general, 90% art, here it is either given or not.
Take for example the design of the architecture of the game "tic-tac-toe". If you are not able to think of anything, then you are not given. If within an hour you give birth to a viable structure (albeit not ideal), then it means given. Then you can read smart books or, for example, such a set of articles , in general, gain experience and so on.
Nothing is clear. If you need an understanding of the OOP syntax, then read Laforet R. "Object-Oriented Programming in C ++" or, better, Straustrup.
If you need an understanding of "design, ideology, paradigm," then I recommend to study this on the book "The Philosophy of Java," Bruce Ekkel.
I advise you to read the book "Object-Oriented Analysis and Design" Gradi Bucha. It is written in a bit heavy language, but it helps to understand the OO paradigm perfectly.
@chevchelios , don't worry! I, too, at the very beginning of my journey did not understand the meaning of the PLO (yes, I am not the only one, I think ...). Once I had to solve a problem that without the PLO could be solved with a crutch, as I actually did. Long puzzled over the task, until one of my friends suggested to me to use OOP. "I do not see the point!" - I said, but the “same Familiar” showed me how to solve this problem easily using OOP. His code looked much more elegant and shorter than mine, worked in any cases, unlike mine =) Long digging into his code and examining everything that I did not understand, I suddenly gasped and realized the power of OO programming! The moral of this story is: Do not rush, wait for the right moment to study, and all you need is to “climb” into your head. Everything is learned in practice.
Microsoft has a free book for small C #, OOP is not very well described there. Far from ideal, but still.
I would also recommend CLR via C # 3rd edition author Jeffrey Richter. This is not quite the PLO, but about the language itself is object oriented. Some of what I know about OOP has now been derived from this book. If you plan to contact C #, I recommend it immediately and read it.
Read exactly Björn Straustrup "The C ++ Programming Language" ("C ++ Programming Language") and, if you drag out, I recommend his other book "Design and Evolution C ++". Why him? Yes, because he was actively involved in creating the ANSI / ISO standard for C ++, the book has many awards and is written in an accessible language.