HN Books @HNBooksMonth

The best books of Hacker News.

Hacker News Comments on
C Programming Language, 2nd Edition

Brian W. Kernighan, Dennis M. Ritchie · 3 HN points · 36 HN comments
HN Books has aggregated all Hacker News stories and comments that mention "C Programming Language, 2nd Edition" by Brian W. Kernighan, Dennis M. Ritchie.
View on Amazon [↗]
HN Books may receive an affiliate commission when you make purchases on sites after clicking through links on this page.
Amazon Summary
The authors present the complete guide to ANSI standard C language programming. Written by the developers of C, this new version helps readers keep up with the finalized ANSI standard for C while showing how to take advantage of C's rich set of operators, economy of expression, improved control flow, and data structures. The 2/E has been completely rewritten with additional examples and problem sets to clarify the implementation of difficult language constructs. For years, C programmers have let K&R guide them to building well-structured and efficient programs. Now this same help is available to those working with ANSI compilers. Includes detailed coverage of the C language plus the official C language reference manual for at-a-glance help with syntax notation, declarations, ANSI changes, scope rules, and the list goes on and on.
HN Books Rankings
  • Ranked #15 this year (2024) · view
  • Ranked #17 all time · view

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this book.
I would like to take it a step further and ask a question that has been bothering me a while. On my time in the academy I studied the following two books (regarding C):

[1] Advanced Programming in the UNIX Environment https://www.amazon.com/Advanced-Programming-UNIX-Environment...

[2] C Programming Language https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

In combination with other classes (and books) on networking, operation systems, data structures we covered a big variance of use cases with C. My question is: How do I take this to the next level? For example I feel I never missed a concept from those classes but when I see C code posted on a thread here it's probably something completely unreadable and complex. Can anyone provide resources to advance a little? What should I study if my goal is to make good and useful modern C software?

I feel like my typing is a bit abstract but I will be happy to clarify.

PS Yes, I've heard of C++ and Rust ;P

zh3
[1] is a very good book - it's not really one for learning C though, it's more for when you know C and you need to use it in - well - an advanced unix environment. Sort of like you shouldn't be learning how to use a scalpel in an operating theatre :)
_osorin_
I got it for our operating systems class, it's not aimed to teach C from scratch. My bad for not clarifying.
belter
Start by reading Redis code, slowly take notes on paper, try to make your version changing small bits at a time.

https://github.com/redis/redis/tree/unstable/src

Entry point here at line 6816: https://github.com/redis/redis/blob/unstable/src/server.c

Also "Code Reading" will be useful. - https://www.amazon.com/Code-Reading-Open-Source-Perspective/...

"Code Reading" tends to be criticized, but I think mostly unfairly.

_osorin_
Thanks a lot for the recommendation.
For the professional programmer, knowing other languages and getting into C, besides the two great recommendations above, would recommend:

"C Programming: A Modern Approach, 2nd Edition" - https://www.amazon.com/C-Programming-Modern-Approach-2nd/dp/...

Note the above book is good for its quality as a reference, but not enterily considered as "modern". For a more updated approach I would also recommend:

"Modern C" - https://www.manning.com/books/modern-c

and

"Effective C" - https://nostarch.com/Effective_C

The first book on the language:

"C Programming Language, 2nd Edition" - https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

Is interesting from a historical perspective, but considered as not a recommended resource for learning C.

Edit: If you are learning C there is something quite important you need to know... C and C++ are two completely different languages, and that is how you should approach your learning. In other words, don't go learning the C in C++ :-)

belter
Edit: If you are learning C there something quite important you need to know... C and C++ are two completely different languages, and that is how you should approach your learning. In other words, don't go learning the C in C++ :-)
To start with, "The C Programming Langauge", Kernighan & Richie (K & R) [1]. Find the latest edition that you can buy.

I think the primary topic to master in C is pointers. This is where most falter. It takes a few years to "master" (if we ever do). Here I would recommend "Understanding and Using C Pointers", Richard Reese. [2]

If you are interested in networking, any of the classic "TCP/IP Illustrated Vols I/II/III", W. Richard Stevens, [3] contain a ton of C code to implement components of TCP/IP.

If you are interested in Graphics, then "Graphics Gems", Andrew Glassner [4] is a good source.

"An Introduction to GCC", Brian Gough, [5] to understand the tooling and its various bells and whistles.

My learning swimming by jumping into the deep end of the pool experience was realized by learning Windows Programming using the Charles Petzold book and navigating through Microsoft Foundation Classes in the late 80s/early 90s. The state of the art in tooling wasn't that great in those days and I spent months with the book to get things going. This was done after I had built a foundation with K&R and a decent amount of Unix network programming.

I see a lot of the other posts recommend more modern books. But you still need to build your foundation on C and Pointers in particular.

Good luck on your journey.

[1] https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

[2] https://www.amazon.com/Understanding-Using-Pointers-Techniqu...

[3] https://www.amazon.com/TCP-Illustrated-Protocols-Addison-Wes...

[4] https://www.amazon.com/Graphics-Gems-Andrew-S-Glassner/dp/01...

[5] https://www.amazon.com/Introduction-GCC-GNU-Compilers/dp/095...

C is a very simple language. I have used just the official old book to create a compiler for it:

https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

The best thing you can do is finding some open source code that interest you, read it and write it.

For example, I write my own controllers for CNCs, and there are lots of code for controlling stepper motors out there. I also learned OpenGL and sockets this way long time ago.

On the other hand, C is a terrible language for any big project unless you automate it some way.

I use mostly lisp in order to write C code automatically. C is too low level for writing any substantial code. Lisp has things like Macros(nothing to do with c macros) that can make you write code 10x, to 50x faster easily.

3fe9a03ccd14ca5
> The best thing you can do is finding some open source code that interest you, read it and write it.

Has reading source code in a language that’s unfamiliar to you shown to be of any real benefit to learning? It seems you need at least a little bit of foundational experience with it before your brain can even parse what you’re seeing in a beneficial way.

pritovido
>Has reading source code in a language that’s unfamiliar to you shown to be of any real benefit to learning?

Yes, I think so. The parent has experience with other languages, like python, javascript and go. C has a very similar paradigm. If it were clojure it would be different.

I find exposition to new languages real usage the best way to learn them. I went to the UK to learn english, Germany to learn German, could be painful at first, but works, specially if you know a little about what is all about.

Your brain makes sense of everything by itself in a magical way. That is the way you learn your native language.

dandigangi
I'd tend to agree here also. I didn't start reading source code until a couple years in because I couldn't really put it to use. It becomes 10x more valuable when I was deep into my career learning from the big shots.

It _can_ help no doubt but not sure that's the best way to start. Especially with a language like C. It's not so straight forward without some training or CS education.

