Some Tips and Tricks to Become a Good Programmer

Today I’m talking about how to become a good programmer. In this world, there are so many programmers. Everybody trying to write well-decorated code. But few have to know how to write properly. There are some tricks to become a smarter programmer. That why I decided to write something about it. I’m a JavaScript Developer that’s why I’m cover JavaScript-related examples. All programming languages are pretty much the same. You can apply any language that you prefer.

Error handling

The Try … catch syntax, I’m talking about the javaScript try…catch method.
Syntax construct try…catch that allows us to “catch” errors so the script can, instead of dying, do something more reasonable.

The “try…catch” syntax

First work like this :
1. First, the code in try {…} executed.
2. If there are no errors, then catch(err) is ignored, the execution retch end of try and goes on, skipping catch.
3. If an error occurred in the code. Ignore the rest to try then execute the catch block.

I’m trying to cover some basics of try catch.

Coding Style

Our code has to be as clean and easy to read as possible. Programming is like art.

Curly Braces

A kids programmer does something that. Bad!

It’s bad practice.

Somebody is extremely does something very bad. Split to a separate line without braces. Don’t do that kids.

Line Length

And for function… You should organize your code.

Indents

  1. Horizontal indents: 2 or 4 spaces.
    A horizontal indentation is made using either 2 or 4 spaces or the horizontal tab symbol (key Tab).
    When a programmer writes an object they are following horizontal indents.

2. Vertical indents: empty lines for splitting code into logical blocks.
Even a single function can often be divided into logical blocks. In the example below, the initialization of variables, the main loop, and returning the result are split vertically:

There are so many things you can follow to improve yourself. I’m just cover a little bit.

That’s for today guys. I will catch you in the next one.

Full Stack Web Developer | Software Engineer