4 ms·
One point not covered by the article is how reading real world code will also help set realistic expectations, especially if you are a relative newbie. The trut
by mvindahl 10y ago
One point not covered by the article is how reading real world code will also help set realistic expectations, especially if you are a relative newbie. The truth is that there is a lot of code in the world, even in popular frameworks and libraries, which does its job but which does so in clunky or unreadable ways. I don't blame this on the developers, on the contrary it's my experience that any codebase will develop a number of FIXMEs and TODOs over time because the initial design very rarely matches the final design and because there is not a business case for making everything shine. Perfect code is a noble goal but prohibitively expensive to implement.
This is a nice lesson for a novice programmer to let sink in. That software is written by humans. Mostly clever people but not infallible. And subject to all kinds of tradeoffs. They call it computer science at university, but most of the time we are craftsmen working on buildings evolving as we go.
I recall my personal eureka moment in this regard. 2001, final year of university, writing Java code for my thesis. Downloaded the source code for the official Java APIs, I think it was, to better understand how they worked. I was genuinely surprised by the amount of critical comments and "fix this" comments strewn throughout the code. It was a great learning experience and took the pressure off my shoulders to be "perfect".
- JoachimS 10y agoGood point. I'm always thinking my code is crap (it is) and inferior. But reading other code has made me realize that others code often has its warts too. The key is seeing others code warts (or lack of them) makes you identify your own warts.
- Ntrails 10y agoAs a self taught "make things that do what I want" sort of a coder, I am eternally worried about the things I don't know. Each solution is the best I could come up with - but I'm confident it's still probably shit. So I often just wish I had someone to talk to about what i probably fucked up, or why it was a bad idea. For now my code is just littered with "I did x because y but I'm not sure if z was better or if there's another option I couldn't see".
- K_REY_C 10y agoAgree with this. I know there are sites that compete for minimum key strokes to compete a task in, say, vim -- is there anything similar for code? Is there somewhere people can post code and others can suggest ways to do it better? I think this would be extremely helpful.
- dllthomas 10y agoFind someone to trade code review with?