Attitude determines everything - read "Writing Solid Code"

xiaoxiao2021-03-06  74

Recalling this book read, only one sentence: the attitude determines everything!

I can often see someone asking "How can I learn to program?" Or "Why is the problem in the domestic programmer less than foreign programs?" In fact, see "Writing Solid Code" book, knowing, for Assert and Use, the author has used the entire chapter to describe, and it seems just a simple assertion. It is possible to use it at any time in actual work, and it is also very technically explored. How many people can do in China? Studying this small macro to the bottom of the planing root? This is an attitude issue. Many people are passionate about new technologies that have a variety of layers of the style, and for the essence of the computer: architecture, compilation principle ... and other real computer science and technology dismissive, in the gorgeous platform of others, tirelessly piled up the code. Also think that you are very cattle B, just complain online, don't meet or discuss the language of the language more "money".

The author also held an example of a memcpy () function. I like to ask the candidates when I am impressive, I like to ask the candidate to write a memcpy () function to investigate the degree of understanding of the language, many people write as follows:

Void memcpy (void * pvto, void * pvfrom, size_t size)

{

Void * PBTO = (Byte *) PVTO;

Void * pbfrom = (byte *) PVFROM;

IF (PVTO == Null | | PVFROM == NULL)

{

FPRINTF (stderr, "bad args in memory / n");

Abort ();

}

While (size -> 0)

* PBTO == * PBFROM ;

Return (PVTO);

}

A few years ago, I first read "Writing Solid Code" to try to write more "fierce", and even if the pointer is NULL, it is directly moving, and it is even more exclusively to maintain the following Debug version:

Void memcpy (void * pvto, void * pvfrom, size_t size)

{

Void * PBTO = (Byte *) PVTO;

Void * pbfrom = (byte *) PVFROM;

#ifdef debug

IF (PVTO == Null | | PVFROM == NULL)

{

FPRINTF (stderr, "bad args in memory / n");

Abort ();

}

#ENDIF

While (size -> 0)

* PBTO == * PBFROM ;

Return (PVTO);

}

There is only one shy after reading "Writing Solid Code":

Void memcpy (void * pvto, void * pvfrom, size_t size)

{

Void * PBTO = (Byte *) PVTO;

Void * pbfrom = (byte *) PVFROM;

Assert (PVTO! = NULL && PVFROM! = NULL);

While (size -> 0)

* PBTO == * PBFROM ;

Return (PVTO);

}

I haven't considered the robustness and simplicity of too many code, I only thought that I have fun for my functionality, and I only know how far my code is from the quality of the business code. This is an attitude question: Why can't I consider so much when I start? Because there is no heart to face this code! I remember that the teacher said that it is important to do computer development, it is to use your mind to computer when designing code. If this code represents my body, I definitely not tolerate the situation of lack of arms and legs, I don't use the responsible attitude to face the code, so I will cause the incomplete code. Everyone is relatively hairy when college, it is estimated that there is not much college students' common diseases. I have seen that the computer system can calm down and write code. I have been more than large system development. Everyone Refers to the popular professional (the computer is hot), you can sit in the spacious air-conditioning office, you can sit in the spacious air-conditioning office, and don't face computer development work with rigorous attitudes. When writing a few lines of code, it is annoying in the Debug process. The computer will only know 0 and 1, it will not deceive people, it is true, it is false, it is impossible to push a cloud hand to reflect the maintenance of the medium, do Computer development can only face the responsible attitude, otherwise it will go to the administrative unit early, and after a few years, the leaders can take the foot of the opponent!

I remember that when I have a classmate, I have to play out to play, and the instructor has been banned, and the instructor has been arbitrarily banned. It is said that the road is one foot, the magic is one foot! Finally, I can only say helplessly: "I don't understand it is the ability, I don't want to be an attitude, even if you don't understand, at least you also give the teacher a better impression, the exam can leave some feelings ... "In fact, the same truth is the same: it will not be able to learn, there is no difficulty in the world, I am afraid that there are people. But if there is no heart, even the small grooves are not in the past. Of course, people always have inert, and many times I want to be lazy, I don't want to stick to it, but I can constantly prompt myself to clear the primary, exercise my rigorous attitude is the most important!

For more than 10 years ago, I originally contacted 286, just as a single game machine, and a simple Basic program written in dozens of lines can only rely on interest. Today, the work specializing in the network has also been more than 3 years. Even if I no longer engage in computer development work or even leave the computer industry, I firmly believe in one thing: Attitude determines everything!

转载请注明原文地址:https://www.9cbs.com/read-108600.html

New Post(0)