The way to read other people’s code without ending up crying
I’m not a big Instagram fan, I don’t watch ‘normal’ (or any) television, but I do hear others talking about it or my (normal) wife mentioning how fabulous such and such’s lifestyle looks. The ‘ultra-glam-selfie-effect’ is simple: a single image with you looking your best, in the best location, at the best angle and surrounded by all the things that you want, or could hope for in life. You post that and then go about your daily life as normal…which is the exact opposite in reality… Seems pretty insane to me but hey, who am I?
Anyway, the point is that others are supposed to perceive that this is actually your life, you’ve got it made and you’ve made all the right decisions in life. It should inspire envy in them. They should want to be you and look like you.
If you’re reasonably new to programming, you’ll probably stumble across someone else’s code, someone who’s maybe been doing this a bit longer than you, possibly much longer. You’ll open the files, think ‘this makes no sense, but meh’, compile it or launch it and think: ‘wow this is amazing. How did they do this?’ Back to the code and… you’re ready to, well, cry!
These people are on a WHOLE different LEVEL from me. They’re geniuses, they’re amazing: I’ll NEVER be able to do this. They know Every language — they are Math geniuses!
Ahem. Well, now that the meltdown is over its good to point out that this is the exact same thing (minus the photos). Please let me put you at a little ease and calm down. It’s possible (and hopeful) that the code you’re reading is really, really good and it inspires you to get better and work hard at understanding it. That is the essence of our work as programmers. But what you may have missed is that this is the programmer’s equivalent of the ‘ultra-glam-selfie-effect’, but instead that perfect moment in time, you’re looking at something that took someone a long, long, long time to write.
It took creativity, agony, patience, sweat, coffee, clean shorts, maybe even a sleepless night or two in order to work on this (arguably all the traits for a good hair style). It didn’t just happen and this is not something they could ‘just write’ for kicks. You’re seeing the code at its very best, fine-tuned and poured over.
Our instinct though is to instantly compare their level of programming to our own without deconstructing it and using it as a learning opportunity and if we’re not careful we will start to feel very, very bad about ourselves.
Enter the solution:
Instead of looking at other people’s code and instantly comparing it to your level of code, why not compare beautifully crafted coding projects to something like a well-polished super car.
You see the car and think ‘wow, thats really nice. Wouldn’t it be good to have a car like that one day?’ I know, I’ll work really hard and build x and learn y and then I’ll get there in a year or two’. You don’t hate the person for having the car, they probably worked hard for it, they look good in it and they’re just enjoying the fruits of their labour, and that’s cool, right? This makes much more sense than comparing it to your current coding level; something that takes a lot of time, effort and patience to improve on.
There are super-genius programmers out there, and yes they are damn good, but any programmer I’ve ever spoken to has been kind and helpful and always wanted to encourage me. The reason you’re on this journey is to get better. Just remember that supercar: ‘Wow, this code is GOOOOOD. I want to be able to code like this one day, easily. I’m going to work at it and (help others along the way) one day I’ll get there. I’ll start up my computer, sit down and just see where the code takes me’.