How many developers and how few programmers ...
Perhaps someone will perceive this article as another whining on the topic of "how to live badly." But I still write it with the hope that this will encourage someone to self-improvement. And, suddenly, the current release of our reasonable (I would like to believe) civilization will become a little more stable.
The reason for my dissatisfaction was another bad experience working with a freelancer who calls himself a "mobile developer." The task was set for the person, he even completed it - the application somehow worked, although some bugs with deleting objects inspired sad thoughts about incorrect operation with list indexes. And this is a bad omen. If a person does not know how to work with deleting from lists, then this is most likely only the beginning of problems, and the worst is to be expected.
So, in principle, everything happened. When the TK was almost completed, fully paid and the source code was transferred, I realized that I just threw the money in vain in vain.
Let me remind you that Android applications are written in Java - object (with a few caveats) YaP. Or even some object-functional (also with caveats) PL like Kotlin and Scala.
Our hero, who called himself an “Android developer,” did not even master procedural programming (a kind of “bronze age” of programming) and remained somewhere at the structural level (“stone age”). With his stone ax on a stick with a single copy-paste function, he put together my entire future application.
Oh, this man is a copy-paste genius. For example, every time when it was necessary to take an object by id from the list, he wrote a loop. And when he came across a list of lists, he wrote a nested loop. Therefore, my new application for 80% consisted of "ladders" of cycles of varying degrees of nesting ...
All these cycles were painfully similar to each other, but the developer did not guess to create a private method, for example, getObjectById. Needless to say, the insert and update methods with a length of 200 lines coincided 90 percent?
I started refactoring this "suitcase without a handle" (it is inconvenient to carry it, it's a pity to drop it - the money is paid off). IDEA honestly highlighted duplicate pieces to me and suggested putting them into functions. By simply pressing F2 (go to the next warning), Alt-Enter (show options) and Enter (select the first default option). I managed to reduce the source code by 1.5 times. It remains a mystery what prevented the developer from doing this. Ignorance that there are warnings in IDEA?
Then I started refactoring classes, which were also stupidly copied, without the slightest attempt to create super-classes with common functionality. I had to seriously work on encapsulation and side effects - the static public properties of classes successfully replaced a person with the absence of global variables in Java. For example, the id of the edited object was just a global variable of the main Activity ...
In general, the source code was bloated in at least three to four. And I will remind the main axiom of programming:
The less code, the less glitches.
Only code that is not buggy is not buggy. Missing code (while maintaining functionality) is the limit to which you should strive. From this axiom, the statement "more code - more glitches" follows in an unsurprising manner. Redundant code is the main problem of copy-paste - it approximately quadratically increases the number of bugs in the code. To combat this phenomenon, at the dawn of imperative programming, they came up with procedures. But our programmer was not looking for easy ways ...
But stop whining. It's not about him, but about the methods of teaching programming in universities, when a fresh first-year student is immediately put on some C ++ (frankly, not the best language for beginners) to learn OOP or cramming sorting algorithms with "o-big-from en-logarithm-en. " And it’s good if before that they at least explained to them the “turtle graphics”. In fact, people do not know the very basics of programming.
But let's get the garlic! You’re so smart there now, thinking, “Well, this is a kindergarten! I would never do that.” Let's say that it’s so, and you don’t write so stupid copy-paste code. But how much did you learn (and apply) the rest, more complex concepts and paradigms? After all, any modern YP is multiparadigm. And all these paradigms must be applied at the same time: when creating the methods of the object, select the semantic-complete or repeating code in the procedures, returning the closure as the result of the generalized function, do not forget about encapsulation, starting up a new utilitarian module in the project, recall the solved aspect, etc. d.
Below in the article is a voting ballot - check yourself if you know all of the above. There is not a single technology or domain-specific library, only general paradigms. I am convinced that anyone who calls himself a programmer is simply obliged to know and apply all of the above approaches in any programming language (from CSS to Erlang, from God-Sorry, 1C to Rust).
So, what do you know (can you explain the essence and the pros and cons in 2-3 sentences and give examples of how you used it recently)?
If something is new for you there or you are not sure what you can explain correctly, I advise you to google it at your leisure and slightly increase your level from a “developer” (in the bad sense of the word) to a real tube “programmer”.
PS: the list of paradigms does not claim to be complete. Suggest your additions in the comments.
Only registered users can participate in the survey. Please come in.
Which of these paradigms do you use?
- 51.1% Imperative Programming 92
- 43.3% Declarative programming 78
- 20% Logic Programming 36
- 41.6% Structural Programming 75
- 61.1% Procedural Programming 110
- 46.6% Modular Programming 84
- 89.4% Object Oriented Programming 161
- 26.1% General Programming 47
- 61.1% Functional programming 110
- 16.6% Aspect Oriented Programming 30