clarry
> It becomes 10x more valuable when I was deep into my career learning from the big shots.

Yeah well OP said they've 15+ years of experience so..

> Especially with a language like C. It's not so straight forward without some training or CS education.

I agree with pritovido, when they say C is a very simple language. Sure, it has grown its quirks and gotchas along with some cruft (the kind of things you wouldn't learn about in a CS curriculum anyway), but at its core it really is very simple.

johnisgood
I learnt coding (first language was C) by having found an open source game that I wanted to improve. In another comment someone mentioned "finding idiomatic patterns and "oh, so that's how they do it" kind of things" which is absolutely true, that is how I managed to actually write C without knowing anything about coding and C! I have not read a single book on programming. I just did it. Examples, documentations, manual pages, and so forth along with trial and error were my guide.
hombre_fatal
For me there's almost no wisdom to assimilate when reading source code until I've given a fair shot at using the language and experiencing its obstacles. Then seeing other people overcome them is where almost all of the a-ha moments are.
clarry
> Has reading source code in a language that’s unfamiliar to you shown to be of any real benefit to learning?

Absolutely! You start finding idiomatic patterns and "oh, so that's how they do it" kind of things. Find library functions you never knew about but now you do. Find weird things, and look them up in a manual/reference/SO/chatroom. Things that you might find in a book, but a book that covers all the idioms and practice and weird things is gonna be as thick as the bible, and it'll get outdated (it doesn't help that most books are focused on teaching the basics rather than showing off how to architect your application well). Things that you can learn the hard way by why not look and see and learn?

> It seems you need at least a little bit of foundational experience with it before your brain can even parse what you’re seeing in a beneficial way.

Nah, you just need programming experience (in a similar paradigm) in general. A lot of what you learned from languages before will translate.

Also OP mentioned that "I can write C" and "I've started reading 'Modern C'", so it's not like they're looking for their first Hello World snippet.

