10 Crucial Habits for Good JavaScript Development & Design

JavaScript is no longer just a web language, with new technology evolving, frameworks like Node.js enable us to live the dream of building network applications with an easy to use language.

We see mobile phones using JavaScript to build native web applications browsers, and we see fully flexible web apps like Trello, using several JavaScript based technologies to build one of the most popular to-do applications in the World.

JavaScript has grown, and so has the demand for it. I do believe that these days, a lot of the programming freshman are beginning their journey with JavaScript, but Python is still highly recommended.

JavaScript.Python.Joke

With that in mind, JavaScript is still a fairly easy programming language to use and work with. In the days of open source, it’s not very hard to do some tutorial reading and grab a few lines of code from a side project, to build something of your own. But, how good of a practice is that?

Do we want to form habits that make us depend on what others have built for themselves? I’ve read enough articles, seen enough forum posts and replied to enough tweets to grasp the common issues that a lot of newcomers, and even intermediate coders experience.

This list might not be fully comprehensive, but it outlines a few good points that are important not just for JavaScript programmers only, but for anyone who needs more motivation and advice with moving forward.

30 New Lines of Code for a Month

30 New Lines of Code for a Month
Gone are the days of telling people to ‘write code every day’, it’s just not going to happen. It’s easier to get frustrated, and avoid doing it at all: telling yourself, there is always tomorrow.

Set solid foundation for yourself, write your first 30 lines of code and continue the same way every day. You will find time to do 30 lines of code every day, it’s only thirty lines. It doesn’t matter whether it is repetition, or the NASA’s new website.

Increase the amount by 10 lines every week, you’ll rapidly increase your progress rate.

Before You Write Code, Document It

comment your code
While not everyone is going to agree with this, the best way of writing code (at any stage) is by having clear direction of where it is heading. Writing your code comments AFTER you’ve written a complex piece of code is not going to cut it.

Valid, resourceful and understandable comments are the essence of programming, and should be practiced by everyone. Just remember that tools like minifiers, or code beautifiers, usually strip all of the comments; you’ll want to find a solution for that.

Firebug / Chrome Developer Console

chrome dev tools
I’m not even writing that much JavaScript these days, yet I constantly find myself in the developer tools, every single day. Why is that? I guess it is the habit of tinkering, learning new techniques and seeing what other developers are up to.

Firebug is free, and Chrome Dev Tools come integrated with every Chrome installation. Though, you’ll want to learn how to use these tools for code debugging, because that is what JS is all about – debugging!

Get a Decent Code Editor

sublime text wallpaper
Forget about Notepad++, there are far more better solutions out there, and as a developer; you want something reliable, and something that can help you do more in less time. I use Sublime Text, it’s perfect for any type of web developer, and has a great plugin repository to browse.

You can try online IDE’s, or see my post for Ruby IDE’s – if you’re into Ruby.

Spend a couple of months using one editor to grasp the full benefits of it.

Monitor Your Errors

errors in programming
This is nearly as important as writing code comments. As an inexperienced programmer, you’re mostly thinking about getting shit done, and the last thing on your mind is to test for errors. (errors? no thanks, I don’t want to use my brain right now)

Always keep a track of what your applications are telling you, do deep research on your problems and make sure you understand them thoroughly, so the next time it happens, you’ll have the solution at your disposal.

Linting is Cool

JSLint The JavaScript Code Quality Tool

Lint as a term can also refer more broadly to syntactic discrepancies in general, especially in interpreted languages like JavaScript and Python. For example, modern lint checkers are often used to find code that doesn’t correspond to certain style guidelines. They can also be used as simple debuggers for common errors, or hard to find errors such as heisenbugs. [1]

Even the most seasoned of programmers are using linting tools to check their code against common typos, errors and other little bugs. I recommend trying any of the three tools below:

tame these tools and form a habit of using them on daily basis, or whenever you’re writing code to be exact. Along the way, you’ll save yourself a lot of time wondering, pondering and even stressing over silly problems / typos.

Common JavaScript Mistakes

I’m adding this as a sub-headline for linting, but I recommend checking out this article from Tutorialzine, where Martin Angelov discusses the common mistakes that JavaScript developers make, and how to tackle them. Even if you think you’re a God, it’s still a pretty decent read.

Join a JavaScript Community

Join a JavaScript Community
Freelance all you want, but one day you will be forced to go to Stack Overflow and ask a serious question, even after having done a full-scale research on it. It’s so important to become a part of the community (just as it is to become part of a local community as well), as there is so much we can learn.

Try a Development Framework

Backbone.js.Logo
It comes down to how you want to approach your work life. Learning one thing is a good start, but trying to depend on that one skill all of the time is only going to suck you deeper inside of the rabbit hole.

Nowadays, frameworks are highly versatile, customizable and acessible, just as there are big communities behind them; offering help at your disposal, whenever you need it. Mastering a framework can greatly change the way you write your programs and applications.

I have shared plenty of framework posts already, and there is still a lot more to come. Each framework has its advantages and disadvantages, learn those and you’ll find that your development rate is increasing, because you know which framework to use for any given project.

Your Own Code Library

JavaScript Code Libraries
Whenever you begin to grasp programming fully, you begin to notice that there is in fact a lot of repetition going on, and with time – you know which code to turn to when you need to solve a particular problem. This is also how libraries are born, developers create libraries to help them solve a broad range of problems in a more flexible manner.

Know your habits, and know the code you write, then create an easier way to approach it all.

Failure Will Hunt You

system failure wallpaper
It will be displeasing, hard and frustrating. Failure is going to be your worst enemy, and fully aware of it. But, this is also your test, the ability to get past failure and continue moving forward with what you know.

The moment you discontinue learning, you’re telling the World that you rather give up, than get up and keep at it. It’s important to self-motivate yourself to a certain extent, keep yourself in shape with new knowledge, so to speak.

Do What Feels Right

If there is anything you should take seriously from this post, then it’s probably the first point, where I said that it’s important to write code every day. That way, you’ll stay in a sharp mental shape, and most of the things that you will need to progress will come to you by themselves.

I’m eager to hear what experiences have others had with their programming journey, but specifically JavaScript. You could say that much of the knowledge in this post, does in fact apply to every programming language out there.