Years ago I learned to do some very simple programming using Basic (the old version), but I never really learned to do anything more sophisticated than that. In hindsight what I did was simply memorize a bunch of commands and what they did, and worked to piece them together into something that would yield the result I wanted. But what little I know about more current programming languages and methods seems to indicate that to really know how to write programs you need to know three things: (1) You need to know the fundamental logic of programming at the mathematical level (logical operations, iteration, etc.) (2) You need to know how the architecture of a computer implements a program- things like stacks, kernals, etc. (3). You need to know modern methods of making large sophisticated programs managable: object-oriented programming, etc. But all the books on programming I’ve been able to find seem to presume that you already know all these things and simply give you the specifics of how to write one particular programming language. So can anyone recommend a good book for beginners on the general principles of programming?
This doesn’t address programming directly, but one of the best books I’ve ever read about the process of software development (and, in particular, what not to do when writing software) is Dreaming in Code by Scott Rosenberg. It follows the exploits of a team of engineers with a really good idea and no adult supervision.
There’s no single book that’s going to cover everything you want. The first thing you need to do is pick a programming language and write some programs—some small ones for sure, and maybe some not so small ones. I think C++ is the ideal first language if you have someone who can actually teach you, but if you don’t, Java’s your best bet. You’ll pick up most of your item 1) in the course of this, but if you need a bit more, pick up some introductory discrete math textbook (which will likely be titled “Discrete Math”).
Since you’re not doing C/C++, you don’t really need to know that much about what your program looks like in memory (although it certainly doesn’t hurt). Once you’re proficient in Java, you can pick up a copy of Scott’s Programming Language Pragmatics to see how various language features are implemented. If you need more background on operating systems and architecture, check out Tanenbaum’s Modern Operating Systems and Hennessy & Patterson’s Computer Organization and Design: the Hardware/Software Interface respectively.
Object-oriented design is as much an art as it is a science, and you really just need some experience with it before you start studying. Gamma et al.'s Design Patterns is the book to get, but it’s a little difficult to read if you’ve never seen the sorts of problems that they’re solving. I like Budd’s Object-Oriented Programming as a survey of various object-oriented languages, but that’s a little less essential. You will also want, at some point, Booch et al.'s The Unified Modeling Language User Guide.
And at some point you must read McConnell’s Code Complete. It doesn’t exactly cover anything that you’re specifically looking for, but it’s essential nonetheless.
It’s a lot to read, but you are asking for a significant portion of what you’d learn in a computer science degree, so you shouldn’t expect to get off too easily.
Any love for Donald Knuth’s The Art of Computer Programming? I’ve only gone through a little of it myself. I enjoyed what I read, but I haven’t read enough to reccomend it.
A good way to start with all the “under the hood” stuff is to learn assembler. I learned it with Jeff Duntemann’s book Assembly Language: Step by Step, though I’ll note that Windows XP’s DOS prompt doesn’t allow a lot of stuff in the examples unless the book has since been updated for XP. You can just read it through without trying the examples though.
Another good thing to read is a book on algorithms. I wouldn’t recommend Knuth’s books mostly just because it’s a lot easier to understand what you’re reading when you can read the examples it gives and all of his examples are in a made up language that bears no resemblance to modern languages. Personally my first algorithms book was Algorithms in C and I was quite happy with it. (Of course knowing C would be a prerequisite.)
Knuth is of course the all-time classic of computer science texts. But I could hardly recommend it for someone looking for beginner material. Even if you skip all the math and MIX assembler code, the topics covered are still mostly advanced, and there’s no discussion of higher level abstractions like OOP and functional programming, or even structured programming.
I also really like Algorithms in C. Sedgewick was a student of Knuth and clearly inherited the latter’s talent for clear and concise writing.
First, acquire a compiler. The language doesn’t much matter. Next, come up with an idea for a program you’d like to use. (That’s the biggest hurdle.)
Now find yourself an active messageboard focused on that language, and ask question after question after question. For each piece of the program you’re writing, ask if the way you’re doing it is the best way, and if not what is the best way and why?
Buying a book to learn about programming principles may have been a good idea back in the 80s, but think about it for a second. Where would you turn to for general knowledge: a set of Encyclopedias, or the SDMB? Same deal with programming.
If you want to go the all-free route, you can download Sun’s Java stuff, install the Eclipse IDE, and get yourself a pretty good development environment.
Then you can download Bruce Eckel’s “Thinking in Java” from this link, which comes with sample code. I see he’s also got an Ebook called “Thinking in Patterns”, which might be a good second book to read after the Java one.
I agree that the only way to learn is to program, which means you need to figure out some programs to write. You can start with just about any text, which will have assignments, and after you do that write something that interests you. I’m sure lots of people here can evaluate how difficult it will be. You don’t want to start with something that will take years for you to finish.
One thing about the OP - I don’t think you really need to know too much about architecture. The stuff you mentioned is OS architecture, but you don’t need to know about hardware architecture either, unless you’re planning to program in assembler. You might need some OS calls, but that should be about it for something simple.
And, if you’re interested in learning programming logic, I’d stay away from assembler, where the logic can get lost in the details very easily. When I was a TA for a PDP-11 assembler class, we gave them a problem in Pascal first, and graded the crap out of it. (We eventually threw out the lowest grade.) The purpose was to scare the class into doing structured programming (which was just getting started) when they wrote their assembler code. You can’t avoid go-tos in machine language!
The math in programming languages is pretty easy. The hard part are control structures and data structures. Control structures consist of selection (if-then-else, case) and iteration - with loop variable (for) or logically (while.) With these you can do anything. Data structures are a bit more complicated, but the right data structure makes the control easy.
Sorry, but I’ve seen too many people flounder with a bottom-up approach. A good plan comes first. Experienced programmers can plan reasonably sized things automatically, but I doubt a new programmer could. I doubt a message board is going to help choose the right data structures.
Learning programming is a lot more than learning the syntax and semantics of a language.
What Voyager said.
It’s all about fitting the logic into whatever syntax the language of choice has. Formulating a solution to a problem, planning the steps, and implementing them is what separates dilletantes from problem-solvers.
Programming is a lot more than just writing code.
Totally. As Dijkstra said (approximately), computer science is no more the study of computers than astronomy is the study of telescopes. The same goes for programming - the language is just the tool. You’re no more likely to learn programming from a messageboard than you are to learn to play the piano. Messageboards, newsgroups etc. can be great resources once you’ve got started, but primarily for help with specific, constrained problems (and quirks of particular systems/languages). While learning-by-doing is undoubtedly a massive part of learning to program, if you just chuck yourself in headfirst you’ll almost certainly pick up some dreadful habits which are very hard to unlearn later.
I’m not sure I have any particular recommendations for books; ultrafilter has given a very good list (“Design Patterns” in particular, should you ever get to that stage, is a classic). Incidentally, I don’t think assembler is something you should think of looking at until you’ve got at least one higher level language under your belt. While knowing on some level what sort of instructions your code is eventually compiled into can be useful, I’d say it’ll be pure confusion if it’s the first thing you learn.