Clean Coding

I would like to share my knowledge about clean coding practices in the software development.

Everyone can do the coding but we are not sure whether it’s a quality code or professional code, it become a habit of writing a clean code, programming is not only solving the problem but its telling what is the way we are choosing to solving the problem, is that aspects clean coding is playing one of the major role in the software development.

abstrusegoose_otherpeoplescode1

In my point of view clean code should bring the following points.

  • Other developers can understand what we have written.
  • Extendibility.
  • Avoid duplication.
  • ……
  • …..

Simple example

BadCode

The above is doing the addition operation, it should work but it’s not professional coding practices, I have to ask few questions like what is a, b and Do? and so on.

GoodCode

What about this code? Everyone can easily understand what it is doing and so on, so this is one of the ways of writing the clean code.

Always we have to keep in mind the following things while writing the coding.

  • Proper naming (class, methods, members, properties and so on).
  • Documentation.
  • SOLID principles.
  • Think about future.
  • Write unit tests.
  • Refactor if it’s not readable.
  • Put the classes in the proper namespace.
  • Consistency
  • Culture independent.
  • Machine independent.
  • Easy to configure the system.
  • Memory leaking issues.
  • Think about performance issues.
  • Error handling

Those points are very important and it’s not enough to write the professional code, we need to learn more about best practices and defining rules within the team and develop a code.

Conclusion

Initially it will be hard to follow all the points, but once love this and practice it, it will come naturally and you will become great professional developers.

ALL THE BEST

Lessons learned from clean coding

Clean Code Book by Robert Cecil Martin
Clean Code
Book by Robert Cecil Martin

I am going to share my experience of reading the book “Clean Code “From Robert Cecil Martin and the books influence on our Team, as a vigorous reader, I cultivated the habit of reading to my team. The habit of reading also extended to share the knowledge with the Team.

Our Teams Group Discussion
Our Teams Group Discussion

We started to share in small groups locally. After some discussion we brought that idea in the International distributed team and every week one of the Team member picks a chapter and reads. He or she chooses a time slot and gives a summary about the chapter he was reading.

The rest of the team members are also demanded to read and participate in the discussion. The TEAM started to discuss about the content of the chapter and its current relevance to the Team.

Learning together as a TEAM
Learning together as a TEAM

 

In a span of 3 months the overall awareness of code quality has improved and we started to give proper naming to our classes, methods, variable and all kinds of names we use in the project. Most of our functions become self-explaining. We started defining the abstraction in the right level. The code readability has improved week by week.

More over when we combine that with TDD (Test Driven Development) the overall Application architecture become more loosely coupled and we were able to develop a highly maintainable and extendable code base for our Stake holders.

We realized a complex application software, when written in clean way, It looks like a master piece art. The elegance of the design and clean coding gives a proud feeling. It’s the same feeling when an artist gets when he completes a painting or any creative person giving his master piece work to the world.

Continuous Learning
Continuous Learning

During this journey I discovered knowing and learning something is not good enough but to achieve mastery we need to practice deliberately.  Writing clean code every day is a worthy habit every software developer should cultivate. I started to respect fellow developers who has an eye for quality and elegance; and who practice clean coding every day.

The journey of learning is a continuous process and it is also contagious. I hope the readers can get inspired and start learning and start practicing to get better at what they do.

Deliberate Practice
Deliberate Practice

Learning is of no use when it’s not practiced, so to be an expert, one needs to practice every day until he become a real expert and gains mastery

Don’t stop when you learn; Start practicing every day to reach the mastery.