Arin Adamson
By Arin Adamson | Web Dev | August 31, 2015

The Importance of Simplicity in Code

Programming CodeAs a web developer, I am sure you know how messy and unorganized your code and website files can get. When you are dealing with hundreds, thousands, or even hundreds of thousands of lines of code it’s very important that your code and files stay as organized and simplistic as possible. Staying organized can help to find errors, optimize the speed of your code, and help other programmers navigate and edit your code.

In the interest of saving time, or just out of pure laziness, many programmers will ignore these organizational steps. This is very frustrating for developers such as myself who come in later to try to optimize and improve sites. So other than frustrating me, why should you keep your website’s code and files organized and simplistic?

Debugging

Web developers will make mistakes. Whether they be typos, horrible syntax errors or logical errors. They will occur at one point or another. There are multiple tools which can point out theses errors at run time and typically will tell you the type of error along with the line of code where the error occurred. However, some times the exact error in the code may be unclear.

For example, if you have a call to a function and are passing an incorrect variable type, these debugging tools may state that the error is coming from the function, rather than the call to the function. In this case it is important to be able to identify what variable types the function accepts and what variables were being passed to the function at the time of the error. If this function is used fairly often in a single file, it could be hard to pin point and debug the issue. Unless, of course, you have commented your code and kept it simple. If you have done so correctly you should be able to analyse and determine fairly easily what variable types are being passed to each call to the function.

Page Speed Optimization

Every line of code that you add to a file, the more that file size will increase. Thus, the more lines of code, the longer it will take a user to download the file or your server to process the code. Keeping your file size small is important for your website and web applications to run smoothly. You don’t necessarily want to have one big file which includes all of your javascript or php code. This would mean, no matter how much code you are using from that file, the whole file still needs to be loaded.

This is where good organization comes in handy. It is common practice for developers to break down their code into separate files and then load those files only when necessary. It’s a great method for saving resources, but developers must organize and structure their files in a way that makes sense. This makes it easier for future developers to navigate your website’s files and make edits where needed.

Helping Future Developers

This is probably the most important factor of why you should keep your code simple and organized. Chances are you will not be the only one working on this website. It may seem straight forward to you, but for a developer who did not develop the website it takes quite a bit of time to analyse and determine how exactly the code works. You can help future developers by making comments of what exactly your code does and organizing your website’s files in a manner that makes sense. Additionally, simplifying your code by utilizing functions and classes is a great idea. This keeps your code clean and easier to understand.

background dots

Related Topics

Inside the Buyer’s Journey (Pt 1):
Buying into Brand

by Angela Asca

Why is brand important to the buyer’s journey? Branding is so important in catering to your users. It’s also imperative to make sure…

Gutenberg for WordPress: Your Questions Answered

by Stephani Worts

Chances are if you have a WordPress website, you’ve heard by now of “Gutenberg”. While visions of the 15th-century inventor might spring to…

10 Warning Signs That Your GA is Setup Wrong

by Arin Adamson

Google Analytics is integral to gauging performance of your website and online campaigns. It’s important to make sure your Google Analytics is functioning…

In the time it takes to read this sentence, you could be on your way to a well-oiled demand generation machine. Ready for your blueprint?

yes, i want my Digital blueprint