Teaching problem solving using a programming language is time consuming and hard work. In this blog, for which I'm using my online name, I will attempt to pass along some hard won techniques and impressions that I have gained over 15 years of teaching C/C++, Java, JavaScript, ActionScript, and Python up to and including Data Structures.
Currently I teach at a Technical University that hosts both online and offline classes in most of these languages. Most of my experience is in the classroom however. I hold a Doctorate and Masters in Computer Science with my undergraduate degree is in Mechanical Engineering. After a successful career in the Military, I transitioned to higher education teaching and have been a full Professor for around 10 years.
Over my teaching career, I have witnessed many changes in the instruction of programming languages. Personally I first learned to program with Pascal and assembly language. Today, most schools don't teach assembly language anymore. Pascal has also passed into language history. Students only seem to want to expend time and energy on a language that will "be applicable to my career." If "I can't use it today, then I'm not interested" say most students. And this brings me to my first observation: "Which Programming Language should a student study as a first language?" What role did Pascal - the traditional teaching language - play in the past that it seemed to do so well?
As many long time programmers know, your first language was the hardest. Transition to a second, third or more language is fairly straight forward as long as one has a good foundational language to compare and contrast from. I found that in teaching Java to C++ programming to be rather quick and easy, especially to start. Where things get bogged down is when Java students reach the GUI interface stage, which has minimal support in C++, but even then only minor problems pop up after you compare a GUI to a console menu, where buttons are nothing more than menu items that can be selected in any order and the call functions are relabeled as "event handlers."
So what role did Pascal play in programming education before the average student perceived that it was not a language they would use on the job? Well that was many years ago for me, but from my observations now, Pascal highlighted the three essential constructs of all programs: sequence statements, branching or selection statements, and loops (both counting and indefinite). Further Pascal introduced the idea of separate modules with procedures and functions. And finally simple console I/O. While all languages today have these constructs, Pascal used them exclusively for training programming without all the other constructs that many languages today are built around. Pascal, at the time, avoided Objects, the necessity of exposing streams, operator overloading, and rather obtuse syntax for "begin" and "end" that a typical "Hello World" program today exposes to the curious student.
At our school, we said, OK, if you don't wish to learn Pascal, then the best foundational language you can learn is C/C++. This language exposes all the dirty laundry of programming from the get go. But once you learn it, transiting to another language is easy. Many languages hide these nasty details. We have a lot of success with this approach with beginning CS majors, but for others who are in different career tracks like engineers or even IT folks who aren't interested in programming, success can be challenging. We route many IT majors to Java, where the programming may be easier, but the conceptual challenges can be quite daunting at first. Many take VB for their language requirement. VB may be a good place to introduce folks to GUI programming thinking, but only for those that are not going to write professional programs as VB does not scale well and is difficult for anyone other than the original author to maintain.
Scripting Languages may also be a good alternative for a first language. They do a good job of introducing programming thinking, but hide a lot of processes that a professional programmer should be exposed to. Many of my JavaScript students, when they ask a question about how and why, get answers that make their head spin and generally just accept that "that is the way it is done!" For the really serious ones, a side bar is generally necessary which will either convince them that "programming is not for me" or prompt them to further explore Java or C++. Python seems to be a favorite for the non-programming professions as it is easy to learn and use for problem solving with a minimum of fuss. Again a lot of programming details are being hidden, but for those that need to solve a problem with code, Python can be a good choice.