OP said they've got 15+ years of programming experience. At that point, picking up a new language is all about learning the vocabulary and idioms, plus the few unique or tricky or quirky things that don't show up in other languages (or that aren't obvious from looking at code). The fastest way to get to that vocabulary is to look at real code.

ctas
You use Lisp to write C (on Microcontrollers)? Would appreciate more info on that.
cjbprime
Not the OP, but as I understand it NASA's JPL has been doing this for decades for space missions.
williamDafoe
That a horrific mistake that MIT nitwhits used to teach students at the end of 6.001 - how to write opaque, horrible lisp programs in languages such as "C".
slowandcurious
You could consider this. https://ferret-lang.org/
kahlonel
> C is too low level for writing any substantial code.

Do people not realize that projects like Linux and pretty much every car's ECU software (pretty "substantial" in my opinion) is written in C before claiming this? I'm not saying these software are 100% bug free, but this claim isn't accurate either. You _can_ write substantial C code when you have a good understanding of the tooling around it. Mere learning the syntax isn't enough.

johnisgood
That, and I dislike the low-level vs high-level differentiation. It is relative, and more of a spectrum, IMO, and not that it is particularly useful anyway.
fulafel
Lots of old software has been written in "too low level" tools by today's standards.
sramsay
I'm so tired of hearing about what you can't do in C and the "only thing" it's good for. You can't write big systems. It's only for embedded.

It's such a crackup, because the number of developers who haven't got the memo on this is really staggering. How many lines of code is GTK? Or Postgres? Or Nginx? Never mind languages and operating systems.

I suppose Vim (~335,000 lines) or git (in the 200,000 range) is not "large" in comparison to some things, but I suspect that's actually the kind of number people think is "too big for C."

People also seem not to realize that the reason that Python library is so fast, is because it's actually wrapping C code. And that code is very often not doing some frighteningly low-level thing, but just doing ordinary stuff.

samatman
The "steel man" version of this argument is that, if you're embarking on a new codebase which you have good reason to expect will grow to be large, have a very good reason to write it in C, or use a more appropriate language.

There some reasons to do it, but fewer than there were when most of the projects you've name-checked were started.

I'll skip the part where we review what the other options are, this is HN, we've all seen that thread before.

acqq
Knowing how some big software systems lived through more than a decade each, I'd claim that the less they used C++ and the more used C++ compilers to write a C-like code they were better. The worst parts of the project were exactly those that used the "cool" C++ features.

C is much better for really long-lived projects than C++ is. C++ is a maintenance nightmare in comparison.

Linux kernel is also a good and famous big long-lived project which I claim would have never even survived had it been written in C++. Linus seems to have believed the same.

jcelerier
> C++ is a maintenance nightmare in comparison.

c'mon, all the super large projects - adobe software, ableton live, blender, autodesk, 3DS max, maya... all the major game engines (UE, CryEngine, Frostbite, etc), are written in C++, not in C. LLVM & clang are C++, and GCC is all C++ in new code with a fair amount of old code ported from C. All the major web browsers are C++ - and I'd wager most minor too.

If what you said was true we'd see much more massive projects in C and much less in C++ yet here we are.

sramsay
I think you might be missing the main point of what this person is saying, which is:

"I'd claim that the less they used C++ and the more used C++ compilers to write a C-like code"

And I bet that's true. I doubt there's layers and layers of template metaprogramming in Ableton Live, or that Maya is a study in inheritance. Game engines, certainly, are C++ written as so-called "better C."

"Yet here we are" -- a place where people reinvent C and call it "data-oriented programming." /s

jcelerier
> I doubt there's layers and layers of template metaprogramming in Ableton Live, or that Maya is a study in inheritance

I doubt both of your assertions - public Ableton code uses templates fairly liberally ( https://github.com/Ableton/link/search?q=template&unscoped_q...) - and due to backtrace exposure I know that this is also the case for private implementation things.

For Maya just look at the plug-in API :

https://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__files...

https://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__files...

https://help.autodesk.com/view/MAYAUL/2017/ENU/?guid=__cpp_r...

command pattern, factories, etc... it's textbook OOP.

Also, most projects in the wild nowadays are C++11 or later, with actual use of C++11 language features. e.g. look for example OpenAGE, an AOE2 reimplementation - https://github.com/SFTtech/openage/blob/master/libopenage/jo...

That kind of thing is as far as "C with classes" as is possible.

acqq
> most projects in the wild nowadays are C++11 or later

Which means either that their codebase is less than a decade old, or there were serious rewrites involved. Which fits my initial statement: historically, long term (T > 10 years), successful projects should have better used C++ as C-like as possible (or just used C).

I'm not claiming it's not possible to have successful projects using C++ lasting long, just that it would be, long-term (really long term), less overhead to use C for big projects.

Êdit: My personal bias: I was involved in two long-lasting projects, where just dealing with boost dependencies used up more maintenance time than it would have been needed for experienced developers to develop the code which didn't depend on boost. But of course, those who used boost didn't have such an experience to make such calls, and in initial development "look how fast we have a feature x" wins.

I personally consider Google's C++ style guide limiting Boost use as one of the best examples of some influence of some experienced developers on the policies.

jcelerier
> or there were serious rewrites involved

why do you assume that ? if someone was using, say, "Modern C++ Design: Generic Programming and Design Patterns Applied" from Alexandrescu (released in 2001!) as a guideline when writing one's codebase, "migration" to C++11 is maybe replacing some custom types by std ones for stuff like mutexes and threads, etc. but all the architecture would stay pretty similar.

> Which fits my initial statement

I really don't see how - all those projects I listed are successful, you seem to be saying that it is despite of C++ but I don't see any argument towards that. I personally don't know anyone who would willingly go back to writing large-scale projects in C after working in C++.

sramsay
I take your point about the age of some of these projects (though it's not like there weren't any "more appropriate" languages around when most of them started). And I'll also admit to agreeing with the idea that choice of language is nearly always a sociological matter before it's a technical one.

But I'm not really arguing that C is the best choice for large projects. I'm just pointing out the fact that many, many people just completely ignore that advice. They are ignoring that advice today -- right now. With new projects. And they've "seen that thread before" too. It's not just legacy, or lack of awareness, or whatever.

Maybe it comes down to what the "very good" reason actually is. Because given the amount of C hacking going on, I wonder if the "good reasons" we hear about nearly every day on HN aren't the most important ones for the quite vast number of people merrily hacking away in a language that is now decades old.

pjmlp
As the CVE database proves, just because one can do it, doesn't mean one should do it.

Liability can't come soon enough.

Cyph0n
As someone who works on a significant C codebase (IOS-XR), my 2 cents:

1. Most of the large userspace C codebases that still exist today didn’t have many alternatives when they were started.

2. Any non-trivial C codebase relies much more on runtime testing than other languages. In other words, with other languages, you can get away with fewer tests while achieving the same level of quality.

Note that you should be striving for comprehensive tests regardless of language; this is just an observation.

As far as I know, prices of books differ between rich and developing nations. For e.g., The C Programming Language that costs $50 in the US [1], is sold for Rs. 259 (~$4 US) in India. I believe that is the case with most "economy editions" specifically targeted at developing nations. It certainly isn't an "year's wages".

While I do understand your point, it still does not justify encouraging modern-day Robinhoods' and breaking the law.

[1] https://www.amazon.com/Programming-Language-2nd-Brian-Kernig... [2] https://www.amazon.in/Programming-Language-Kernighan-Dennis-...

guidoism
Economy editions are nice, but only make up a tiny fraction of what's out there to consume. Again, $4 is great for a relatively rich nation like India, but what about Eritrea?

Maybe that was a little flippant, but The Law in a big rich country is pretty meaningless to someone trying to make a better life for themselves in a poor country.

esotericn
Hi.

You're speaking to someone from the UK. When I grew up we had to walk uphill both ways, to quote the Four Yorkshiremen sketch.

I couldn't afford to buy things like books, operating systems, games, etc. We spent the money on food, rent, and on the Internet.

People like that past version of me are going to pirate regardless of what you say. Law breaking? You can't see me grinning ear to ear.

I like to think my tax bill makes up for that.

The C language can be best learned from "The C Programming Language, 2nd Ed" [1], also known as "K&R book". Pair it with excellent notes by Steve Summit [2], and you don't need any other book to master C.

[1] https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

[2] https://www.eskimo.com/~scs/cclass/notes/top.html

boring_twenties
No doubt K&R is second to none, but it only covers C89. Since then we have 99, 11 and apparently now 17 too?
whydoyoucare
A useful approach is to learn 95% of the language from K&R, and then refer to the newer standards for the incremental changes.

If there is a book as good as K&R and covers the new ideas, I'm interested to learn about it! :-)

AbeBooks is a great place to buy the non-US versions of textbooks (which are almost always identical to the US version, but in grayscale rather than in color).

For instance, on Amazon, the K&R C Programming book goes for $28.52 used, $61.74 new, or $28.70 for a one semester rental [0]. For a book that hasn't changed since 1988, these prices are absurd.

While as on AbeBooks, the international edition goes for $10-11 [1].

[0]: https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

[1]: https://www.abebooks.com/servlet/SearchResults?bi=0&bx=off&c...

analogmemory
I bought two books for school from them that would have been normally $100 each, for like $30 each. The pages were as thin as a phone book, and had a Xerox quality. Basically pirate copy
setquk
Results are somewhat variable yes. I’ve had reprinted scans turn up and totally trashed books. Success rate is about 3 in 5 though which isn’t bad considering the failures are quicky refunded.

Some of the eBay sellers are better priced and have better overall outcomes though due to the very short span that hooky sellers last.

Indispensable:

https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...

cimmanom
This. It’s called the “bible” for a reason. I learned to program largely by reading that book.
May 07, 2017 · lossolo on My Struggles with Rust
I don't share your opinion and most people I know that do C do not share it also. It's good base to get familiar with language, no one say you can't expand your knowledge further after reading this book.

I've read some other "modern" books about C like "21st century C" but they are not for people that do not know C and they are not so good for people that know it.

Can you provide any arguments to support what you wrote? What alternative you would propose for learning C?

https://www.amazon.com/Programming-Language-Brian-W-Kernigha...

Read what majority of opinions say. It's really easy to criticize without giving better alternative.

C is a very "strict" language. It do the right thing only if you write the right code. It has many undefined behaviors. One of the undefined behaviors I found when I studied the compiler course. The purposed grammar from https://www.amazon.com/Programming-Language-Brian-W-Kernigha... allows this kind of structure, there can be statements after the switch but before the case labels. gcc also accepts this, but those statements will not be executed. Note: code modified from https://www.tutorialspoint.com/cprogramming/switch_statement...

#include "stdio.h"

int main () {

   /* local variable definition */
   char grade = 'B';
   int a = 1;

   switch(grade) {
      printf("great!\n" );
      a = a + 1;
      
      case 'A' :
         printf("Excellent!\n" );
         break;
      case 'B' :
      case 'C' :
         printf("Well done\n" );
         printf("a: %d\n", a);
         break;
      case 'D' :
         printf("You passed\n" );
         break;
      case 'F' :
         printf("Better try again\n" );
         break;
      default :
         printf("Invalid grade\n" );
   }
   
   printf("Your grade is  %c\n", grade );
 
   return 0;
}
Why did people think otherwise? Chapter 5 of K&R[1] is titled Pointers and Arrays and basically explains that arrays and pointers are equivalent.

[1]: https://www.amazon.com/Programming-Language-Brian-W-Kernigha...

None
None
notacoward
The point of the article is that sometimes they're not equivalent, and that creates a lot of confusion. Please read it before commenting on it.
ams6110
I thought the same things as GP. Anyone who has read K&R (as any C programmer ought to have) will know everything in this article.
mwfunk
I'd go so far as to say that any C programmer at all (whether or not they've read K&R) will know everything in this article. However, it's probably interesting or useful for people who are either in the process of learning C, or people who have to read and write it occasionally, but never truly learned the language. These are definitely all pain points for people coming to C from higher-level languages.
notacoward
I don't think that's true. While I don't have my copy of K&R handy, I don't recall it covering all the subtleties of how assignment and increment operators and sizeof will work differently for something declared as an array vs. something declared as a pointer. At least in the edition I've had, it just had the same "pointers and arrays are equivalent" which is misleading in exactly the way this article describes. Did that get added in your much-later edition?
kazinator
Arrays and pointers are never equivalent. One is a clump of like-sized objects allocated consecutively; the other is a referential type indicating the location of an object or function.
Nov 28, 2016 · pieterr on Modern C [pdf]
K&R: https://www.amazon.com/gp/aw/d/0131103628/
weaksauce
Is that still relevant to how c looks and acts nowadays? I know you will learn a lot from it and it's an excellent book, but surely there is a better reference that is more up to date. Maybe not though.
joeberon
I think it's still really helpful to learn C and as a reference, but the code has a very terse and difficult to read style that I wouldn't recommend actually coding in, for example this is introduced in the first chapter, before anything is even studied in depth: https://www.dropbox.com/s/4hbwyid5jwen43t/Screenshot%202016-...
joeberon
K&R is amazing, really makes you appreciate how simple C is as a language
I learned programming without a computer in the 90s with Kernigan & Ritchie "C Programming Language", one of the best coding books ever written:

https://www.amazon.com/Programming-Language-Brian-W-Kernigha...

I'd also learn SICP: https://www.amazon.com/Structure-Interpretation-Computer-Pro...

and algorithms from either CLRS https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press... or Skiena Algorithm Design https://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena...

corysama
Along with SICP, The Little Schemer would be a great book to work through on paper. https://mitpress.mit.edu/books/little-schemer

Once that is worked through, Godel, Escher, Bach would be an especially entertaining and enlightening read.

Oct 03, 2016 · hyperliner on C Is Not Reasonable
I am just going to leave this here:

https://www.amazon.com/Programming-Language-Brian-W-Kernigha...

What's the rush?

http://norvig.com/21-days.html

Learning C is difficult because you need to know how the machine actually works. Trust me, there are no shortcuts. The year can be 2036, learning C will be the same.

With that said, these books are excellent:

http://www.amazon.com/Programming-Language-Brian-W-Kernighan...

http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp...

http://www.amazon.com/Primer-Plus-6th-Developers-Library/dp/...

GregBuchholz
The Peter van Linden book: Expert C Programming is available on-line:

http://www.madar.com.pl/demo/expert.pdf

Mar 04, 2016 · percept on Go by Example
I looked forward to a complete chapter on IO (not unlike http://www.amazon.com/Programming-Language-Brian-W-Kernighan...), but didn't see one.

Perhaps a future edition...

Jun 23, 2015 · echeese on C Puzzles
You can get a copy here: http://www.amazon.com/dp/0131103628
Some love for - The C Programming Language - Kerninghan & Ritchie -

http://www.amazon.com/The-Programming-Language-Brian-Kernigh...

theGREENsuit
I have this book at home, have read it and although it covers a lot in a short volume, I didn't get out of it as much as I did out of C Programming: A Modern Approach by KN King. Once I bought King's book, C made a lot more sense, the book was fun to read and follow. K&R's book was, to me, less "how & why" but more "how". Pointers, in particular, is what I enjoyed more in King's book. That chapter alone made buying the book worth its money.
For those of you who are not familiar with "The C Programming Language" (also written by Kernighan), see: http://www.amazon.com/C-Programming-Language-2nd/dp/01311036...
Jan 28, 2015 · 3 points, 0 comments · submitted by norseboar
It was released years ago: http://www.amazon.com/dp/0131103628
Reposting an earlier comment of mine https://news.ycombinator.com/item?id=6530180 with context https://news.ycombinator.com/item?id=6526412 :

> pjmlp 211 days ago | link | parent | flag

> Nice article, but it fails to explain the experience using Smalltalk environment really is. Smalltalk, like Lisp Machines, was originally a blend of GUI operating system, development environment and the first real IDE.

> agumonkey 211 days ago | link

> It's funny. Unix was also meant as an IDE (persistency, logic, machine and user interfaces). It seems they all were trying to reach the same goal in their own way. -----

> 2 points by leoc 210 days ago | link

> The fact that dc was originally intended as basically the Unix system's bignums library http://www.catb.org/esr/writings/taoup/html/ch08s02.html#id2.... helped to open my eyes to this. I think you could talk about this idea of Unix as "big Unix" and the narrower understanding of Unix programming, dominated by the C APIs, as "little Unix". Little Unix took over the world, while big Unix collapsed under its own weight due to things like portability/versioning hell, robustness problems due to faulty tools and text-parsing errors, performance issues and so on. (Partly this was a success catastrophe, of course, for example in how the popularity of Unix resulted in a profusion of different Unix userlands with varying interfaces and bugs.) Also little Unix was more comprehensible from, and more portable to and from, the world of PC (MS-DOS/Windows/Mac) application development, where the environment is more or less the kernel's/OS vendor's APIs. The fact that clearly many more people have bought or read K&R http://www.amazon.com/dp/0131103628/ (with its very little-Unix perspective) than /The Unix Programming Environment/ http://www.amazon.com/dp/013937681X reflects this divergence, and also surely helped to create it.

frik
Unix was Multics little brother: http://en.wikipedia.org/wiki/Multics
Some helpful starting points:

Learn about the Unix Way: http://c2.com/cgi/wiki?UnixWay

Learn about crufty neckbeard stuff: http://doc.cat-v.org/programming/

(cat-v has all kinds of interesting things)

Learn C: http://c.learncodethehardway.org/book/

No, really, learn C: http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/...

Learn about networking with sockets: http://www.beej.us/guide/bgnet/

(it's in C, but the principles are in other language bindings as well)

Devops/sysadminning is mostly just damned superstition and voodoo and hard-fought experience...that said, consult notes from others: http://users.cis.fiu.edu/~tho01/psg/

~

If you want more hands-on experience, setup a VPS and make something: http://feross.org/how-to-setup-your-linode/

If you find stuff in there you don't understand, ask your devs for help.

Only the good parts:

http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/...

protomyth
What an amazingly unhelpful, snarky, useless comment. If you don't like the question or I guess the topic, just skip it.
angersock
You're more likely to find up-to-date and useful resources on the 'net then in a dead-tree form.

Moreover, you aren't likely to be able to write any meaningful code without cruft, because you'll have to use existing libraries, where that cruft lives.

Giving you a reference to writing C properly--something most folks still don't do--is actually somewhat helpful as opposed to pure snark.

Does C++ have a fixed ABI yet? Is there a fixed name-mangling scheme across compilers? How do I bind other languages to the lambdas?

protomyth
No, its just pure snark. C and C++ are long different. I love K&R[1] C, but is really doesn't show properly written C unless some update occurs that addresses the newer standards and all the fun memory issues.

> Does C++ have a fixed ABI yet? Is there a fixed name-mangling scheme across compilers? How do I bind other languages to the lambdas?

Pretty useless for the purpose of my question. I was asking a simple question, your just in it to spread snark.

1) The original edition was one of my favorite books and what I used to learn C back in the day.

The fact that dc was originally intended as basically the Unix system's bignums library http://www.catb.org/esr/writings/taoup/html/ch08s02.html#id2... helped to open my eyes to this. I think you could talk about this idea of Unix as "big Unix" and the narrower understanding of Unix programming, dominated by the C APIs, as "little Unix".

Little Unix took over the world, while big Unix collapsed under its own weight due to things like portability/versioning hell, robustness problems due to faulty tools and text-parsing errors, performance issues and so on. (Partly this was a success catastrophe, of course, for example in how the popularity of Unix resulted in a profusion of different Unix userlands with varying interfaces and bugs.) Also little Unix was more comprehensible from, and more portable to and from, the world of PC (MS-DOS/Windows/Mac) application development, where the environment is more or less the kernel's/OS vendor's APIs. The fact that clearly many more people have bought or read K&R http://www.amazon.com/dp/0131103628/ (with its very little-Unix perspective) than /The Unix Programming Environment/ http://www.amazon.com/dp/013937681X reflects this divergence, and also surely helped to create it.

As many people have said, no, you're not too old to get started. And despite what some people might say, a multi-year degree program, with a decent GPA, is a great way of showing employers that you're a decent potential candidate.

That said, software engineering is one of the fields you can get employment without a degree, provided you can 'show your work'. The hard part is building up your skills in a way that can easily be demonstrated. The common wisdom these days is to create a github profile, build some interesting things, commit to some open-source libraries, and use your profile as a resume of sorts.

Here's interesting article on being a well-rounded programmer: http://jasonrudolph.com/blog/2011/08/09/programming-achievem...

We're also in a 'golden age' of self-guided learning, with online tools to help learning galore, here are a few:

http://codecademy.com http://www.codeschool.com/ https://www.khanacademy.org/cs

Also, get a few decent books on "Programming 101". Common wisdom suggests you learn C, one of Ruby/Python, Java, and a functional language like Haskell. Here are some good books to learn from:

The C Programming Language (some people say you should start here, I'm one of them!): http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...

Learning Python: http://www.amazon.com/Learning-Python-Powerful-Object-Orient...

Learning Java: http://www.amazon.com/Learning-Java-Patrick-Niemeyer/dp/0596...

I hope you do choose programming as a career, its been very rewarding for me :)

boingyjump
Thank you for taking the time to put together the links! The "show your work" part feels like the hardest, but I guess that's just something I have to push towards to figure out. As an aside, do you know anyone who's learned successfully from codecademy/codeschool? I love the idea of them, they just seem really simplistic.
chadnickbok
The are quite simplistic, but that's kind of a feature - Use them to get down 'the basics', before moving onto actually using languages to solve problems. There's no better way to learn than through building actual 'things'.

As an aside, my very first introduction to Python was competing with a friend, building scripts that would automatically create accounts on a forum, login to those accounts, and then use them to give ourselves 'karma'. That weekend I learned more than I'd ever known about Python, HTTP and web scraping. Its a silly example, but mini projects like that can really help you learn.

johnjlocke
When you're first starting, you have to be simplistic. That is the target audience anyway. The ability to write code is going to continue to be in demand, and there are not enough people with the necessary experience to fill some of the positions out there.

How to solve the problem? Start developing tomorrow's programmers today.

michaelochurch
I'm injecting my own language bias here, and I must admit that this is not an opinion that everyone agrees with, but I think you're better with Scala or Clojure than with Java. (Both run on the JVM, so you end up learning the Java ecosystem.)

Scala is a "better Java" and you can learn both the JVM and functional programming (take Odersky's course on Coursera). Clojure is a great Lisp but the Java stuff will be very confusing if you haven't seen it before (the JVM-interop functions like proxy, gen-class, and reify don't have the easiest APIs).

This (Structure and Interpretation of Computer Programs) is a great book to get started on the deeper aspects of CS: http://mitpress.mit.edu/sicp/full-text/book/book.html

Also, I like this one: http://www.amazon.com/Concepts-Techniques-Models-Computer-Pr...

Nov 27, 2012 · robomartin on I’m writing my own OS
OK, if you don't have any real experience in low-level embedded coding (relevant to device drivers), RTOS or OS design in general, file systems, data structures, algorithms, interfaces, etc. And, if you have "hobby level" experience with Assembler, C and C++. And, if your intent is to write a desktop OS, from the ground up, without making use of existing technologies, drivers, file systems, memory management, POSIX, etc. Here's a list of books that could be considered required reading before you can really start to write specifications and code. Pick twenty of these and that might be a good start.

In no particular order:

1- http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/...

2- http://www.amazon.com/The-Answer-Book-Solutions-Programming/...

3- http://www.amazon.com/The-Standard-Library-P-J-Plauger/dp/01...

4- http://www.amazon.com/C-Traps-Pitfalls-Andrew-Koenig/dp/0201...

5- http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp...

6- http://www.amazon.com/Data-Structures-In-Noel-Kalicharan/dp/...

7- http://www.amazon.com/Data-Structures-Using-Aaron-Tenenbaum/...

8- http://www.amazon.com/Mastering-Algorithms-C-Kyle-Loudon/dp/...

9- http://www.amazon.com/Code-Complete-Practical-Handbook-Const...

10- http://www.amazon.com/Design-Patterns-Elements-Reusable-Obje...

11- http://www.amazon.com/The-Mythical-Man-Month-Engineering-Ann...

12- http://www.amazon.com/The-Programming-Language-4th-Edition/d...

13- http://www.amazon.com/The-Standard-Library-Tutorial-Referenc...

14- http://www.amazon.com/API-Design-C-Martin-Reddy/dp/012385003...

15- http://www.amazon.com/The-Linux-Programming-Interface-Handbo...

16- http://www.amazon.com/Computer-Systems-Programmers-Perspecti...

17- http://www.amazon.com/System-Programming-Unix-Adam-Hoover/dp...

18- http://www.amazon.com/Memory-Programming-Concept-Frantisek-F...

19- http://www.amazon.com/Memory-Management-Implementations-Prog...

20- http://www.amazon.com/UNIX-Filesystems-Evolution-Design-Impl...

21- http://www.amazon.com/PCI-System-Architecture-4th-Edition/dp...

22- http://www.amazon.com/Universal-Serial-System-Architecture-E...

23- http://www.amazon.com/Introduction-PCI-Express-Hardware-Deve...

24- http://www.amazon.com/Serial-Storage-Architecture-Applicatio...

25- http://www.amazon.com/SATA-Storage-Technology-Serial-ATA/dp/...

26- http://www.amazon.com/Beyond-BIOS-Developing-Extensible-Inte...

27- http://www.amazon.com/Professional-Assembly-Language-Program...

28- http://www.amazon.com/Linux-Kernel-Development-3rd-Edition/d...

29- http://www.amazon.com/Version-Control-Git-collaborative-deve...

30- http://www.amazon.com/Embedded-Software-Primer-David-Simon/d...

31- http://www.amazon.com/Programming-Embedded-Systems-C/dp/1565...

32- http://www.amazon.com/Making-Embedded-Systems-Patterns-Softw...

33- http://www.amazon.com/Operating-System-Concepts-Abraham-Silb...

34- http://www.amazon.com/Performance-Preemptive-Multitasking-Mi...

35- http://www.amazon.com/Design-Operating-System-Prentice-Hall-...

36- http://www.amazon.com/Unix-Network-Programming-Sockets-Netwo...

37- http://www.amazon.com/TCP-Illustrated-Volume-Addison-Wesley-...

38- http://www.amazon.com/TCP-IP-Illustrated-Vol-Implementation/...

39- http://www.amazon.com/TCP-Illustrated-Vol-Transactions-Proto...

40- http://www.amazon.com/User-Interface-Design-Programmers-Spol...

41- http://www.amazon.com/Designing-Interfaces-Jenifer-Tidwell/d...

42- http://www.amazon.com/Designing-Interfaces-Jenifer-Tidwell/d...

43- http://www.amazon.com/Programming-POSIX-Threads-David-Butenh...

44- http://www.intel.com/p/en_US/embedded/hwsw/software/hd-gma#d...

45- http://www.intel.com/content/www/us/en/processors/architectu...

46- http://www.intel.com/p/en_US/embedded/hwsw/hardware/core-b75...

47- http://www.hdmi.org/index.aspx

48- http://en.wikipedia.org/wiki/Digital_Visual_Interface

49- http://www.amazon.com/Essential-Device-Drivers-Sreekrishnan-...

50- http://www.amazon.com/Making-Embedded-Systems-Patterns-Softw...

51- http://www.amazon.com/Python-Programming-Introduction-Comput...

52- http://www.amazon.com/Practical-System-Design-Dominic-Giampa...

53- http://www.amazon.com/File-Systems-Structures-Thomas-Harbron...

54- ...well, I'll stop here.

Of course, the equivalent knowledge can be obtained by trial-and-error, which would take longer and might result in costly errors and imperfect design. The greater danger here is that a sole developer, without the feedback and interaction of even a small group of capable and experienced programmers could simply burn a lot of time repeating the mistakes made by those who have already trenched that territory.

If the goal is to write a small RTOS on a small but nicely-featured microcontroller, then the C books and the uC/OS book might be a good shove in the right direction. Things start getting complicated if you need to write such things as a full USB stack, PCIe subsystem, graphics drivers, etc.

tagada
The guy don't want to write a perfectly designed OS, neither he wants to design a RTOS by the way ... He didn't even specify whether his OS would be multitask. If not, no need for any scheduling at all, huh ... he just "writes his own OS". It's a fun experience, very rich and very teaching. But at least now, we all can admire the wideness of all your "unlimited knowledge" especially in terms of titles of books. Afterall, no needs for creating a new OS, if you get all your inspiration from things that already exists. You will end with Yet Another Nix ... Not sure he wants a YanOS, though.

Without talking about filesystems, drivers, memory managment or existing norms and standards (which it seems he wants to avoid ... which is not that stupid ... all having been designed 40 years ago ... who knows maybe he'll have a revolutionary idea, beginning from scratch), going from scratch with no exact idea of where you go could be a good thing. Definitely. You solve the problem only when you face them. Step by step, sequentially. Very virile, man.

I would advice the guy to start obviously with the boot loader. Having a look at the code of GRUB (v1), LILO, or better yet, on graphical ones (BURG, GAG or this good one XOSL which is completely under GUI - mouse pointer, up to 1600x1200 screens, and many supported filesystems, written in ASM ... it could actually be a hacking basis for a basic OS on itself) could be a great source of inspiration, and beginning to play directly with the graphical environment.

You could also have a look on these things http://viralpatel.net/taj/tutorial/hello_world_bootloader.ph... and of course on Kolibri OS http://kolibrios.org/en/?p=Screenshots

tagada
Blah, blah, blah ...

Better advice would be: Try, make mistakes, learn from them, continue.

Way, way, way less discouraging, pessimistic and above all pedantic.

derefr
> If the goal is to write a small RTOS on a small but nicely-featured microcontroller, then the C books and the uC/OS book might be a good shove in the right direction. Things start getting complicated if you need to write such things as a full USB stack, PCIe subsystem, graphics drivers, etc.

I've always wondered if there could be created some way to skip this step in [research] OS prototyping, by creating a shared library (exokernel?) of just drivers, while leaving the "design decisions" of the OS (system calls, memory management, scheduling, filesystems, &c.--you know, the things people get into OS development to play with) to the developer.

People already sort of do this by targeting an emulator like VirtualBox to begin with--by doing so, you only (initially) need one driver for each feature you want to add, and the emulator takes care of portability. But this approach can't be scaled up to a hypervisor (Xen) or KVM, because those expect their guest operating systems to also have relevant drivers for (at least some of) the hardware.

I'm wondering at this point if you could, say, fork Linux to strip it down to "just the drivers" to start such a project (possibly even continuing to merge in driver-related commits from upstream) or if this would be a meaningless proposition--how reliant are various drivers of an OS on OS kernel-level daemons that themselves rely on the particular implementation of OS process management, OS IPC, etc.? Could you code for the Linux driver-base without your project growing strongly isomorphic structures such as init, acpid, etc.?

Because, if you could--if the driver-base could just rely on a clean, standardized, exported C API from the rest of the kernel, then perhaps (and this is the starry-eyed dream of mine) we could move "hardware support development" to a separate project from "kernel development", and projects like HURD and Plan9 could "get off the ground" in terms of driver support.

robomartin
A lot depends on the platform. If the OS is for a WinTel motherboard it is one thing. If, however, the idea is to bypass driver development for a wide range of platforms it gets complicated.

In my experience one of the most painful aspects of bringing up an OS on a new platform is exactly this issue of drivers as well as file systems. A little google-ing quickly reveals that these are some of the areas where one might have to spend big bucks in the embedded world in order to license such modules as FFS (Flash File System) with wear leveling and other features as well as USB and networking stacks. Rolling your own as a solo developer or even a small team could very well fit into the definition of insanity. I have done a good chunk of a special purpose high-performance FFS. It was an all-absorbing project for months and, realistically, in the end, it did not match all of the capabilities of what could be had commercially.

This is where it is easy to justify moving into a more advanced platform in order to be able to leverage Embedded Linux. Here you get to benefit and leverage the work of tens of thousands of developers devoted to scratching very specific itches.

The down-side, of course, is that if what you need isn't implemented in the boad support package for the processor you happen to be working with, well, you are screwed. The idea that you can just write it yourself because it's Linux is only applicable if you or your team are well-versed in Linux dev at a low enough level. If that is not the case you are back to square one. If you have to go that route you have to hire an additional developer that knows this stuff inside out. That could mean $100K per year. So now your are, once again, back at square one: hiring a dev might actually be more exoensive than licensing a commercial OS with support, drivers, etc.

I was faced with exactly that conundrum a few years ago. We ended-up going with Windows CE (as ugly as that may sound). There are many reasons for that but the most compelling one may have been that we could identify an OEM board with the right I/O, features, form factor, price and full support for all of the drivers and subsystems we needed. In other words, we could focus on developing the actual product rather than having to dig deeper and deeper into low-level issues.

It'd be great if low level drivers could be universal and platform independent to the degree that they could be used as you suggest. Obviously VM-based platforms like Java can offer something like that so long as someone has done the low-level work for you. All that means is that you don't have to deal with the drivers.

To go a little further, part of the problem is that no standard interface exists to talk to chips. In other words, configuring and running a DVI transmitter, a serial port and a Bluetooth I/F are vastly different even when you might be doing some of the same things. Setting up data rates, clocks, etc. can be day and night from chip to chip.

I haven't really given it much thought. My knee-jerk reaction is that it would be very hard to crate a unified, discoverable, platform-independent mechanism to program chips. The closest one could possibly approach this idea would be if chip makers were expected to provide drivers written to a common interface. Well, not likely or practical.

Not an easy problem.

derefr
> It'd be great if low level drivers could be universal and platform independent to the degree that they could be used as you suggest. Obviously VM-based platforms like Java can offer something like that so long as someone has done the low-level work for you. All that means is that you don't have to deal with the drivers.

Another thought: if not just a package of drivers, then how stripped down (for the purpose of raw efficiency) could you make an operating system intended only to run an emulator (IA32, JVM, BEAM, whatever) for "your" operating system? Presumably you could strip away scheduling, memory security, etc. since the application VM could be handling those if it wanted to. Is there already a major project to do this for Linux?

As you're interested in electronics you may be interested in Arduino, which you can program in C (and perhaps some other languages too). If you do decide to pick C, I'd really recommend picking up a copy of K&R's "The C Programming Language": http://www.amazon.com/C-Programming-Language-2nd-Edition/dp/...

You're also interested in games, so you could consider Python and the PyGame library: http://www.pygame.org/ Or if you want to go with C, try the allegro library: http://alleg.sourceforge.net/index.html (Learning this library was what taught me C, after picking up the basics of C I picked up the rest as I went along).

End of the day though, just pick something and learn it. It's better to be learning than worrying about what to learn.

JJKraMer
I'm already quite familiar with arduino as we used it a bit at school(had a project where we built and programmed dmx-ethernet converter with an add-on dmx-shield) and took bit of intrest in arduinos.

I said I have some experience with C -based languages, but that doesnt mean i would be sticking with just C, as i have have taken strong interest in C++, which is likely going to be my #1 language.

Python sounds decent, but i heard some heavy recommendations to learn Lua for the games from my contacts working on gaming companies (in finland there are loads of smaller and bigger gaming companies rightnow...)

Anyway as I have been discussing about this with my friends and contacts I've gotten an impression that I should also Learn some kind of web -enviroment programming/scripting language such as jsc or php (though I've been considering mostly learning some Lisp and proceeding to Perl)

Currently my cocktail of languages looks like this

C ->C++ Fortran (though going to learn on my own accord, just to understand how things worked in past) Lisp ->Perl Lua

thoughts?

kaolinite
I'd recommend learning something like Python over Lua as it is more widespread and is used in a lot more areas, but that's up to you.

Python can and is used for web development, though if that's what you're interested in then you might find PHP easier to get into.

Fortran is an interesting choice and I understand your reasoning, however I wouldn't put too much time into that right now (up to you, however, just do what you enjoy).

Basically, there are tonnes of choices each with their individual merits. Pick something with a decent community which you enjoy. Python, Perl, PHP, C, C++, Lua, Java, Javascript.. they all suit that perfectly. If you really can't make up your mind, toss a coin and read up on that language for half an hour and if you like it, keep learning :-)

Another thing to add: it's not just about the language. Once you've learnt a language, you need to learn the commonly used libraries/modules. How to decode XML/JSON, how to talk to a database, socket programming, etc, etc. You might find it better to concentrate on those in a language you already know. It's better to be an expert at one language than mediocre at a dozen.

Also, check this out: http://learnpythonthehardway.org/book/advice.html Just found it and it's sound advice.

Basically the book for that language which is considered 'The Bible' by its developers. The K&R book for C (http://www.amazon.co.uk/C-Programming-Language-2nd/dp/013110...) or the Camel book for Perl (http://www.amazon.co.uk/Programming-Perl-Theres-More-Than/dp...) are this type of book.
Joel likes the sink or swim approach apparently.

The first book, Code - Charles Petzold, is only ten bucks on the Kindle right now (SOLD) and I own the other two.

I remember SICP being like 90 bucks for my hardcover copy and I'm pretty sure I bought it after reading the Joel on Software article "The Perils of Java Schools" while I was loving life as a bank IT guy so this is workable advice. It only took five years to become a "real" programmer after that. Also I sure don't remember K&R being $68[1]. (Yes I know SICP and K&R are both online for free)

[1] http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...

[2] http://www.joelonsoftware.com/articles/ThePerilsofJavaSchool...

aiham
Could you link to a free (and legal) version of K&R?

For anyone interested, I found SICP at http://mitpress.mit.edu/sicp/

andymoe
I'm pretty sure there was a link to it from Dennis ritchies' home page:

http://www.cs.bell-labs.com/who/dmr

The site is down now though. Some forums say it's temporary but I don't know for sure.

daniel-cussen
Google: Kernighan Ritchie filetype:pdf
skystorm
For completeness, SICP in .mobi format for Kindle: https://github.com/twcamper/sicp-kindle
I would be far more impressed and gratified if Prentice Hall were cool enough to offer Kernighan & Ritchie's classic "C Programming Language" (2nd Edition) at 1/2 off their $57.99 sticker-shock price.

http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...

phaus
I saw a copy of this at my local Borders for about $25 during their final sale. Sadly I made the mistake of not purchasing it because I was already in the process of learning a few other languages. I figured the price on Amazon would probably be about the same. I was mistaken.
jswinghammer
Has this book always been so expensive? I don't remember paying that much for my copy. That was ten years ago though so maybe I'm just getting old :)
nitrogen
You can probably find it for significantly cheaper (i.e. <$10) on cheap, fluorescent-looking paper imported from overseas.
SageRaven
Yup, that's where I got mine a year or so ago. Then, a week later, I found the 1st edition at a thrift shop for a buck.

The quality of the domestic version is so much better, but not $50 better. The price of a legit copy is shameful.

jdludlow
I don't even want to think about the cost of this book right now. I recently cleaned out a huge pile of old computer books, stacking them into "keep" and "trash". My copy of K&R is currently missing. Odds are pretty decent that it's floating in a slurry of paper pulp.

With any luck I loaned it out and forgot about it. I'll still never see it again, but at least it's still doing something useful.

sliverstorm
You can pick up the first edition for a dollar or two. The second doesn't have any groundbreaking information that I'm aware of.
wyclif
Better yet, you can just grab a pirated PDF copy.
nkassis
I'm on my second one too now. I loaned it a while back to someone and never got it back. In a way I feel good about that. Someone is now a better programmer because of that :) And they obviously liked it enough to keep it.
Here's the slightly modified answer I just posted there (even though it's an old question):

Back when he was still doing podcasts Joel Spolsky answered the similar question, which was partly "Does a good programmer without a CS degree really have a chance to get a job at Fogcreek?[1]" (It's near the end of the page.)

He says that for a good self-taught programmer who began with a high-level language, say PHP or Java, who comes at programming from a practical perspective, there are a few important parts of the CS curriculum the person may have missed out on, and goes on to list some books that would help fill in those gaps.

Off the top of his head he named these books in about this order:

- Structure and Interpretation of Computer Programs[2] (also free online[3])

- C Programming Language[4]

- The Unix Programming Environment[5]

- Introduction to Algorithms[6]

He said that those books covered the aspects of the CS curriculum his company needs in a good programmer, e.g. being able to create algorithms for an uncommon data structure.

Those books all have the added advantage of having exercises, and all being a very pleasant read. SICP is an introduction to many of the big ideas in CS: data structures, streams, recursion, interpretation, compilation, register machines, etc., and their implementation in Scheme (a kind of Lisp). It's a great place to start. The next two focus on implementation details like pointers and memory allocation. They are compact, powerful books. The last, Introduction to Algorithms, seems misleadingly titled, as it is fairly comprehensive and used in both undergraduate and graduate courses. If you work your way through the entire book, chapeau!

[1]: https://stackoverflow.fogbugz.com/default.asp?W29060

[2]: http://www.amazon.com/Structure-Interpretation-Computer-Prog...

[3]: http://mitpress.mit.edu/sicp/

[4]: http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...

[5]: http://www.amazon.com/Unix-Programming-Environment-Prentice-...

[6]: http://www.amazon.com/Introduction-Algorithms-Third-Thomas-C...

Jul 17, 2010 · awongh on Ask HN: Should I learn C?
since I had to look it up, maybe others don't know:

K&R refers to: The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie

http://www.amazon.com/exec/obidos/ASIN/0131103628/thedinosau...

SwellJoe
I feel compelled to add that I tried to learn C from a half dozen other books over several years (starting in childhood, so it was probably a bit early), but it never made any sense until I worked through K&R. Suddenly, C seemed like a beautiful and simple language (which it is). There are many subtleties, particularly in the macro system, that are not covered at all by K&R, but it is, by far, the best choice for learning C.

In other words: Don't waste your time trying to learn from anything other than K&R, at first. It's just the most concise text available...C is a concise language, and it is not well-served by big fat books.

The classic C book is The C Programming Language by Kernighan and Ritchie (http://www.amazon.com/Programming-Language-2nd-Brian-Kernigh...).
This is like a never ending issue. One way to start the path to a better practice of C is to read http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp... after you finished http://www.amazon.com/Programming-Language-Prentice-Hall-Sof...
Apr 26, 2009 · tumult on Ask HN: Learning C
C isn't hard, don't worry! It's actually a fairly simple language. But it's medium/low-level and there is a lot of power within its simplicity. Fast to learn, but a long time to master, as one might say.

I don't know what people are using to learn C these days, but the standard has always been the white book http://www.amazon.com/Programming-Language-Prentice-Hall-Sof...

You will find yourself spending more time thinking about programming concepts rather than dealing with C syntax, since it's pretty concise. I don't know how difficult it is to learn about pointers if you have already been programming for a while but haven't had to use references directly, but it's very important to learn. C does not do too much for you on its own, so handling references yourself is an important skill. It will also help you understand how higher level languages and concepts work.

If you are working through it and find that you're enjoying yourself, congratulations, you're a programmer :] Then it's time to pick up the 1st volume of Knuth and start working through that.

baguasquirrel
Indeed, the problem with C is just that. Once you understand how it works, you'll realize it's just a thin abstraction layer over assembly language. It really is just that simple. My last job was almost purely C, and what made C "scary" at times were:

1. naming conventions. I don't know why C programmers use the strange names that they do.

2. macros. C macros are a pain to read and follow.

I hope things will be easier to learn if you know this going in, because that's really all there is to it.

The catch with C is that while it is simple, writing good code with it is not. You have two tools for metaprogramming: macros and function pointers. C++ classes seem evil, until you see what people do in C in the absense of any mechanism for polymorphism.

Thankfully for you, you probably will only ever need to deal with libraries, not applications, so you'll never have to deal with the hell that comes with trying to use C for higher level work.

rthomas6
They use the strange names that they do because a function declared in C is declared everywhere in the whole program. They use strange names to try to stay out of your way; i. e. it would be really bad if two functions had the same name.
Daniel_Newby
You're right that C's lack of namespaces makes for funky names. However, note that "static" functions are visible only within their compilation unit, which can bring some order to the madness.
baguasquirrel
Yes, exactly. And yet people continued to use the unhelpful, oblique prefixes and suffixes they used for global symbols nonetheless.
HN Books is an independent project and is not operated by Y Combinator or Amazon.com.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.