What OOP refers to is not “writing code” but “designing the code.” Everyone can write a book. Even I can. It will be a fucking shitty book, because I don’t know how to create suspense, give depth to characters, or any of that stuff. But it’s still a book. Writing code is easy. Writing good code is hard. If you want a program to fetch the current outside temp from an API you could throw together random lines of code that vaguely does what you want that you found on stackoverflow and iterate until it works. Will it catch edge cases? No. Will it output in a pretty format? No. Will it be maintainable? No. Will it be the next Facebook? Hard no. But you did write code.
Writing code is easy. Writing good code is hard. And that is why we have door stoppers called “Clean Code” to help us on our way. You might notice that the “how to code” books aren’t much thicker than a a pamphlet. But if it ever as much as touches on the topic of good code it will make for a door stopper worthy of a nuclear bunker’s entrance.
One thing to know about Clean Code is that the author is a hard right MAGA dickhead now, so if that is important to you then seek a more modern source of advice. A lot of the things he advocates for about code obviously aren’t dripping in right wing rhetoric, but if you look at his socials you might feel quite turned off.
Worth saying the comment I’m replying to is not wrong IMHO
By the way, "Uncle Bob"s prime number generator example discussed there (which Bob Martin, as he admits himself, does not understands any more in spite of that he himself published it in “Clean Code”) was originally designed and published by nobody less than Edsger Dijkstra and was used as an Example of Literate Programming by Don Knuth.
They are giants on whose shoulders we are standing. It is totally worth it reading first Dijkstra’s Chapter, then Don Knuth’s text, and then John Ousterhout’s discussion of Martin’s rewrite (linked above).
Or perhaps starting with Martins code and see if you understand it…
https://pure.tue.nl/ws/files/2408738/252825.pdf (Dijkstra’s original code and explanation, a gem of computer science history, where among other things he introduces the concept of invariants)
I would also add, that the complexity of a project massively increases the skills needed to write good code. If you want to have a small little CLI tool, that does one thing, its way easier to write that one in a good way, than it is to build an entire ecosystem of tools all working together.
What OOP refers to is not “writing code” but “designing the code.” Everyone can write a book. Even I can. It will be a fucking shitty book, because I don’t know how to create suspense, give depth to characters, or any of that stuff. But it’s still a book. Writing code is easy. Writing good code is hard. If you want a program to fetch the current outside temp from an API you could throw together random lines of code that vaguely does what you want that you found on stackoverflow and iterate until it works. Will it catch edge cases? No. Will it output in a pretty format? No. Will it be maintainable? No. Will it be the next Facebook? Hard no. But you did write code.
Writing code is easy. Writing good code is hard. And that is why we have door stoppers called “Clean Code” to help us on our way. You might notice that the “how to code” books aren’t much thicker than a a pamphlet. But if it ever as much as touches on the topic of good code it will make for a door stopper worthy of a nuclear bunker’s entrance.
One thing to know about Clean Code is that the author is a hard right MAGA dickhead now, so if that is important to you then seek a more modern source of advice. A lot of the things he advocates for about code obviously aren’t dripping in right wing rhetoric, but if you look at his socials you might feel quite turned off.
Worth saying the comment I’m replying to is not wrong IMHO
The finer details of the coding advice in Clean Code is also insane. There’s a good summary of it but I forgor where
See
https://github.com/johnousterhout/aposd-vs-clean-code
By the way, "Uncle Bob"s prime number generator example discussed there (which Bob Martin, as he admits himself, does not understands any more in spite of that he himself published it in “Clean Code”) was originally designed and published by nobody less than Edsger Dijkstra and was used as an Example of Literate Programming by Don Knuth.
They are giants on whose shoulders we are standing. It is totally worth it reading first Dijkstra’s Chapter, then Don Knuth’s text, and then John Ousterhout’s discussion of Martin’s rewrite (linked above).
Or perhaps starting with Martins code and see if you understand it…
https://gist.github.com/pooya-raz/59aa46460f72f994f204a861c7342b4b (Bob Martins Code, which he can’t explain when interviewed by Ousterhout)
https://www.cs.tufts.edu/~nr/cs257/archive/literate-programming/01-knuth-lp.pdf (Knuths beautiful explanation of the algorithm invented by Dijkstra, using and demonstrating Knuth’s fantastic “Literate Programming” method)
https://pure.tue.nl/ws/files/2408738/252825.pdf (Dijkstra’s original code and explanation, a gem of computer science history, where among other things he introduces the concept of invariants)
https://github.com/johnousterhout/aposd-vs-clean-code (Ousterhouts interview with Martin, after publishing A Philosophy of Software Design)
Fascinating
Possibly you’re thinking about https://qntm.org/clean
Yes thank you!
the advice still checks out though imho. dont treat it as dogma, but as useful guidelines.
maybe dont buy the book though
I have been happy to recommend Sandi Metz books instead.
99 Bottles of OOP and POODR are excellent books and include many of the same ideas.
Good Books on the essence of OOP!
I now think that useful OOP is mostly about invariants.
I must pretty good at that, since I never know if my code is gonna crash until the very end :D
My code has that special slow burn where I realize just how terrible it was when a help ticket pops up a few weeks later.
I would also add, that the complexity of a project massively increases the skills needed to write good code. If you want to have a small little CLI tool, that does one thing, its way easier to write that one in a good way, than it is to build an entire ecosystem of tools all working together.