DEV Community

loading...
Cover image for Is Indentation Important ?

Is Indentation Important ?

Martins Ngene
I'm A Believer, A Developer and A Tech Enthusiast.
・2 min read

Some times when we write code we forget to indent our code. Indent simply means to space out the lines and nest the tags and curly braces correctly to show the parent child relationship between the
individuals respectively.

So to answer the question yes! Indentation is important. Some people may not be able to explain why but they'll tell you that it's important though.

I'll attempt to explain why Indentation is very important while writing code and I'll suggest possible solution that can help you indent your code easily.

So one reason I learnt that makes Indentation important is because it improves the readability of your code. If you have worked with a framework like Bootstrap, you'll notice how fast your code grows and if you don't indent your code, it could get a little messy and difficult to debug.

There may also be a case where you put in some code in an inappropriate container. For example, you may paste in the bootstrap template of a component into a div container you created for something else. I personally have had an issue in my bootstrap grid system because of Indentation. It really frustrated me and I spent a lot of time to figure that out. So you see Indentation can also help you eliminate bugs.

One more reason you might want to indent your code is because it helps you write more clean code and improves your collaboration with a team as your colleagues will find it easy to read your code. This is an advantage as it will add value to you as a developer.

A quick solution if you are using Microsoft's Visual Studio Code is to activate the auto indent feature. This indents your code automatically at least to a decent point.

Also try to indent your code as you write them, don't wait till you finish or you may get lazy once the code works.

Okay that's what I have to share and I am grateful for the Grace to share this with you all.

Thank you for reading, please drop a comment about your opinion on this. Don't forget to write more code 😉.

Discussion (0)