I see that Susan Canaga is bringing her school's discussion on programming languages looking for industry opinions. This is a topic I have addressed a number of times before (most recently here) but one which never seems to be settled. In any case if you an opinionated individual and want to put in your two cents I'm sure Susan would welcome the feedback.
As I have said more than a few times I like Visual Basic. NET as a first language. The syntax is easier than the C based languages. Literally millions of programmers use Visual Basic to develop applications with significant user interface needs. So it does scale up to full scale professional development.
C# would be my second choice for a first language and my first choice for a second one. I like that it is a .NET language which means that you can learn and use the .NET Framework classes. And of course C# allows students and others to easily use the XNA Game Studio Express to create video games for both Windows and the Xbox 360. I happen to think that C# is an easier language to learn than Java. Yes I am biased but I came to that conclusion years before I came to work for Microsoft. I like the way built-in types are handled in C#. I also like using properties (an option in VB as well of course) and other features. LINQ and related features that are coming (also for VB) in the near future look like they have the potentially to really simplify handling data bases and other large amounts of data easily. That has huge potential.
C++ is a language that is not going to go away any time soon. It is still the language of choice for a lot of high performance gaming, embedded systems, and anything that absolutely has to get close to the hardware. A first language? Not if up to me. On the other hand the things one can teach using C++ makes it an important language for someone who intends to be a serious student of computer science. If it were up to me I would probably have left C++ as the language of the Advanced Placement exam. C++ is not the best way to learn object oriented programming. C#, VB and even Java are better for that. On the other hand there is power, at the cost of ease and safety of course, in C++. I like that for when it is really needed.
But of course if it were up to me no one would take AP CS as their first programming course. That's like taking AP Calculus without having Algebra and Geometry first. It can be done but it is hardly a good idea.
The Visual Studio Express editions are available for free in C++, C#, Visual Basic and Visual Web Developer editions so teachers and students have some great free options for all of those languages. If someone wants to make the case that Java is better than either C# or VB as a first language go ahead. (I've got my flack jacket on.) I feel sorry for AP teachers who have no choice but to teach it.
When you start to learn your first language (italian in my case), you start from the building blocks (the letter).
When studing math you start from the numbers, the basic operation, and so on.
Why should you start to learn programming from object?
My suggestions is: ASSEMBLY :-)
I'd tend to stick away from languages that enforce a rigid programming style. Unfortunately, this rules out pretty much everything .NET related, with it's "*everything* must be part of a 'class'" mentality.
Static functions are not object-oriented. That's OK, there's nothing wrong with non-OO functions - C and all its descendents had been doing fine without them for years. Classes without per-instance member data are also not OO; static classes are just syntactic salt for namespaces.
"public static void main()"?? Please!
For a first language, I'd go with a simple imperative language; the kind you could just write an equivalent of:
10 print "hello"
20 goto 10
in, in no more than 5 lines total, and have an environment where you can just "run" it, without even needing to hear about "compilation".
I'd probably go with Python.
(Disclaimer, I'm a C/C++ programmer, but other experience includes a couple of years of C#/VB.NET, a year of VB6, some UNIX shell scripting, some Delphi in '98/'99 (can't remember which version), a year or two of VB3, batch file programming (ugh!), GWBasic, BBC Basic and a tiny amount of 6502 assembler. I keep not getting around to learning Python properly, but every time I look at it and hear more technical stuff about it, I become more impressed with it. I also have to learn lisp at some point. *sigh* So much to do, so little time.... :-)
Sinclair Basic running on a 48K Spectrum (there are some good emulators out there) ;-)
But seriously, forget startin with an OO language and start with a nice, simple, functional language. Get the basics down first, like loop constructs, conditions, logical expressions and the like. Then move on to OO design and programming.
There are a number of young programmers out there who can come up with good OO implementations at a high level, but whose basic understanding of logic is sadly lacking.
How did I learn? Spectrum Basic at age 6, Z80 assembler at 8, C at 10, 6800 assembler at 16, 6502 (with out an assembler) at 18. Then I went to university and learned to program 'for real' in COBOL, ADA and eventually C++. In the real world I've been a C++ and VB man for about 12 years now.
I would advocate C# instead of VB as the first language. In my opinion, once you learn C#, you can more easily "step down" to VB, rather than if you learn VB first, it is a bit harder to "step up" to C#. I have seen this with several professional programmers in my career who are unable to "escape" VB and pick up other languages. This is especially the case if your resume indicates a large amount of VB experience; prospective employers tend to assume that you can't handle languages in the C/C++/C#/Java group. It is also my experience that programmers in the latter group are generally paid more than VB programmers.
I also disagree that Java presents a larger learning curve compared to C#. I recently learned both Java and C# after having programmed in C++ for many years. While I prefer C# over Java due to its more refined syntax, I don't see any difference in the learning curves for the two - the language, the IDEs, or the supporting frameworks are really about the same.
Finally, I'm not in agreement about your correlation between C++ and safety. In my experience, without any further guidance, programs written in C# will be "safer" than C++, i.e., less prone to subtle bugs due to inherent problems in the language, length of learning curve to “mastery,” etc. If you were to develop safety programming requirements for C#, as has been done in the past with C/C++ (e.g., MISRA), I think you'll end up with fewer "additional" requirements/restrictions and a better overall result in terms of safety. But maybe I am misunderstanding what you meant by "safety."
Some how learning Assembly before learning higher level languages seems like learing how to ride a unicycle before learning how to ride a bicycle. There is no question that knowing how to ride a unicycle helps to become a better bicycle rider (I do ride a unicycle) but I don't think it should be a required first step.
I agree - there is no need to teach assembly before high-level languages. In fact, for most (probably 99%) of students today, there is no practical reason to learn assembly at all. Looking at today's job market, assembly is a skill that is needed less and less, and I don't see anything that will change that trend. In the future, it will be a niche skill only required by a very small percentage of developers.
Looking at it another way, there is no need to "layer" learning so that you learn lower levels of abstractions first before learning higher levels. If anything, the opposite is probably true - we should probably teach higher levels of abstraction first, and then for the subset of folks who are interested or otherwise motivated to learn, they can learn the lower levels of abstraction after that.
I start my first years out with Turbo C++ 3.0. The compiler is old but it’s a great teaching environment. This is my 7th year going this route and it has proven to be very successful as my 2nd year students find the move to objects (OOP) fairly painless. We start out with console applications using classes in Java and repeat 1st year in around 6 to 8 weeks. Then we move to C#.net, the first couple of programs are still console apps just so they get the feel for the new environment. From there we spend another 4 to 6 weeks working on classes and objects in C#.net. The students seem to have little trouble making the move from a function based first language to an Object language. My 3rd years can move on to C++.net or spend move time mastering DirectX and networking in C#.net.
As far as safety goes for the 1st years, AP strings and arrays do a great job of teaching the students about limits/problems, say going outside the range of an array without crashing. And even when they do crash the API, it just goes to the desktop and they just start it back up. That does help reinforce the “Save and Save often” mantra I use.
Every time this topic comes up, we end up swapping brand names, which is fair enough when it is a matter for making a list for people to choose from, but it is NOT computer science, it is the habit of common computer scientists you are talking about. So the questions when posed are a question of choice at levels. VB versus C++/C#/Java/Python is a matter of tea versus coffee (Java, C++, C#, Python are descendants of a compromise algorihtmic description system between the representatives of ACM and GAMM in the creation of the three Algols; Basic was essentially an attempt to get the expressivity of Fortran to be interactive, with an addition of features found in JOSS and Algol60 developed by two visionaries at Dartmouth).
Python versus Java is more like Coke versus Coffee. Java versus C# is like Coke versus Pepsi.
Dijsktra himself said computer science is about computers like astronomy is about telescopes.
So the question really is - do you want a programming language that best prepares children to learn how to work with computers (choose a language sold by a big company that will assure work: Java, VB, C#) or a language that expresses current ideas about programming design (C# or Python or Fortran 2003).
Then there is the question of the IDE - the more handholding and help the better. Intellisense in Visual Studio is hard to beat.
Then there are those that are designed to teach computing science in a clear manner: Scheme, Squeak, Haskell. But they hold you back at getting work.
There are incredibly powerful systems like the APL languages that enable powerful and laconic expression of thought without destructive reductional thought, but are hard for many people to read/understand.
Then there are systems designed to express complicated logical problems easily - Prolog, Simscsript, Snobol: these are hard to bend to workaday programming.
None of these are /good/ programming languages though. But if you want to teach kids how to write algorithmic programs in a way that avoids bad habits, Python is the least worst as it was designed to this precisely, it is the Dartmouth Basic of our time, and Van Rossum put a lot of thought into it to achieve that goal.
But I question (like many others) where teaching people reductive thought leaves experimental computer science. There are no "pen and pencil and paper" equivalents for computer science. Everything buys into a particular genre of the computing zeitgeist - brandnaming, faddism, traditional approaches, ease of establishment.
Disclaimer: I am a historian of programming languages and have examined well over 10,000 of them in the last 14 years. I have read too many empty statements by manufacturers and programming pundits that say the same thing about different systems. And rather sadly, many things that were once possible to achieve in computing are no longer because of the prevailing reductive/algorithmic paradigm.
(Posting this here as well as on that blog as it might not be posted there)
The problem I have with any .NET language, including VB, being a first language, is the same problem I have with many of the new Lego sets; they contain all these specific pieces, designed for building *that one set*, rather than a bunch of very abstract square blocks.
Those specialized pieces allow you to envision new things you wouldn't be able to had you only seen square blocks, but they also *limit* your thinking (IMO). I'm a big believer in the power of constraints, but not this kind of constraint, when what you want to learn is how to think about, look at, and solve problems in different ways.
That would be the same for any language with a rich library including Java and C++. What languages would you see as less constrained?
Gregg, that's an interesting point about the Legos. My kids are just getting to the age, and that's one aspect today's Legos that I don't like ("this set builds this specific toy") compared to those that I had when I was a kid ("all square blocks that could, with some imagination, be built into anything").
But I don't understand the analogy to .NET. I don't see how .NET, or its supported languages, take you down the path to creating specific types of programs. I kind of feel that, whatever I want to develop at a given moment, I'm confident that I can do it in C# without any real problems. For example, today I might build a rich GUI, tomorrow a web site, the next day a web service or a command-line app. Also, I don't see how it limits your approach in non-useful ways.
Can you elaborate more about what you mean?
I'll try to elaborate, and apologize in advance if you need to ask me to try again. :)
"That would be the same for any language with a rich library..."
Yes, the question is "what can you do in the language *without* those libraries? How do you do something in C# without using .NET? How do you explore different ways of solving problems when that's not how they teach you to use the language; what they do is teach you how to find existing solutions in the framework.
I'm not saying that .NET languages are bad, just that they're designed for practitioners, not learning how to solve problems. I think Python would suffer the same way, because there is the "one right way" mentality about it.
As far as constraints, it's hard to say. The Logo turtle was *very* constrained, but it was designed to be that way for just this purpose. So, one way to look at it would be to say we need a lot of little languages that are designed to help us learn to solve problems in different domains; or you could say we need a very unconstrained language (Lisp, Forth, REBOL) that let's us to pretty much anything, and think about problems any way we want.
Gregg, I think I understand what you are saying but at the same time I think the problem is not so much with the .NET Framework or with other sets of libraries but with the teacher. There is little doubt in my mind that those who teach themselves will tend to fall into the trap you speak of. At the same time I think that beginners (people who have never programmed at all) are much better off with a teacher to guide them. That teacher can, if at all skillfull, work around those constraints. I think that self taught programmers are much more limited in outlook and understanding that well taught students of good teachers. Yes finding those good teachers is a challenge but I think that a good teacher can do a lot more than sending a self-learner to a specific language.
I guess it also depends on how you expect the language to be taught. In the case of .NET languages, would you emphasize finding solutions in the framework, or using the raw language and developing solutions from the ground up?
In the case of Java and C#, I think there is also a *lot* of syntax that gets in the way of understanding and thinking about the problem itself.
"I think that self taught programmers are much more limited in outlook and understanding that well taught students of good teachers."
Being self-taught, and knowing a number of others like myself who, IMO, are not limited in those ways, I'll take issue with that statement. What do you base it on?
You know, the only *real* education is self-education. ;)