To start this Developer advice series, I wanted to talk about what I consider rule #1: being a team player.
Whether you are a freelancer working on your own or you are part of a dev team in an agency, it’s important to remember that at some point, someone else will end up interacting with your code. When they do, you don’t want to be the one they start complaining about. Not only that, but ‘future you’ will be very disappointed if they come back to an old project and have to deal with a mess.
Whist you are coding, be it a website, an app or a piece of software, there is one simple thing you can do to make your code readable, accessible and friendly to other developers, one easy thing to make you a team player: indent.
Indenting is vital, regardless of the language you are writing in or the nature of what you are creating. In some languages it is even a requirement.
Take these two examples:
And the same code, but properly indented:
The code here is identical, and is therefore functionally the same. They will both work and neither will cause any errors in the document. Imagine, however, that this code is a small part of a document that is hundreds or thousands of lines long, that you have never seen before and that you now need to edit. Which would you rather work with?
In the second example it is clear to see where one column ends and the next begins, where specific elements start and finish and the content within.
There really is no excuse for not indenting your code, most modern editors even do it for you! You don’t need to be a superstar developer or a front-end ninja, just be a team player.
Looking to gain more customers through your website?
Book a 20 minute call with one of our expert web consultants.
This is our chance to understand your business, your needs and your goals. We’re currently taking calls for 24th August onwards. If you’d like to book your consultation, fill out the form below and someone will be in touch to arrange a time.