Coding is only one half of programming. Unfortunately with most programming classes only that half is being taught and the other half of programming never gets mentioned. As a result there are lots of programs written that work but which are extremely inefficient.

I have recently been looking at the sorts of questions being asked as homework for JavaScript classes and writing articles that highlight the difference between the historical JavaScript code that the teacher expects to be used for the answer and alternative ways the question could be answered using modern JavaScript. In my search for such questions I came across the following one which, rather than indicating that the JavaScript course was teaching outdated coding techniques, clearly demonstrates how the creative problem solving half of programming is being completely overlooked in many programming courses.

The question: was "Write a JavaScript program that accepts two numbers as input from the user and computes the sum of all integers between those two numbers including the two inputs." and the person asking for help with that homework was asking what type of loop to use to do the calculation.

Of course a loop isn't required to answer that question as the answer can be derived directly from the numbers at either end of the sequence.

Now of course this solution requires that x be less than or equal to y but so would any solution involving a loop. This solution is also more efficient for any case where the end points of the range are not equal.Code:`sumRange = function(x, y) {return (y-x+1)/2*(x+y);}`

Why that the creative problem solving half of programming is omitted from so many programming courses? Is it because teaching the creative half of programming is too difficult and so the courses concentrate on the easier part where strict rules apply? Can the creative problem solving part of programming actually be taught or is it a talent that tsome people are born with?