Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I finished reading K&R 2 about 2 weeks ago and since then,

I tried to further my knowledge about programming with various challenges like the ones found on Project Euler and http://ubuntuforums.org/showthread.php?p=5499486

But that didn't really satisfy my hunger for knowledge, as the ones found on Project Euler are purely mathematical and the ones on Ubuntuforums too easy.

So I bought "Programming Pearls" because there seemed to be some reasonably challenging problems.

But they were much hard for me. I know how to set up databases, access and manipulate them. I'm also able to code easy graphical/gui applications and have a basic knowledge about data structures like lists, stacks, binary trees and algorithms like quicksort, binary search and the like.

Can you recommend some reading material that teaches one how to approach programming / implementation of a complex program? (like Problem 2 from Column 1, where you have to store max 10000000 Integers in only 8 million bits)

share|improve this question

migrated from stackoverflow.com Aug 23 '11 at 13:23

This question came from our site for professional and enthusiast programmers.

marked as duplicate by gnat, World Engineer Mar 26 '13 at 23:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

There are three essential things you need to learn: language syntax, problem solving and program structure. The first seems trivial, but for the C language in particular there are numerous nasty pitfalls: undefined/unspecified/implementation-defined behavior, reduntant features of the language etc. K&R doesn't teach this well. Problem solving is what you seem to be doing right now, though make sure it includes common algorithms and data types: linked lists, searching and sorting. And then there is program structure including maintainability and readability, which mainly comes with experience. –  user29079 Aug 25 '11 at 6:45
There are many related answers on programmers. –  faif Feb 11 '12 at 9:43

5 Answers 5

The best way to learn programming is to practice. Just come up with some projects and try to implement them. When stuck, refer to forums, guides, books, etc, and then move on.

share|improve this answer
Exactly. Just do. Find a project which you think might be a little bit useful and which is challenging but not impossible, and just build it. You will learn loads from all the practical issues you run into. –  Erik Romijn Aug 23 '11 at 15:28

Complex program is not so easy to define. A program can be complex because the solution for the problem is complex (good example: FFT, for one without the background knowledge one cannot grok what the algorithm does, despite the fact that you can pack it in a handful of lines of code). Another complexity is the sheer size. Take as an example some business application. The business logic behind is very very easy to get, but the uncountable numbers of gui layers, framework abstractions, thousans of cases,.... make it just BIG.

To deal with the first kind of complexity you can nothing do than learn math, and algorithms and data structures (there are many books, and you find on stackoverflow many good book recommendations, like e.g. Coreman, Sedgewick, or the Algorithm Design Manual). To practice them your mentioned project Euler, or some programming contest pages like topcoder or old ACM contests are a good start. Also the aforementioned books from me have task/assignments for every topic.

The second kind you can only learn by doing. Here I can just recommend take a small hobby project (e.g. a CD collection browser if you got many CDs, a little game, or whatever) and implement it. After you finished your first implementation you should have enough knowledge that you will say yourself "If I had in the beginning known, that..., I would have designed...". To call it by name, it is in opposite to the algorithm knowledge from the first, software engineering. Here are also good books available (you are going to find good recommenations here too, like e.g. Code Complete). But here I would suggest practice, practice, practice, and finally practice. After you implemented your small project a 2nd time you are more confident with your skills I would recommend to move some bigger project. As you will see the complexity lies in bigger projects not within the programming, but more with the interaction and coordination of a team. To do this implement some little task in some open source projects. They need any help they could get and you will get some practice. And the better you become the more complex your tasks will be...

share|improve this answer

Rather than trying to implement solutions to abstract problems, how about trying to write a real, useful program? Try to implement a chess program in the language of your choice, or write an app for a smartphone. The key to being able to program is to be able to break down large, complex problems into a whole bunch of little, approachable problems, and that's something you learn to be able to do by setting out to solve a large, complex problem, rather than a bitesized technical challenge.

share|improve this answer

One or more good books and a lot of practice.

You should also read some open-source code, apache, nginx, ffmpeg, gimp. inkspace, mysql, .. whatever you are interested in.

share|improve this answer

I am glad I came across this post. I would recommend this site. On the one hand, you have the chance to get much better in a specific language, Python, but on the other hand the progressive challenge of each problem will make you have to think how well you are writing code. The unique thing about this site is that it only requires a final answer, so really you could do the programs using whatever language and whatever methodology you like although the problems may be easier in some languages than others.

share|improve this answer