views:

1953

answers:

34

Which language should students, who are looking to become professional programmers, start with?

Should they start with a purely functional, procedural, object oriented or with a purely algorithmic approach?

I recently found out that many schools have dropped C++ for Java and VB as an initiation language.

Since these languages live in managed environments. Will students lose sight of important concepts such as resource management, quality and speed?

I started with C++ and think that it is the basis of my current habits and concerns.

The Pulse:

  • C
  • C++
  • Lisp
  • Java
  • Python
+4  A: 

So, I may get booed out of here, and though I really do think it is important for software developers to know as much as possible about the machine they are operating, I don't think that teaching a managed language first is a bad thing. It will allow a young student to learn basic programming principles without getting hung up on the more complicated aspects of manual memory management.

Ed Swangren
+2  A: 

I started programming with BASIC (on the Commodore 128), but we're talking of 20 years ago!

I studied Pascal, C++, ML and other types of languages at the University.

But I think the secret of mastering programming is: practice on your own.

friol
+3  A: 

Two main schools of thought here:
"Java schools" - teach the student something that will be directly relevant to their first job, preferably something simple hence Java rather than c++ (this will probably change to c# in the next few years)

"academic" - teach them using Lisp, modula2 or some internal made up language. Then they are all starting from the same level, they don't have to worry about platform/implementation details. The langauges used will change over their career so there is no sense in learnign just one.

Finally there is a compromise, use a dynamic langauge but one that is still used in the real world and has libraries to allow you to build real application eg. Python

Martin Beckett
+1  A: 

I started with VB6 because it was all I had, and although it did help me "quickly make stuff", it also taught me to program with bad practices and misunderstand many concepts. Java and VB seem to be getting used more because people want to motivate those who think, "Ah! This is too hard! I quit!" Well, screw those people! Unless you're a school and their stay with the class results in more money to you, it doesn't matter if people are crying over it being too hard.

Despite it being so notorious, I would recommend C. Why? For one, there is a lot less to C than other languages, which is why I would not recommend C++. Yes, C can result in very ugly practice, but that is why you work close with the students. You want to teach them what is going on, not how to just combine a bunch of pre-made objects into a mess that they call a masterpiece. From here, move on to whatever you like, though C++ may be a good choice.

Joel did a great post related to this on his blog.

Spodi
+6  A: 

I think the language is far less important than the concepts being learned and the ability to instill passion. If you have the passion and you can see yourself making progress, any language is valid.

I have had learning experiences in BASIC, C, C++ and various others, and in each case, the language became secondary to the problems I was solving and my desire to solve them. This remains the case even now when I have to learn a new language for whatever reason.

Jeff Yates
Any language that doesn't obscure the concepts with hard-to-read syntax or obscure technicalities. I find C is hard because there's a lot of baggage; it's hard to focus on the fundamentals.
S.Lott
But some of the things you have to deal with in C that higher-level languages hide from you /are/ the fundamentals. If you know C you know what's really going on when you then go to another language that hides them from you.
Mark Baker
+2  A: 

Python is an ideal language for learning programming.

S.Lott
A: 

I started with straight C, and this far I've felt like that was a pretty good choice. It's given me a food base now that I've moved on to C# and Objective-C, and I enjoy having some idea of how things are working under the hood so to speak when it comes to things like arrays and strings.

I'd also like to learn assembly at some point, but I suspect if I'd started with that I would have gotten frustrated and bored and either given up or moved on to something else.

Lawrence Johnston
Assembly can be very rewarding, esp. hardware programming. I was really excited when I wrote a floppy drive subsystem that could format a floppy disk, and read and write files using an extremely simple file system I made up for the purpose, written entirely in x86 assembly. Good times ;-)
Mike Spross
+1  A: 

On my degree course (late 80s), we did most assignments in Pascal (though some of those assignments were along the lines of "build a compiler for this virtual machine", and then "build this virtual machine"!).

We were generally equipped with the meta-knowledge of how to learn, and I think understanding that is more key that the actual language you learn with.

On my first job out of university, I was sent away on a 5 day course in C, and had no problems picking it up, or any other language since.

Paul Dixon
A: 

Python or Groovy. Groovy would be a better introduction to Java and doesn't have the large tool base that does most of the legwork. Python is good because it has so many paradigms.

Joshua
+1  A: 

Hey Alexandre,

Definitely assembler! (kidding, sort of)

There are a few discussions similar to this one here, here and here.

