Programming is an art. Any programmer can write the code that can do the job, however that alone is not enough. An artistic programmer is the one who writes a code in such a way that, when someone reads his/her program it feels like he/she is reading a story. This is a paramount skill that every programmer should cultivate within themselves. I am very happy and excited to announce that I am going to write 5 blogs for the topic 'The art of software craftmanship' and share the heuristics, tips, tricks, and methods that will make you an artistic programmer, in the first part we will get the depth knowledge of what exactly the clean code is? so stay tuned and happy coding!
I can teach you the physics of riding a bicycle. Indeed, classical mathematics is relatively straightforward. Gravity, friction, angular momentum, a center of mass, and so forth, can be demonstrated with less than a page full of equations. Given those formulae I could prove to you that bicycle riding is practical and give you all the knowledge you needed to make it work. And you’d still fall the first time you climbed on that bike.
Coding is no different. We could write down all the “feel good” principles of clean code and then trust you to do the work (in other words, let you fall when you get on the bike)
Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. You must watch others practice it and fail. You must see them stumble and retrace their steps. You must see them agonize over decisions and see the price they pay for making those decisions the wrong way.
There are probably as many definitions as there are programmers. Few pioneers and deeply experienced programmers have drawn the boundaries for clean code, they are depicted below.
Bjarne Stroustrup, inventor of C++ and author of The C++ Programming
Language
I like my code to be elegant and efficient. The logic should be straightforward to make it hard for bugs to
hide, the dependencies minimal to ease maintenance, error handling complete according to an articulated
strategy, and performance close to optimal so as not to tempt people to make the code messy with
unprincipled optimizations. Clean code does one thing well.
Grady Booch, author of Object-Oriented Analysis and Design with
Applications
Clean code is simple and direct. Clean code read like a well-written prose. Clean code never obscures the
designer’s intent but rather is full of crisp abstractions and straightforward lines of control.
I especially like his view that clean code should read like well-written prose. Think back on a really good book that you’ve read. Remember how the words disappeared to be replaced by images! It was like watching a movie, wasn’t it? Better! You saw the characters, you heard the sounds, you experienced the pathos and the humor.
Michael Feathers, author of Working Effectively with Legacy Code
I could list all of the qualities that I notice in clean code, but there is one overarching quality that
leads to all of them. Clean code always looks like it was written by someone who cares. There is nothing
obvious that you can do to make it better. All of those things were thought about by the code’s author, and
if you try to imagine improvements, you’re led back to where you are, sitting in appreciation of the code
someone left for you—code left by someone who cares deeply about the craft.
All three authors have hit the head.
Clean code should be doing one thing well, Clean code should reads
like well-written story, clean code should be crafted carefully.
Source : Clean Code : A Handbook of Agile Software by Martin Fowler