looking for book with sample code
Hi. I'm new to programming and i'm looking for a book that has alot of sample code (more than the usual textbooks)- is there anything out there like that? Also, are there any good books to read (i've heard of the cathedral and the bazaar, hackers: heroes of..)? thank you.
If you're looking for "real programs"...
Most authors are going to keep the examples short. If you were teaching english, you would use single words and simple phrases. Once you know the words and phrases, you can understand, or write longer writings.
Maybe that's a weak analogy, because programs don't flow linearly like good writing... Typically, you can't simply read-through code and understand what it's doing without a fair amount of thinking... maybe flow-charting... research, etc.
The author might use a flow-chart to show how a larger project is programmed. Or, I have a BASIC language book that builds one large program by adding code as you progress through the book.
Some of the more advanced topic-specific books come with a CD with the source code for complete programs. For example, I have a couple of Digital Signal Processing books, and a couple of Driver books that have overwhelming amounts of code on the CDs.
"Programming Windows" by Charles Petzold has several example programs that are a few pages long. But, these too are simple (for windows programs)... they just demonstrate the particular topic of discussion.
I don't know what you're finding in the usual textbooks. If I remember correctly, "Teach Yourself C++ in 21 Days" by Jesse Liberty has examples that are typically one page of code. The programs at the end of each "week" are a few pages long.
If you really want to overload your brain, look-up some of the open-source projects on the web. You'll find plenty of real-world code examples... without any tutorial explainations though.