Granted, these aren't duplicates in my opinion, and the question you've posed is likely to get tagged with the 'subjective' tag, but it is a reasonable one to ask, I suppose.

I think that it is reasonable for a programmer to have an understanding of a non-managed language (C's a good one, but there are others) and certainly C#, VB or Java are fine languages to learn. One certainly can't go wrong by learning any or all of them.

I think it is also reasonable to look at Python - it is pretty straightforward to read and code.

When I was school (queue the old man music), we didn't have C++. We learned FORTRAN-77 and eventually Pascal. I learned Lisp and a few others as well. I also learned assembler. Each of these (including FORTRAN!) has been useful in my 9-5 at some point. I'm a big proponent of learning as much as I can, you can't go wrong!

Perhaps schools are changing their focus based on market trends or the interests of the instructors? I don't know.

itsmatt
A: 

In my case, I started with BASIC, then Clipper, then I went to college. In college, we started learning Pascal, C and a very small subset of Assembly (only data manipulation commands). I think starting with a simple language can help a lot. Java is far more complicated than Basic and Pascal. Starting with those "easy" languages can help you learn about structures, functions, vars and so. After that, you can easily start doing "real" programming using Java, C/C++, PHP or another language. PHP is a nice program language to learn too. It's easy to learn, uses a C-like syntax, is far less restrictive than C (both a bug and a feature), and there's plenty of tutorials out there. But really learn PHP before coding something real, posted in Internet somewhere. People thinking that "if the code is running, the code is good" are responsible for a lot of security problems which plagged the web today.

ThoriumBR
+12  A: 

I believe that students shouldn't start with one language. I started with Visual Basic and that gave me issues when I picked up C, which then gave me issues with learning Java and OOP, which then led me to issues with dealing with Prolog and Haskell.

Why not teach several languages at once, whilst introducing why these languages are worthwhile in certain situations and why they are troublesome in others? Pick one from a selection of paradigms and let students develop their skills in programming with each.

I'm also a firm believer on teaching the fundamentals and mathematical knowledge instead of teaching 'the language'. A mixture of paradigm teaching and foundation knowledge would create students with confidence in their ability to learn, rather than to develop.

EnderMB
I've never thought of it this way, thanks for the new perspective.
Alexandre Brisebois
"Why not teach several languages at once"? Because then you'll have all these issues at once.
hasen j
Isn't that a good thing? If programming is truly a craft then surely it would be beneficial to learn the basics of all paradigms. A chef doesn't limit themselves to working with just peppers, nor does a graphic designer only use the brush tool. By learning every paradigm a student learns programming, not a language.
EnderMB
+4  A: 

I think it's best to start at the bottom. Teach C first, it teaches discipline (static typing, segfaults) and gives them a sense of whats going on underneath everything else. Then move to something like Java or Python so they can get their hands on GUIs and/or dynamic typing. A taste of functional wouldn't hurt either. A suprising amount of the CS majors I know look at me funny when I mention functional programming.

directrixx
I agree, I've personally started to look into functional and must admit that many concepts from this world would help many OO programmers out there.
Alexandre Brisebois
A: 

I started with mIrc Script, and then moved to VB6. But I think that learning C++ in the beginning would have been great. I learned VB.Net + a little bit of Java at school and I feel like I missed something.

If it's for a full programmer, I'd start with C/C++. If it's only like a past time, to be able to do the basic stuff, VB.Net might be the easiest one to learn.

Patrick Parent
+3  A: 

One thing I find funny when trying to teach programming is that all begginers classes try to teach the syntax of some funky language. Lisp and Pascal where the favourites in my days.

This is not the most important thing to teach. The students will be stuck with the constructions and compiling errors and what not. Programming is really very simple. It's all about flow control. You just need to teach three basic concepts:

  • Atributions
  • Conditions
  • Cycles

All the rest flows from this beggining. You can even teach this with assembly mind you, altough any language with implicit typing and automatic memory management might scare off less people.

In fact I think a good begginers programming class should start by teaching both: A highest level programming language and the lowest level programming level and work the course towards a middle ground.

Only then should the sudents evolve into more complex issues like object programming and design patterns. I see plenty of people that were taught with VB and are clueless when given an optimization problem or multithreading problem since they are not able to follow all the steps back to the CPU.

This is the diference between knowing how to make a program and knowing how to program.

Caerbanog
+1  A: 

Depending on whether these are college or high school level (I'd assume college) and whether they are CS majors. If they are not, teaching them anything that constitutes programming without too much hassle like Java or even flash is good.

If they are CS majors in college, they will eventually need to understand the entire range from assembly to high level sandboxed languages. I would start with C so they do understand what a program is, what it does, and what pointers and memory allocation means, and have a better idea of how it translates into the hardware. From there I would teach ADTs. Only after teaching ADTs I would go to C++ and deal with OOP. Java can come on top of that later (honestly, they should just learn it themselves), and assembly can be in a different course.

Uri
A: 

I started with PHP, self-taught, then .NET. I'm embarking on a CS degree next week, and we do Java followed by C.

James Inman
+38  A: 

I think C is the sweet spot for teaching a first programming language.

Consider:

  • It has a small syntax
  • Programmers who know C can quickly pick up C++/Java/C# when they are ready to handle more complexity
  • It's close to the machine and doesn't gloss over necessary low level concepts.
  • It's use of manual memory management and pointers is perfect for making students implement basic data structures which they need to understand anyway.

The downsides to C that I can see are that:

  • It is a stretch to use it to teach the object oriented paradigm
  • It isn't as productive as a higher level language (eg Ruby, Python) and so it's harder for students to write something they can feel good about.

The most important thing is that C is a very small language. The last thing that students need is to be bombarded with are mandatory, seemingly mystical truths...

"using namespace std;" just makes it work...

Just put 'throws Exception' there, you don't really need to know why.

We'll talk about classes soon...

Perhaps the biggest bonus is that when a student who knows C picks up a more complicated language, they can understand exactly what the language is doing. Likewise, a student who knows C can also pick up assembly without too much trepidation.

the happy moron
I agree. C is great as a learning language. But there is so much to learn with the libraries, and teaching/learning good memory management practices with C isn't always taught well. But it is a far stretch from writing simple C apps to applying it to existing apps such as win32/linux projects.
Lamar
You're right, but it makes a great starting platform from which someone can learn a language with better libraries and/or more powerful constructs. Real-world problems don't tend to be small in any language: it helps to learn in a simplified environment.
the happy moron
I learnt C at uni, and it is a good place to start. Downside is that I know nothing about OO programming, and didn't really produce any code that was remotely useful.
Rich Bradshaw
It seems the strongest part of your argument stems from the principle 'less is more' for beginners. In which case, memory management is an extra detail we should not bother beginning programmers with. Therefore, a high level language with GC not C should be taught.
Alan
@Alan: perhaps. To teach a GC language, you'll talk about references and object equality... and you have to explain memory management anyway.I don't think you can gloss over memory managment without seriously impairing students' later progress. Might as well do it early, in a simple language.
the happy moron
I disagree. Teach high level so they learn concepts. Exceptions and namespaces are far easier to get than segfaults and pointers.
Oddmund
A: 

I started with Fortran before dropping out, came back to Uni years later and did Pascal. The Fortran I had learned 15 years earlier was quite a help! I've taught VB as a first language and C++ as a first language over the last 10 years or so. Next year we are moving to VB and C# (depending on which semester a students starts which language they learn first). In my experience it is not the language but more the student's ability and motivation that matters. Each language has gotcha's and stumbling blocks for the new student. The main things I focus on are planning before coding, good style, stepwise refinement and attention to detail. For most students once they have settled into understanding how a computer language works with a computer other languages come more easily.

There are other issues too with a first language other than the language itself. How much does the compiler/ide cost? Will it run on your OS of choice? What do you want to do with the language - get a job? Are there good texts available? Is there a lot of support available? Do you know someone nearby who can help (I spent a day chasing a syntax error in a COBOL program that turned out to be a period (.) in the wrong column - a friend spotted it)?

topcat
+3  A: 

The key to being a world-class programmer is having the insight to select the more suitable solution to a problem from a set of possibilities. The more possibilities that you have to select from the greater the likelihood that your solution will be of high quality.

There is a saying that "If the only tool you have is a hammer, you will see every problem as a nail". The issue with seeing every problem as a nail is that many of the problems that you solve with your hammer, while solvable, won't necessarily be particularly appropriate, let alone stellar.

You need to expand your mind's ability to creatively brainstorm multiple possible approaches to any given problem. The best way that I've found to do this is to study multiple programming languages. Specifically, programming languages that differ in paradigm: declarative, functional, imperative, object-oriented, procedural, etc., (some languages feature support for multiple paradigms).

As such, it doesn't matter what language you learn first. Languages are merely tools. It only matters that, over time, you learn languages/paradigms to expand you thinking to the extent that you can select the most appropriate tool for the task at hand. And last but not least, practice your trade-craft as often as you possibly can.

Fhoxh
A: 

I started with Visual Basic 6.0, then I fled away and started to learn C++ at college. For the sake of your mind, stay away from VB! I fled from VB because you can't learn anything useful with this language. According to me, it's only good to create reports.

Why did you run away from VB?
Alexandre Brisebois
A: 

I definitely wish that my school took much more of a polyglot approach to things. I don't know how this would work in practice, and I don't got to a CS college, but I think anything that could encourage programmers to take the approach of 'What language would best suit this problem domain?' rather than trying to ham-fist 'their' language onto whatever problems they encounter would be the most beneficial (I think it would've helped me at least).

I'm definitely in agreement with everyone else who has answered here that real CS education is about concepts such as recursion, OOP, encapsulation, information hiding, API Design, etc. The language is nothing but a tool that allows you to use your CS-Fu well in a specific problem domain. The fact that my education was mostly about Java hasn't helped me learn that concept, and I honestly left school knowing much more about Java than I did about actual information systems development.

+1 For Polyglot!

Tim Visher
+1  A: 

I started by learning BASIC, and then had a intro programming class in high school which covered BASIC and Pascal. I went to college as a CS major, and the language we started learning right off the bat was Java (writing basic consol apps and learning data structures) then transitioning to gui driven java applets in the second intro course. Once I got past the intro courses though all the rest of my courses were in C and C++, revisiting Java only infrequently.

I think ultimately Java was a good starting place because it introduced me to Object Oriented programing techniques in a well structured way. I could learn a lot of things without needing to be intimately aware of all the under workings of the system that I would eventually learn with C and C++, and the syntax is similar enough to C that the transition was easy to make. I think not focusing on any one language for to long in the beginning was really helpful for picking up the basics of programming without becoming indoctrinated in any one language. It also forced me to learn how to use manuals to look up APIs and Libraries and find answers to things and be a self sufficient coder. Also, Friol at the top was right, you don't learn any language unless you program a lot.

The Brawny Man
+23  A: 

In my opinion the goal of teaching the first language to students is to enable them to think in an algorithmic way. It should make as simple as possible to grasp such basic concepts as recursion, iteration, computational complexity, recursive data structures and so on. Encourage them to write beautiful code and elegant algorithms rather than super eficient code that takes advantage of all the quirks of the architecture. Essentially, this means not getting in the way of the student. The practical stuff should come later, when the students already understand what they are trading for better performance.

This means that the language should be high-level. C is definitely not appropriate: it forces the programmer to take care of those messy details and may make the student focus more on the architecture (which is in fact only accidental) than on the computation itself. Understanding memory management and stuff is very important, but not on this level.

Java, on the other hand, may be a bit overwhelming. Just think about the amount of code you have to write and concepts you have to introduce in order to get the mere "Hello world"... Also, the vast amount of available libraries is paradoxically a disadvantage: code reuse is great, except (again) not at this point. Learning Java forces the student to learn how to use the IDE: writing Java in a plain editor is probably not the best idea.

Python or Ruby may seem not bad: they are both high level and extremely easy to start doing stuff. Their design is focused around being practical, though, and that means that for sake of efficiency and practicality they discourage some important programming techniques, like recursive functions.

This leaves us with high-level, “academic” language, like Haskell, Prolog or Scheme. The first two base heavily on some nontrivial concepts (like declarative programming), so my number one choice would be Scheme. Scheme is a very small language with very few special cases, making it easier for students to concentrate on the important stuff. Their errors will be more likely to be related to actually thinking something wrong rather than misunderstanding the subtleties of the object system. Finally, there's SICP, which makes a very pleasant reading.

Note that the slightly alien outlook of Scheme (with the funny syntax and so on) is an advantage in this case. For students with prior exposure to some programming (hacking PHP pages and so on) it will be easier to drop any bad habits they may have caught, and the rest... well, the rest doesn't really care, as anything would be totally new to them.

Of course, the next thing to learn should be some serious, industry ready language. C, C++, C#, Java, Common Lisp, Fortran---take your best shot. Let the students at least have nice memories of their junior programming course :-)

Ryszard Szopa
+3  A: 

Definitely start with C (and a survey of languages). C is a pervasive base for most everything else, and thus should be learned first. But it's important how you learn what's built on top of and under that base. I'd recommend working up and down like this:

  1. C
  2. Survey of Languages
  3. Machine and Assembler (and debugger skills)
  4. C++, Java
  5. Script Languages (shell, perl, VBScript)
  6. Modern Languages - C#, F#, Z#, whatever
bill weaver
+3  A: 

These days, with all these new-fangled languages with garbage collection, people don't think twice about resource allocation or clean coding. I think C/C++ is a must because you have to think about the impact your program will have on the machine instead of just crapping out bloatware and letting the garbage collector do all your thinking for you.

MattC
+1  A: 

Standard ML - Love at first sight

As freshman at the institute of computer science, I had only toyed around with PHP when I made my first dynamic homepage. Because of that I had no idea of the functional paradigm of Standard ML. And neither had the other students. Languages like Standard ML doesn't force anyone to know the insides of an architecture or an xmlrpc library. Instead, I could concentrate on the "computer science"-problems, be it Fibonacci, the factorial function or faults. In the courses following C, Java, etc. was introduced and like most programmers I chose imperative languages as my main problem solvers. But i think the most important attribute of a computer programmer is to have the knowledge to choose a language that best accomplishes the task at hand.

kjensen
+2  A: 

Heh... the first language that I used in a college computer course was called Karel (I already knew Basic and Pascal from high school). The "language" was really a scripting language that let you control a robot that you could navigate around a maze (like Pac Man without the ghosts). You had only a handful of commands - is there a wall in front of me, turn left, turn right, move forward, is there a dot under me, pick up a dot. This was at Carnegie Mellon University - considered to be one of the best CS colleges in the world at the time. The point was, the language doesn't matter as much as the logic that you create with it. A good language should be almost completely transparent when solving your problem.

We moved onto Pascal after a week or two. C++ was used in later courses, with other courses that used LISP or ML. There were no courses on a specific language though - the course that used LISP was a course on object oriented programming. Again, the point was that the language is secondary to the concepts.

A beginning student shouldn't be worried about the inner workings and compiler directives, etc. They should be concentrating on algorithms and structures, etc.

Tom H.
+2  A: 

I think the students should learn more than one language or technology over the several years of study.

In order to make them have solid knowledge I would actually start with teaching them C and assembler so that they know what they are dealing with (beneath all the nice abstractions there is a machine that knows how to deal with registers, bits, interrupts and other low level concepts.

Dan Cristoloveanu
+2  A: 

As a student, one should be able to translate one's thinking into a computer language. For that, there is none better than How to Design Programs. Years back, I was bogged down by heavy language syntax and the overload of behind the scenes for getting simple things done.

Additionally, Working through Scheme or Python works is akin to learning to write semantically in our own mothertongue, which is instinctive in all of us. We can learn about differences between simple and complex sentences, as we pick any language.

Mak
+1  A: 

I suggest Python. It's quick, presents crucial ideas in simple ways, and is fairly good at being multi-paradigm.

Multi-paradigm in particular could be important, as it gives a good platform to explore different programming styles and may be beneficial in helping the students decide what directions they want to go next, if not just decide to stay with Python.

J.T. Hurley
+3  A: 

I would start with the How to Design Programs, which happens to be in Scheme, because it is the result of at least ten years' work in teaching beginning students to program. I would then move on to C because there is nothing like C for developing a real understanding of what the machine is doing. With some Scheme and some C under your belt you'll be ready to tackle just about anything.

Norman Ramsey
A: 

I don't think a language matters really. As long as you get the principles and practices. I can't tell you how many Java programmers I meet who can't write code in any other language. I mean com'on - a variable is a variable. A programmer should be able to hack his way through anything really. Sure, you need docs at the ready, but with compiles today and syntax checking you really just need to know the environment (framework).

But if I had to pick, probably Python. It's easy to pick up. Takes time to master. And it's fun. Plus an outstanding community. My second choice would be c#. But learn the fundamentals with Python first. Whatever you do don't use Java to learn how to code. God. ;)

Stephen Cox
A: 

Ask this question again, but this time, don't use "programming" language, use "Foreign language" or "Instrument" or "Wood working."

Most academic pursuits start with broad concepts. Once you understand broad concepts, drill down and refine to less broad. Always building upon the previous understanding until you get to a point where you understand all the concepts and now much understand more refined and specific points.

jerebear