11 ms·
Learn C The Hard Way by Zed Shaw
- bendemott 14y agoI'm really glad to see that C can get in the spotlight even on HN.
- aseembehl 14y agoIn case one does not want to spend $29, the free HTML book [1] (currently in beta) is good enough. I have been following along the book, and can vouch for it. It is a great way to learn to code in C. [1] http://c.learncodethehardway.org/book/ http://c.learncodethehardway.org/book/ EDIT: By posting the link to the book, I by no means meant that the videos are redundant. I would love it if more people en-roll for Zed's Udemy course and support him.
- johnohara 14y agoHow much $$ have you spent on lattes reading his free book? Books, videos and course materials don't just happen because we say so. Real people create this stuff.
- benmanns 14y agoIt amazes me that people invest 20 hours in reading a book and complain about the price. If we assume roughly $40/hr for a $80k programmer, this is about $800 worth of time you're investing. Does a "hard" investment of $29 (4%) really make that big of a difference?
- johnchristopher 14y agoMaybe it's more about the absolute value of something than its relative value. These days, 29$ is a lot for me. That is not a statement that the book is too expensive or that I don't give it the value it deserves. For what it's worth I plan to read the online beta then print out a bought PDF for easier reading.
- shadowfiend 14y agoI always use “let's assume roughly X/hour” as a joke. You don't get paid for your spare time, except in opportunity cost. If someone applies 20 hours of their time at work, then yes, that's pocket change. If they apply 20 hours of their time at home, that's not time that they'd get paid for anyway, so the analogy is as foolish as the claim that every pirated copy of a movie would have been bought were it not for pirates. Instead, I'm choosing between 20 hours of reading a book and maybe 20 hours of watching television (for example), which costs the electricity that the television consumes (since the cable or internet is paid for already). I suspect you'll find 20 hours of TV will cost less than $29. Or maybe it's 20 hours of running over the course of a couple of weeks. That's free, except maybe for the cost of the water to rehydrate. That's probably cheaper than $29, too. If you want to do the analysis in terms of how much it will earn you in the future, that's also valid I guess. But it complicates things, since it's hard to quantify how much the relaxation you get from watching TV or destressing from running is worth. Let me just say, I don't think people should complain about the price of a good book when it's <$50-100 (depending on material). But the X/hour analogy only works if you're taking work time, and then many companies will often be willing to refund you that money anyway. Last note: this isn't $29 for a book. It's $29 for a video course (though admittedly a non-HTML version of the book is thrown in at the end). The book itself is available for free, which is all that the OP was pointing out.
- benmanns 14y agoTrue, but by working for "roughly X/hour" you've established that the typical exchange rate for your time is roughly X/hour. If I were to ask you to do some work for my during your off time, I would have to pay about X ± X/2 depending on how you guarded your time. So what if someone only values their time at X/4? That's still $200 worth of spare time.
- shadowfiend 14y agoZed Shaw has made the book available for free. It's perfectly acceptable to point that out (indeed, it's linked from the udemy summary anyway). If you need more than the book, you can pay for the course. This is why it is labelled a "companion". There is nothing morally bankrupt about using the resource that has been graciously given away for free: it seems evident that Zed Shaw intended the book to be free, so use that fact. If you need more, he believes it's worth $29 of your money to access the additional materials. There's a really good argument to be made if the OP were linking to a bootlegged free version of a book that costs money, but it's really silly to criticize him for pointing out the free version of the free book on the thread about its companion course.
- johnohara 14y agoIf the video course were free, what would you be willing to pay for additional course materials? (i.e. the book, exercise solutions, exclusive live sessions, etc.) I'm not trying to be confrontational here. Online education/coursework/learning needs a pricing structure that makes sense. One that enables thousands of qualified instructors to participate without going broke in the process. I think I understand Zed's "freemium" model in that context. But I disagree with his approach. Our local high school district pays some teachers over a $100,000 a year. That's 3,448 students at $29 each -- per year. That's roughly equivalent to the entire student population! Look for yourself: http://www.familytaxpayers.org/salary.php http://www.familytaxpayers.org/salary.php Find a district: type in '230' Select 'Cons HSD 230' from the list presented. There is no disruption in education until there is parity between what Zed is able to make and what these people make.
- mkr-hn 14y agoDisruption happens when someone demonstrates that the existing system is flawed by creating a better system. It will cost what it costs. You sound like a traditional publisher complaining that they can't charge $20 for schlock and abuse authors anymore.
- jonknee 14y ago> There is no disruption in education until there is parity between what Zed is able to make and what these people make. I don't think Zed has trouble making $100,000 a year.
- DannoHung 14y agoYou can also compile the book into a PDF if you'd like. Zed made the code available so all it takes is the effort involved to install the right LaTeX modules. Took part of an afternoon to figure out how to build it.
- skrubly 14y agoI'm excited - Learn Python the Hard Way completely jumpstarted me into what has become a large internal django site, and I refer back to it often. I really enjoy python, and I thank Zed for the straightforward aproach. So even though I love python I want to see if the same technique can introduce me again to C, a language I never felt comfortable with.
- mtgx 14y agoLearn Python the Hard Way is great, although I can't say I've read that many Python books, but I though his approach was a very good way to learn Python.
- zedshaw 14y agoTry going through the HTML version, and drop comments when you hit problems. That'll help me make the book solid.
- esbwhat 14y agoAre guest comments ever going to be an option? I don't really want to make a disqus account. I understand if not, but I figured I'd ask anyway.
- zedshaw 14y agoNo, I'm fully blocking and moderating comments. They are for serious students who need help, not drive-by netizens. In the past I had them open, but after the first two hits by HN or reddit I had to lock it down so that students wouldn't get thrashed.
- esbwhat 14y agoFWIW i signed up to your udemy course, but I don't particularly feel like making a disqus account to also comment on the book, that's what's bothering me. I guess I will just abstain from commenting though, it's fair enough.
- thdn 14y agoI'm really considering to take this one, but I've would like to consider other alternatives, anyone knows other online c classes?
- philsmith35 14y agoHarvard's CS50 (cs50.net) is an introductory computer science course that teaches C. Full course (lecture videos + problem sets) is available free online.
- zedshaw 14y agoThe video course is being worked on by me while I write the book, so expect it to be rough around the edges. But, I say try going through the HTML version online, and as you do get stuck write comments to ask me questions. That's why I put it online for free, so that I get student feedback while I write the book.
- antirez 14y agoI just scanned through the free HTML book and this looks definitely a good start for a modern "get started fast" book about C: everything is important about the language seems to be covered. Good work.
- z1g1 14y agoI am working with his learn python the hard way course on udemy and his book and videos have helped me get going
- millerfung 14y agoNevertheless, Zed is helping lots of people out there who is eager to learn coding like me, I could imagine back in the days if you want to learn coding there are tons of resources out there, probably too many, that you don't know which one is good and it cost you money. Now, people like me can always go to his book finish the course and look for what is missing without spending a buck.
- waffle_ss 14y agoI was wondering how this compares with or compliments K&R, when I came across [this section][1] of the book that seems to slap it in the face. Here's a section from the second paragraph: You see, "K&R C" is actually riddled with bugs and bad style. Its age is no excuse. These were bugs when they wrote the first printing, and the 42nd printing. I hadn't actually realized just how bad most of the code was in this book and recommended it to many people. After reading through it for just an hour I decided that it needs to be taken down from its pedestal and relegated to history rather than vaunted as state of the art. This seems a bit hyperbolic to me... I just read K&R several years ago during school (could definitely use a re-read) but remember absolutely loving it for the combination of brevity and density of information conveyed. I'm not much of a C programmer though so I don't really know. Could a modern C programmer respond / elaborate? [1]: http://c.learncodethehardway.org/book/learn-c-the-hard-waych55.html#x62-31400055 http://c.learncodethehardway.org/book/learn-c-the-hard-waych...
- mkr-hn 14y agoThat page has examples and detailed explanations to support the criticism.
- Symmetry 14y agoThe problem is that the examples and explanations don't justify the level of castigation. Yes, you should always use strncpy() instead of strcpy() for instance, but that doesn't protect you from all bugs. The example of a safercopy() still relies on the assumption that the pointers given to it are valid, and that assumption is just as impossible prove as the assumption that copy()'s input strings are valid. Safercopy() is still twice as safe as copy() and we ought to use it, but calling copy() "defective" is unfair unless you're willing to call the C language defective in general. And you can make that argument! I certainly like languages like Go that have pointers but no casting ints to pointers or pointer arithmetic, so the only remaining danger is pointers to memory that has been freed.
- Goladus 14y agoCriticizing individual library functions independently from the language as a whole seems fair to me.
- Mithrandir 14y agoThere's also a "Learn Python The Hard Way" course: http://www.udemy.com/learn-python-the-hard-way/ http://www.udemy.com/learn-python-the-hard-way/
- zedshaw 14y agoJust a warning to everyone, like the book this course is in development as I write the book. It's covering a lot of the chapters, but I have to go back and clean up some videos and do the final ones. That's why the price is low for now.
- stock_toaster 14y agoI watched the intro on udemy. Very cool. You talked about installing xcode. For newer osx versions, people may be able to install just the [command line tools for xcode][1], which is only about 170MB or so. It might save some people from waiting around for the full xcode. [1]: http://kennethreitz.com/xcode-gcc-and-homebrew.html http://kennethreitz.com/xcode-gcc-and-homebrew.html
- zedshaw 14y agoYes, I have to update to point people there. Apparently also the latest xcode is missing a bunch of stuff people might need and requires separate downloads of those pieces. I forget what but it's still annoying.
- stock_toaster 14y agoI think the command line tools are now installed (and downloaded) from inside excode once you have xcode installed. Certainly an irritant. Just looked at it: preferences -> downloads -> command-line-tools
- mhartl 14y agoWhat's your method for making the ePub version of your books? I'm considering writing a custom program for my own stuff, but I'd love to be able to use something off the shelf.
- zedshaw 14y agoI'm ditching ePub. It's a crap format that has a bewildering number of options and it seems every viewer wants to implement some different subset of them. From now on, it's PDF and HTML only.
- 2mur 14y agoWhat I really like about LCTHW (after reading K&R and then just not doing anything with it) was starting you out using the tools and best practices right from the beginning. Make and valgrind up front. It got me over the hump of syntax&language --> actually using.
- ryansama 14y agoMost awesome. Even though it have plenty already, I would be more than happy to pay more for more chapters.
- jheriko 14y agoI did look at this book a while ago, I was unable to make amendments to the code examples. early versions made common C gotcha mistakes, although of the more subtle and less disasterous kinds... starting with non-standard entry-point function signature and generally relying on non-standard features of particular compilers. fortunately someone else seems to have gotten there in the end... i'd be wary, simply because the author is (as much as I am a fan of much of his work) clearly not an experienced C programmer.
- zedshaw 14y agoI am a very experienced C programmer, and I have full comments on any page. You find an error, drop a comment and I'll fix it immediately. Chances are though, you're someone who read the K&R chapter, then went through nitpicking minor semantics about things like "NULL is 0" and then consider all the code broken in the book. But, any errors you find, let me know and I'll fix them. Just don't call me an inexperienced C programmer.
- arturhoo 14y agoThere is a typo in the first sentence: "This will be the companion course to my new book, "Learn C The Hard Way" whch I'm working on right now". You probably want to fix that.
- LilValleyBigEgo 14y agoNo thanks I'd rather not sign up via Facebook.
- baby 14y agoIt's funny how, I started getting annoyed seeing people still learning to code on books while free tutorials were starting to pop up everywhere on internet. And now people are starting to charge for those tutorials. And I know people here in HN love Zed Shaw. But come on, there are hundreds of free great tutorials to learn C on internet.
- mitchi 14y agoI disagree with your disdain for IDEs... I hope that you are not totally misleading the people who will learn from your book because learning how to use the capabilities of Visual Studio or any decent IDE is very valuable. How are they going to debug complex graph data structures in their CS class if they don't have a great debugger? How are they going to understand the power of intellisense in modern programming? How are they going to learn about compiler flags without getting a headache? How much time are they going to waste compiling and linking with the commandline? I like the no-copy-paste and straight notepad approach trust me. It works for everyone, it's a solid way to get these things into your brain. You need to write code, there's no way around it. But to tell people to never use IDEs because they are bad and they make you a bad programmer is BULLSHIT.
- malkia 14y agoand what would they do if they cannot use this functionality, for example debugging something embedded, or something that cannot be debugged the way you pointed out
- zedshaw 14y agoIDEs are bad for you. It's much better to simply use a real programmer's editor that you can craft into being what you need. In fact, I can usually take vim plus cscope, exuberant ctags, and ack and demolish any code base you throw at me. Similar with emacs and other power editors. IDEs are usually useful if you're stuck using them to build GUIs or use specialized build tools they require.
- Ygg2 14y agoHow can IDE be bad for me? It's like saying a hammer is bad for me (Sure it is if I don't use it responsibly or correctly). And on C front I'd agree. There are no really good IDEs for C/C++ and the way they work/are used wouldn't benefit much from an IDE. If you are more productive in IDE over text, what is the benefit of using text editor?
- Tomis02 14y agoPlease dear wizard, here's a list of requirements for a fellow programmer that he can currently do with Visual Studio and wants to do the same with vim: - find in files (in vim, not in bash) - replace in files - rename symbol (uh-oh...) - quick open file in project (visual assist feature) - list of files in project (not in directory) - build system (something easy to use, not that make bullshit) - go to declaration/definition ( sometimes I get a list of 30 matches from ctags, so I would like something that actually works ) - view call hierarchy (callers, callees) - code completion (something that works and is easy to use, like in visual assist) - watches - breakpoints in disassembly - step into disassembly - memory view while debugging - edit & continue - memory (data) breakpoints We're talking about large C/C++ codebases, obviously. You might get 50% of the features above after tinkering for a few days/weeks/months with your vim with (probably) much worse usability, when you could have used Visual C++ from the get-go and enjoyed a "real programmer's editor", as you put it. This bullshit religion you are introducing only hurts potential programmers because instead of focusing on getting their job done they have to reinvent the wheel every time they have to write a line of code. I'm not saying it's a bad thing for a young mind to experience the horror of having to debug a 500.000 LOC codebase with a stone-age debugger, just for the kicks ("that's how your old man was programming back in the day, son"), but when you have to meet deadlines and release something going vim-only can quickly become a liability.