4 ms·
"Programming is learned by writing programs" - Brain Kernighan And that is what anyone who goes through K&R will do: Reading and writing lots of real programs
by gits1225 13y ago
"Programming is learned by writing programs"
- Brain Kernighan
And that is what anyone who goes through K&R will do: Reading and writing lots of real programs. A simple program is worth a thousand words!
Which unfortunately the majority of technical books just can't get right. Explain the concepts in 5 full dull pages, and then at the end "Hey, checkout this little snippet of code, which by the way does nothing really interesting, but is here to illustrate what the author was talking about :)"
- DanWaterworth 13y ago> A simple program is worth a thousand words! Whereas, the less said about complicated code, the better.
- clarry 13y agoI'd like to add some emphasis on reading. For a beginner, writing is obviously very very important as the way to get to the point where he can just sit down and solve a given task. But reading lots and lots of code (from many different sources) will help him pick up idioms and find common & good solutions to specific problems. Even for a smart person, I think it'll take a lot of time and effort to arrive to the cleanest way of doing things. Of course there's a risk of picking up bad habits, but if you read lots of code, you should eventually develop a feel for what's clean and readable and easy to understand, and what's messy and wrong. This sadly doesn't help with issues like undefined behavior, but you don't learn these just by writing either. For that you need to look into the spec or some other text that'll cover these. EDIT: I like to think that I'm a fairly good C programmer (having coded nearly all my life, with C mostly), but I still peek into others code all the time to find out how they've solved some things I'm about to do.
- HCIdivision17 13y agoI'll second this notion. I no longer write C, but it is what I learned in high school. My teacher had an interesting class requirement: we needed to review one C/C++ Users Journal article. Length, difficulty, or topic didn't matter - just read a trade article and write about it. We also had to code a lot, and we had to write code by hand on paper tests, and we had some fun competing, but the journals let me know what the Real World was doing. It takes a large volume of work to really get into programming, and I think that reading is easier than writing, so it's a fast way to dig in (keeping in mind that feedback is critical - so reading without writing has severe diminishing returns)!