Saturday, February 18, 2012

"Learning C The Hard Way" free webook

About.com/C/C++/C# - Learn C The Hard Way

"This is a book by Zed A Shaw that's available in alpha form online. It's for programmers with skills in one other "scripting" language, or who need to relearn C, Objective-C programmers who want better C skills and people who like a challenge.

Why is it the hard way? Because he wants you to type in all of the code and not copy-paste, typing it in exactly, even the comments. Then get it to run and make sure it prints the same output. If there are bugs fix them. Plus do the extra credit but you can skip ones that you can't figure out and always try to figure it out first before trying to get help.

..."

Learn C The Hard Way

SNAGHTML152ba84e

image

Learn C The Hard Way - Introduction: The Cartesian Dream Of C

"Whatever I have up till now accepted as most true and assured I have gotten either from the senses or through the senses. But from time to time I have found that the senses deceive, and it is prudent never to trust completely those who have deceived us even once.

(Rene Descartes, Meditations On First Philosophy)

If there ever were a quote that described programming with C, it would be this. To many programmers, this makes C scary and evil. It is the Devil, Satan, the trickster Loki come to destroy your productivity with his seductive talk of pointers and direct access to the machine. Then, once this computational Lucifer has you hooked, he destroys your world with the evil "segfault" and laughs as he reveals the trickery in your bargain with him.

But, C is not to blame for this state of affairs. No my friends, your computer and the Operating System controlling it are the real tricksters. They conspire to hide their true inner workings from you so that you can never really know what is going on. The C programming language's only failing is giving you access to what is really there, and telling you the cold hard raw truth. C gives you the red pill. C pulls the curtain back to show you the wizard. C istruth.

Why use C then if it's so dangerous? Because C gives you power over the false reality of abstraction and liberates you from stupidity.

What You Will Learn

The purpose of this book is to get you strong enough in C that you'll be able to write your own software in it, or modify someone else's code. At the end of the book we actually take code from a more famous book called "K&R C" and code review it using what you've learned. To get to this stage you'll have to learn a few things:

  1. The basics of C syntax and idioms.
  2. Compilation, make files, linkers.
  3. Finding bugs and preventing them.
  4. Defensive coding practices.
  5. Breaking C code.
  6. Writing basic Unix systems software.

By the final chapter you will have more than enough ammunition to tackle basic systems software, libraries, and other smaller projects.

How To Read This Book

This book is intended for programmers who have learned at least one other programming language. I refer you to Learn Python The Hard Way or to Learn Ruby The Hard Way if you haven't learned a programming language yet. Those two books are for total beginners and work very well. Once you've done those then you can come back and start this book.

For those who've already learned to code, this book may seem strange at first. It's not like other books where you read paragraph after paragraph of prose and then type in a bit of code here and there. Instead I have you coding right away and then I explain what you just did. This works better because it's easier to explain something you've already experienced.

Because of this structure, there are a few rules you must follow in this book:

  1. Type in all of the code. Do not copy-paste!
  2. Type the code in exactly, even the comments.
  3. Get it to run and make sure it prints the same output.
  4. If there are bugs fix them.
  5. Do the extra credit but it's alright to skip ones you can't figure out.
  6. Always try to figure it out first before trying to get help.

If you follow these rules, do everything in the book, and still can't code C then you at least tried. It's not for everyone, but the act of trying will make you a better programmer.

..."

I just dug that title... and I love that the book has those rules. If you're trying to learn C, then this book looks like a great place to start

No comments: