   Learning programming. Creating heuristics and algorithms
  While teaching programming to my girlfriend, I've come across a gap in learning literature about programming dealing with heuristics and exercises that help shape the mind into creating algorithms. Most of the books follow the same style: "Learn programming in <X language>" or "Teach yourself <Y language> in <t days>" and some are very well written and explain programming language concepts clearly. However in reading them one only learns about how to apply some concepts in the specified language and sometimes what those concepts are and why they are important. For example, you learn how to create classes in C#, why classes are good, how they work and maybe there's a comparison between the procedural and OO paradigms. These kind of books are not what I'm looking for because she is quite familiar with enough programming concepts to allow her to implement algorithms and write decent code. While she doesn't fully grasp the whole 'philosophy' behind them, she knows enough to evaluate the pros and cons of using each concept.Her problem is that she has a hard time developing both the heuristics required for the tasks presented to her and creating algorithms for given heuristics. I think that to accomplish these tasks one has to have both experience and a certain mindset, both of which are acquired over a long time through practice. I think that this process can be accelerated by carefully pointing her in the right direction of thinking. Moreover, in my opinion, such heuristics fall into two categories: reusable and single-use. An example of a reusable solution is an accumulator: z-buffers are accumulators, some lookup-tables are accumulators and one could use an accumulation structure could be used to build up statistics from events logged in a database. So, basically, I'm looking for a book or other resources that attractively deal with common problems in a gradual manner as to allow the reader to test his own ideas first, before being served a functional solution. I hope that by developing her own solutions and then comparing to existing ones to common problems she can develop the mindset for solving new challanges.   
  If I understand your post correctly I highly doubt you'll find one such book on this subject.Sounds like you're describing a lot of the material that traditionally fits into a computer science degree - lots of functional programming, proof, language theory, information theory etc..etc..I studied all of these in my degree and it's only in putting all the little fragments of information together that I think I've got a solid ability to explain how I solve problems. Before then it was all intuition based on practice and experience...Maybe if you dig into some of the functional programming and lambda calculus you might get what you want. Graham Hutton's course on functional programming (with course code G51FUN [rolleyes]) was one of the best courses I've ever taken for understanding the "core" to computability, algorithms and languages and it seems he's finally published his book that we used as our lecture notes [smile]I'd definitely go for some texts in the more academic languages - things like Java, C#, VB and even C/C++ are focussed more on rapidly churning out solutions. Or at least the texts you refer to will assume that's what the reader wants.hthJack   ;code completei got this book recently and it is fantastic. I think it is what you want.   ;  Maybe Structure and Interpretation of Computer Programs.   ;CTM is a great book. As language, it mostly uses Oz, but that doesn't really limit the book's scope. It discusses a variety of styles (OO, functional, Erlang's message passing style, ...) and compares them. And with Oz being such a flexible language, the book can show you what working solutions would look like in that language. It's a bit like SCIP (suggested by a poster above) in this respect. But maybe it's a bit too theoretical for your purposes.   ;Quote:Original post by IliciWhile teaching programming to my girlfriend, I've come across a gap in learning literature about programming dealing with heuristics and exercises that help shape the mind into creating algorithms. Shape? It's mostly about experience, and praxis. Some of it is also about code analysis.Quote:These kind of books are not what I'm looking for because she is quite familiar with enough programming concepts to allow her to implement algorithms and write decent code. While she doesn't fully grasp the whole 'philosophy' behind them, she knows enough to evaluate the pros and cons of using each concept.If she is curious and she knows enough, to evaluate things, she is on right tracks and in few years she will be fine.Quote:Her problem is that she has a hard time developing both the heuristics required for the tasks presented to her and creating algorithms for given heuristics. I think that to accomplish these tasks one has to have both experience and a certain mindset, both of which are acquired over a long time through practice. I think that this process can be accelerated by carefully pointing her in the right direction of thinking.On the other hand if you'd rush things you might screw it greatly. Some would be programmers are learning things by looking at them as at whole, others are attempting to do reductionism. Sometimes a person is able to learn algorithm design/programming/SW architecture in spite of his/her education.Can she imagine data flow in a common program? Can she design a program from scratch? Does she know what is disassembly, and reverse engineering? Can she explain to other people why programs shouldn't be required to have the same decorations as other programs running on the same OS?Basically the best way would be if she would design few programs she would like to do, and try to finish them. She would do what she likes, and she would learn a lot.Quote:So, basically, I'm looking for a book or other resources that attractively deal with common problems in a gradual manner as to allow the reader to test his own ideas first, before being served a functional solution. I hope that by developing her own solutions and then comparing to existing ones to common problems she can develop the mindset for solving new challanges. This might be problem as what you described is best done by comparing source code of other people with yours.I recall something about a common programmer errors in C++ with examples or something like that. You might also look at some design patterns book. There are also sites that describe solution to some common problems however they are specialized.