YouTube Icon

Why do you think writing clean code is important ?




Why do you think writing clean code is important ?

1. Your teammates will thank you

If you've ever worked in a team with many devs you know that sometimes you need to modify or fix a feature coded by someone else. Isn't it great when that code is nice and clean? 

Working in a team is a wonderful thing. You get to share knowledge and passions with other people and there's always lots of learning involved. But when it comes to code we all have our ways and we probably approach problems differently. Clean code makes it easier for your coworkers to understand your approach.

2. Think about your future self

So, what if I work alone? Or what if I hate my coworkers and I want to see them suffer?

Clean code is not valuable only for your team, but for your future self as well! It may be you who has to modify or fix some old feature developed by yourself. And believe me, you will be equally (or even more) happy to have nice and understandable code written by yourself to work with.

3. Messy code tends to get messier

Once you approach a solution ignoring clean code practices and just throwing anything that works in, there's no going back without refactoring the whole code. You may have to leave it there to move on to the next feature and avoid delays, sure. But eventually you'll have to go back to fix some bugs or modify something, and then you'll be faced with two options:

  • Spend some extra time refactoring the old code
  • Keep working in the mess 

If you go with the first option you'll solve the issue, but you'll get delayed, and your team probably can't afford the delay. That's why messy code tends to get messier. You'll be forced to go with the second option and make the mess even worst again and again until someone decides that taking the first option is worth the delay (which may never happen).

Wouldn't it have been better to write clean code in the first place?

Also, the messier your code becomes, the harder it gets to get it cleaned up. Messy code could corrode your project little by little until it ruins it entirely.

4. Faster decision making

When you're following clean code principles it's easier to make decisions like:

  • How should I name this property?
  • What comment style should I use?

That's because clean code is based in standards and conventions that define a bunch of stuff so you don't have to!

Every mayor programming language has its own set of standards and conventions defined by their creators and communities that exist to make everyone's life a little easier. I highly recommend looking up those conventions for every programming language you use.

5. Reduce repeated code

Writing clean code means following naming conventions (among other things). These conventions help you choose descriptive names for your classes, variables, functions, etc. Even files need to be correctly named!

When all your code has descriptive and intuitive names it's easier to find what you're looking for. Need a way to get all unread messages? Try MessageService.GetUnread(). You'll have a hard time find it if the method it's called ArrayOfUnreadMessages() instead.

Bad naming could lead to:

  • Best case scenario: Wasted time searching for stuff.
  • Worst case scenario: Repeated code with a different name: You couldn't find ArrayOfUnreadMessages(), so you created UnreadArray(). They both do the same thing, and they both have horrible names.

6. It feels great!

You know that feeling when you clean up your desk and everything is where it needs to be, and you just want to take a pic and upload it to whatever social media you use? Well, that's how writing clean code feels like. Try it!



Author Biography.

CrowdforThink
CrowdforThink

CrowdforThink is the leading Indian media platform, known for its end-to-end coverage of the Indian startups through news, reports, technology and inspiring stories of startup founders, entrepreneurs, investors, influencers and analysis of the startup eco-system, mobile app developers and more dedicated to promote the startup ecosystem.

Join Our Newsletter.

Subscribe to CrowdforThink newsletter to get daily update directly deliver into your inbox.

CrowdforGeeks is where lifelong learners come to learn the skills they need, to land the jobs they want, to build the lives they deserve.

CrowdforGeeks

CrowdforThink is a leading Indian media and information platform, known for its end-to-end coverage of the Indian startup ecosystem.

CrowdforThink

Our mission is "Har Koi Dekhe Video, Har Ghar Dekhe Video, Ghar Ghar Dekhe Video" so we Provide videos related to Tutorials, Travel, Technology, Wedding, Cooking, Dance, Festivals, Celebration.

Apna Video Wala
CFT

News & Blogs

4e001a829dec0246019fc8cfbef37760.png

How to detect network connection is Online/Offl...

We all might be familiar with the JavaScript way of checking Online/ Offline status. But in the c...

f744dbf3ab03eaaa58fd3e6dac2d0169.png

How to Get User Country Name, Browser, OS Name,...

Using PHP get stoner details IP address country, device, cybersurfer, operating system  &nb...

ff7f9eca4d1a0d29656644f11b806865.png

How to Drag And Drop Data Between Two Tables In...

Introduction  occasionally you need to drag and drop data from one table to another table...

Top Authors

Lamia Rochdi is the Marketing Manager at Bell Flavors & Fragrances EMEA. A successful family-...

Lamia Rochdi

I’m Mertin Wilson a technician in a camera company and certified expert of different P...

Mertin Wilson

Zakariya has recently joined the PakWheels team as a Content Marketing Executive, shortly after g...

Zakariya Usman

Pankaj Singh is a Senior Digital Marketing Consultant with more than 2 years of experience in SEO...

Pankaj Singh
CFT

Our Client Says

WhatsApp Chat with Our Support Team