Keeping your code organized

Angelo Poole
3 min readFeb 7, 2020

Small things to look out for while coding.

An important part of becoming a developer boils down to how readable and clean your code is and how easily it is for someone else to read the code you’ve written. in order to attain cleanly written code, we should follow a few rules while we code to ensure that we don’t trip up to our fellow developers, here ill go over a few rules that you can use to refactor and refine your code.

First, we should make sure to keep proper indentation so that we can tell from a glance what is nested where and what is deeper than others. This is important as it is easy to get lost in code and not know where things start and end. If it's easy for yourself to get lost in then there's little chance that someone else wants to go through your code and decipher it. Don't make code more of a puzzle than it already is!

The second Rule, Variable naming is key 🔑 , The more descriptive the name, the better it is for other programmers to understand what you’re trying to do and what you’re trying to manipulate. I've taken up a habit from one of my instructors to give variables a name and it with its data type at the end, if there's no descriptive or reasonable reason its ok to forgo the datatype as long as you give the variable or function descriptive names. for instance: “dogParkOppinionForm” or “renderOneDog”

The third rule would be to separate your functions and fetches and other code that you might use a lot. For instance, if you’re using a lot of global variables, bunch them together at the top of your page rather than spacing them out along the page. Or making sure to keep all of your event listeners and handlers close together but separated so you can quickly go between the two!

The fourth rule would be to keep your consistency, if you've been using single quotes or double quotes throughout the development of your app, make sure to keep to one standard. this goes for other aspects of coding. The more you vary your coding style the more nauseating you’re going to make it for someone else to read your code!

And Finally, probably the most important thing to take away from this short reading. add comments! comments are the most powerful form of expression a developer is given. what better a way to express what you’re trying to do or why you’ve done it than to explain it in plain text. Your code will last a lot longer than you will and you’ll be doing developers a favor for many generations if you take the time to have a comment conversation with them.

--

--

Angelo Poole

Software engineer, Graduate of Flatiron school. Currently volunteering! Looking to talk to fellow engineers, please send me a message!