《Clean Code》Learning

《Clean Code》Learning (1) - Introduction

Recently, I begin to read the book “Clean Code”. Actually, last year, I only read one chapter of the book instead of full book, why?  I thought, at that time, oh, all the contents of the book were common sense, I knew them, I didn’t need to read them carefully, I could understand them by only reading the chapter title and brief introduction.  Now I find I’m wrong after I read the introduction and the first chapter of the book.  This book “Clean Code” is worth fully and carefully reading by anyone who wants to be professional programmer.

Code is always essential

Code will never die, no matter what kind of technology we use, no matter what kind of business domain we construct software for, no matter what kind of software engineering we apply, no matter what kind of architecture and design pattern we practice. All will come back the code which is essential for software.

Someone probably will say there are some tools which can automatically generate a lot of code even entire software, yes, you are right, but maybe you also should ask yourself how much complex business logic code and algorithm code the tool can generate, or do you always work for “Hello World” project? A lot of code will still be written manually by programmer.

Read or write code

Coding is still daily work for every programmer. When we say we are coding, it means we are typing code? NO! We are probably reading, testing,debugging, googling, thinking, asking... we actually try to understand the code. Typing code is only small part of coding, we spend much much time to understand the code, but how many times you feel confused? be stuck? say “OMG” or “WTF”? when you try to understand the code.

The clean code can help us understand the code, let our coding life be easier than before, that’s why it’s so important for us, that’ why I like it so much.

The beauty of code

Do you like apple product? I like them except their price.J Why are apple products so popular? I think one of reasons is that each product follows the core thought - The extremely simple design. Clean code is simple, but simple is not stupid, not trivial. Actually, I think it’s a very challenge and difficult job for us to simplify complex and complicated thing, at least, you will find many OO principles and design patterns will be applied in the code clean.

I also like the sentence which Jobs used to firstly introduce apply cloud service. “It just works”. Clean Code work as what you expected way. It’s direct, doesn’t let us think too much, it just works.

Do you like reading elegant article, I read less, but I like the elegant feeling. Clean code can let us feel elegant. We will not struggle with the code any more, code will be under our control, life will be easy.

Simple, direct and elegant, that’s what I thought about the beauty of code.

Learn and practice

When we read the book, we will know what kind of code is clean, how to write clean code, it’s easy, you can find they are common sense, but question is why we often violate these common sense in coding?  The reason is that we don’t practice. For example, we know people must walk on one side of the road, it’s a common sense, why we follow this rule every day without thinking about it, because we practiced day by day before. So in order to master these skills, we should practice, practice and practice till it becomes our intuition.  One day, we will be able to write clean code without all the principle and rules in the book. We finally “know” these common sense.

Conclusion

Code is essential for software, coding is our daily life for programmer, let’s read the book and practice to clean the code, control the code to get easier coding life.

 
 
 
标签: Clean Code
原文地址:https://www.cnblogs.com/Leo_wl/p/2979434.html