+ 3
why does professional code look weird?
I am not professional programmer, and I often build projects from github and I often get confused seeing the code written, where it only create one method in one class, and sometimes it's very simple, even returns immediately with a little code. sometimes there are also too many references to objects, for example, there is an object named objA, then they create an objB which is referenced to objA, and then they make objC which is referenced to objB, this makes me go round to find objA. edit: may it's not called weird, but over oriented. sorry if there is a wrong speaking, this was translated by Google Translate. thanks
7 Antworten
+ 6
Coding is not just about making a program work. It is also about writing codes that can easily be changed or improved by other professionals.
To achieve this adaptability/scalability a lot of factors need to be considered like avoiding global variables and mutable data structures. It is because of these reasons that expert programmers write code the way they do.
It is not weird at all. Just as you said, "it's very simple". Simple enough for you to easily understand the code without knowing the original developers. On the other hand, it would have been difficult to work on the project if it contained giant functions and classes.
You should read on Clean Code and SOLID principles popularized by Robert C. Martin in his books: "Clean Code" and "Clean Architecture"
+ 3
This sounds like a programming consept named Object Oriented Programming (OOP). Search online for a tutorial or take a look at
https://www.sololearn.com/learn/CPlusPlus/1709/.