Learn C The Hardway Của Zed.a Shaw.

      207
I did learn C the hard way -- from the book by Kernighan và Ritchie (its creators), when that was the only book about C that existed.What is clalặng khổng lồ hardness of this one?
*

This is a very different approach lớn learning a programming languages.

Bạn đang xem: Learn c the hardway của zed.a shaw.

It turns the traditional approach on its head. Rather than first explaining a new concept and then showing some example code, this book does it in the reverse order. It starts with code that demonstrates everything you'll learn. The idea is, you type it in, play with it, and try to lớn break it. Then you read about what each line does. Rather than going through each new từ khóa separately, it just dumps a dozen or two on you at o This is a very different approach lớn learning a programming languages. It turns the traditional approach on its head. Rather than first explaining a new concept and then showing some example code, this book does it in the reverse order. It starts with code that demonstrates everything you"ll learn. The idea is, you type it in, play with it, and try to lớn break it. Then you read about what each line does. Rather than going through each new từ khoá separately, it just dumps a dozen or two on you at once và asks you lớn memorize them. Later, you understand what they bởi vì.I have sầu mixed feelings about this book.The GoodI think this new approach is a better way lớn learn a new programming language. So often, in other books, I read all this explanation that I have sầu trouble grasping because I need to see it lớn understvà it. So I power through the explanation first, và then once I see it in action it all starts lớn become clear.With the "hard way" approach, you see a bunch of code you don"t understand at first, but that"s fine. You just need khổng lồ type it in and play with it. Some of it you can probably figure out on your own as you experiment. Then the explanations answer any questions you have sầu. It seems so much easier this way. That"s ironic, since it"s called "the hard way."This approach has another huge advantage: it doesn"t require quite so much explanation. You"ve already played with the code, maybe looked some stuff up on your own. By the time the explanation comes, there"s not much left khổng lồ bởi. This seems especially appropriate for such a minimadanh sách language like C. You"re already doing pointers by page 62 and heap and stachồng memory allocation by page 74. The language proper, advanced topics and all, is done by 135 pages, only 1/3rd of the book.That leaves 200 some pages for all the important stuff most language tutorials overlook: defensive sầu programming, build systems, linking, libraries, automated testing, data structures and algorithms. So, by the time you"re done with this book, you"re pretty much done. You"ll understvà not just the language but how to vị full projects, & how lớn use it for real work. You"ll have sầu practiced with tons of actual code, not just coding it but changing it & trying to lớn break it.That brings me to something else I liked about the book. So many books talk about programming languages as if everything will work great the first time. Most beginner programmers get humbled very quickly. They get one compiler error after another, & they don"t know why. They think they"re stupid or just not cut out for programming. The truth is, it"s very easy lớn break code, especially when you"re still learning. Books should not just acknowledge this but tackle it proactively lượt thích this book does.

Xem thêm: Máy Tính Có Mạng Nhưng Không Vào Được Web, 5 Cách Khắc Phục Lỗi

Each chapter includes exercises where you purposely try to lớn break it.I also like that he emphasizes a simple coding style. For example, rather than teaching you some fancy unit testing framework, he uses "minunit," which is only 30 lines of code, after his tweaks. (The original is literally three lines of code!)Speaking of which, I like that he includes unit tests for everything. Writing unit tests is so important and always ignored in programming books, which portrays them as trivial và unimportant. Including unit tests for the code, you will understvà the code better because you will see how it"s used. You"ll also get used lớn seeing how khổng lồ write unit tests in the language.The Bad
He seems lớn use his new style of teaching programming as an excuse to lớn be lazy about explanations. Often it feels very "arm wavey." He depends on the reader to lớn be proactive và bởi vì some retìm kiếm and experimentation on his own, và as a result he seems to assume that it"s fine to lớn skimp on explaining things.He uses a library called bstring, và completely skips explaining how strings work in C. He justifies this by dismissing C"s strings as "broken." They"re only broken if you expect C not to be a low-cấp độ, minimamenu language. It is, và its approach to strings reflects that perfectly. C is an excellent C, but it"s a lousy Java. Most criticism of it would go away if people accepted C on its own terms. Blowing off explaining C strings is a bad idea if for no other reason than beginners will be reading other code, almost all of which does not use the bstring library.The writing style bugs me. The mô tả tìm kiếm of the book says he"s "an entertaining and lively writer." To me, he just sounds lượt thích an arrogant hipster programmer. He thinks he is one seriously bad ass programmer, và he isn"t, although he"s pretty good.Here"s a good example of his obnoxious writing style: "You can thank me later when you realize how insanely awesome these macros are. Right now, you don"t know how awesome they are, so you"ll just have sầu khổng lồ use them, and then you can walk up khổng lồ me one day & say, "Zed, those debug macros were the bomb. I owe you my firstborn child because you saved me a decade of hardabít & prevented me from killing myself more than once. Thank you, good sir, here"s a million dollars & the original Snakehead Telecaster prototype signed by Leo Fender." Yes, they are that awesome."What follows is a handful of macros that just print errors và jumps to the kết thúc of the function. That"s it. I"ve written these kinds of macros a few times in my own code. Usually I don"t need them because I don"t abuse the heap, so I can usually vị an if-statement and a return statement on one line. This is clearer than some obscure macro defined elsewhere. It"s good that this book presents these macros, because they can save some lines of code in some situations, but mostly because it demonstrates the preprocessor và the importance of creating abstractions rather than duplicating code all over the place. But they are not that "awesome."The UglyIn several chapters toward the beginning of the book, code and the output vị not match. In exercise 7, several print statements from the code don"t show up in the output. The output session for exercise 9 is actually the output session for exercise 10. Exercise 10 is about switch statements, but the example code doesn"t actually have a switch statement. The book doesn"t have any switch statements until exercise 13, which is actually about for-loops and string arrays. Exercise 13"s output session is actually the output session from exercise 10.These are enormous errors. I"m astonished they made it past the editing phase. And they happen at the worst possible place, when new programmers are still grappling with the basics of the language. They would get completely lost. This is practically a khuyến mãi breaker for this book, và the reason I"m only giving it 2-stars. The good news is that it"s only at the beginning. The problem doesn"t show up later. ...more
hotlive