Coding tips & tricks - National Coding Week
19th Sep 2018
Originally posted on our ‘Base’ Medium account.
In September 2019, Base became Passenger.
It’s National Coding Week! To acknowledge this celebration of all things code, some of Base’s talented engineers have put together this short collection of tips for budding coders just setting out on their industry journey. Have any questions about what you read below? Don’t be afraid to get in touch with the Base team — our contact details are at the end of the story.
Dave Hulbert
Machines have spent the past few decades tricking us into believing that when we write code, we should write it solely with them in mind. This occurs because they are very quick to judge whether our code works or not. Our brains pick up on this and release dopamine if the machine is happy with us or enters a state of dysphoria if it says we are wrong.
There’s two things we need to do to win against the machines:
Think of the humans (including your future self). Just because the machine likes your code doesn’t mean you can move on to the next thing. They only approve of things like “correctness” and “validity”; we humans desire simplicity and are averse to ambiguity. Only be satisfied when your code has the attributes that humans favour.
Learn to use the machines’ tricks against them. Start with incredibly simple code and make many tiny iterations — getting the machine to feed back every few seconds or minutes. Hardly anything changed from your point of view, so the new code is very likely to work as expected. The machine, however, is eager to judge your code from top to bottom with zero preconceptions or even memory of the past.
Beau Lovell, Engineer
Don’t give your variables stupid names, like $variableKeyIdentifierThing or $monkeyToastTastesGreat. You’re only creating more work for yourself later down the line.
Bryan Hutchinson
Don’t believe everything you read on stackoverflow.com!
Callum Taylor
Firstly — Learn coding as if it were an actual spoken language. Read your code like it’s a logical sentence, and things should (sort of) start to make sense.
Secondly — It’s important to always bare in mind that you will never write perfect code that works flawlessly. You will continually change your coding style over the years, so learn to adapt and absorb different styles and techniques, and continually perfect what you do, without having to be perfect.
Thirdly — If after hours of searching for a solution to a problem and finding no results, chances are you’re doing something wrong. Don’t be afraid to go back to the drawing board — many times you’ll find that it’s quicker than going down a rabbit hole looking for a quick fix. It’s an approach that has saved so much time over the years.
Finally (and most importantly) — You must learn the fundamentals of coding, because, like language, the building blocks are the same, just that the syntax changes. If you know the fundamentals, it makes transferring your knowledge to other languages and frameworks much easier.
Bonus: Learn source control, because it is a very favourable skill for employment. Just not subversion/CVS/anything, but git.
Ryan Howell
It’s a harsh truth, but any code you write you’ll hate in a year or even less — although, on the positive side, that’s usually because you’ve gotten better. Coding is all about constant improvement.
Also, take the time to learn multiple languages. Using the wrong tool for the job just costs you more time. Having options doesn’t just make you more flexible, it makes you more hireable.
Jonathan Ginn
Those learning to code 10–15 years ago would face the choice of traditional learning paths (getting a degree) or trying to teach themselves. For most, it became a mix of both.
Luckily, today there are a huge amount of classes and coaches to help you learn how to code. If you’re an adult, see if there’s a local Codebar near you, or if you want to encourage your child to learn, then CodeClub is the way forward.
If you prefer to work alone, there are great tutorials and books on SuperHi and Treehouse.
And if you want to see what creativity you can conjure up, Glitch allows you to share and create new projects.
As for a tip — being the best at writing code isn’t the pinnacle. The best programmers are also the best communicators and team players. Learn how to work in a team to bring the best out of each other. You can’t do everything, but together you can.
Shane de Jager
Don’t be scared to refactor your code now. It will only come back to bite you later on if you don’t.
And most importantly, don’t expect to write perfect code first time. Most of the time, it won’t happen. Working on code for a project is a microcosm of what it’s like to code as a career — always prepare to adapt, learn new things, and get outside of your comfort zone
Luke Wakeford
Don’t be afraid to ask questions.
Also, when someone sends you a tinyurl link, know that it’s probably a rickroll.
Newsletter
We care about protecting your data. Here’s our Privacy Policy.
Related news
Start your journey with Passenger
If you want to learn more, request a demo or talk to someone who can help you take the next step forwards, just drop us a line.