15

A non-programmer friend will be starting the Computer Science college course in a few months. I'd like her to try her hand at some programming before she starts her studies (the course itself expects one to know C, but it's an horrible language to learn to program at). What language would be the best to do so?

Related question: Best ways to teach a beginner to program?

41

Python

Edit: Some people seem to want me to explain my reasoning, so here goes, in no particular order:

  • It's pretty easy to read even with no prior programming experience
  • It manages memory
  • The REPL provides instant gratification
  • There are good libraries
  • It's useful in the real world
  • It's multiparadigm, so you can learn a little about FP, a little about OOP, etc.
  • There's lots of good, free resources (Dive Into Python, How to Think Like a Computer Scientist, et al)
11

The biased rubyist in me has to say ruby is awesome for this. Especially since you can get started right away

10

Everyone should start in C, learning the basics will just help her in the long term. But to understand concepts of OOP and other good parts is Java or C#, a very good book for total beginners is Head Start Java ( or C# ) which uses a different way of teaching, using many pictures and good illustrations on how it works.

You should check it out!

6

Scheme if they're willing to actually read and work through SICP.

4

You might consider looking into Logo, which is probably best known for its Turtle Graphics. It was designed in the first place as an educational language and is fairly easy to pick up. Thanks to the graphical nature of Turtle Graphics, she'll be able to see the changes she makes quickly.

Once she gets Logo, move to Java using BlueJ. BlueJ is an IDE that was likewise designed for educational purposes and allows for a graphical layout of the package dependencies, direct instantiation of objects, and then invocation on those objects, allowing her to see what stuff does and how they work. Since the Java syntax is fairly similar (albeit greatly simplified) from C syntax, it also operates as a step in that direction and the great standardized libraries means you can quickly move on to data structures if she starts grasping stuff easily. You could use C# for similar purposes, but you'd lose any benefit from the BlueJ IDE.

After this, if you actually need to, you can move onto C. I'd skip C++ entirely since it really is the worst of both worlds: it's higher up an more complicated than C, which means there is a lot more to learn, but it doesn't implement OO and such stuff as nicely as C#, Java, etc.

4

If the pre-requisite is C then you've already answered the question.

Learning a language well is going to take more than a couple of months. This student really should start with C, be given a copy of K&R and just left to continuously go through the book and learn as much C as possible.

A lot of programmers seem to want to tout the various 'beginner languages' to allow beginners and children to program. What they've seemed to have forgotten is that programming isn't and shouldn't be easy. This girl is going to struggle throughout her CS degree if she cannot program, and as a beginner she doesn't deserve special treatment.

C is your ONLY choice. With luck this student will be able to pick up enough C to be successful on this course.

3

OoK! - Designed for orang-utans, so it must be easy to learn!

2

I actually researched this myself a little while ago, here's some specific teaching language resources:

  • Scratch (aimed at teens)

  • Blue (aimed at 1st year undergrads)

  • Update: apparently an update to Blue, BlueJ, exists (thanks Nick)

Edit: if she's expected to learn C in months from absolute zero, I think C# is going to be a strong choice, but only after spending some time in a scripting language or something lighter. Definitely not C or C++ straight up though. Ack!

2

I would suggest C or Python. I am guessing Small Basic (developed by MS to teach programming) would be too simple? The good thing with learning C is that it will really help later on with C#, C++, and a whole bunch of other languages.

I do recommend C though, as it is required for her course.

2

At uni when I was there about 6 years ago we started off by using Pascal / Delphi to get the basic programming understanding done. This was done as the syntax is pretty easy and straight forward. Other than that I'd go with getting a beginner programming book in something like c# or Java (done both myself). They both sound scary but will help you on your way through uni and career; it just depends on which route you want to take :-)

1

I think an easy scripting language like Python would be good. It has a clear structure and you do not need a compiler.

Nevertheless I think it is better to start with C. Since there you have basic concepts like pointers, which aren't there in scripting languages. I expierienced beginners who had huge problems with those concepts since they had never seen it before. Somehow it's more difficult to learn a more complex language after a simple one than the other way.

Also I would not recommend languages like Ruby where the syntax can be far away from C.

1

I asked a very similar question awhile ago here. It may be of some benefit.

1

When you say:

the course itself expects one to know C

Do you mean to say that knowledge of C is a course prerequisite? Or that C will be taught as part of the course?

When I started my CS degree (many years ago) most of us already had some programming experience, but the lecturers would say they preferred to teach people with none: no preconceptions or bad habits to correct.

Still, it can't hurt to dip your toes in. I think the best choice for an introduction to programming is a modern scripting language with an introductory text that suits the individual's learning style.

If this person has a particular kind of sense of humour, may I humbly recommend Why's (Poignant) Guide to Ruby.

1

lua is a nice language, it reminds me a bit of what would happen if you redesigned basic after finding out which parts of basic are complete ass.

Nevertheless, any language is fine as long as the right approach is taken. C can be an extremely intimidating language. But reading this book makes it seem easy and approachable. (it contains the original "hello world!")

Javascript is a scripting language, but its basis in the browser, cross browser compatibilities, and its various other hairy bits make it intimidating. But follow this tutorial and programming in javascript becomes, actually kind of fun.

I'm a bit biased towards those three languages at the moment, but I'm sure there's some equivelent documents for any language you like. The trick is to pick a very very small subset of the language to teach first- one that makes it immediately useful and fun. Then build out. Don't try to tackle it all at once, and most definately do not start with theory. For instance, if you're teaching ruby don't try to explain what it means for everything to be an object. start with a single simple program, and break down step by step how it works.

1

Very biased, but I think it's good advice; Choose C++ and start with Qt Tutorials and Examples. But, Scheme/LISP and the SICP book as advised further up is also an excellent starting point for any developer!

1

I'd suggest looking at something like Processing, Structure Synth, NodeBox, JavaFX, Alice or Greenfoot.

All of these are highly interactive and visually oriented (and the last two are specifically aimed at education and/or kids). My perception is that most beginners with no background in programming will become more excited (and therefore have more stamina and engagement) about being able to make the computer do something interesting that they can see and show others than about the pure philosophical elegance of algorithm design.

1

I expect to be voted down for this but if I had to get someone up to speed on the basics of programming in preparation for C I would use JavaScript. The basic philosophy of the syntax is the same as C (braces and semicolons) and it completely removes the whole IDE thing and places them squarely in an environment they are probably intimately familiar with - the browser. Anyone (and I do mean anyone because I have seen it) can open up a text editor and do copy paste development in JavaScript. The trick is to get them to understand what they are copy pasting.

1

If she needs to know C for the course, then she should learn C.

Also, I think that going from an unmanaged language to a managed language is easier than the other way around; so of course she should learn other languages after C (Java, C#, whatever)... but it may be a little harder to understand some of the low level concepts if you start off the other way around (at least for a beginner).

1

C# or other .NET Languages.

1

Contrary to the current fad, OOP languages are the not the first thing you want to learn. As someone else mentioned in another post if you want to learn something, do you read about it or do you actually try to do it?

By that logic the less you need to know in order to code a working application the better off you will be (as a beginner anyway) :)

C++ and other OOP languages were created by engineers for engineers and it shows. Higher level languages (whether they have a consistent design or not) tend to be cluttered with complex features and useful mechanisms whos internal mechanisms are not immediately obvious.

Ironically enough the human thought-process tends to be linear and so procedural programming is a better fit for people just starting out. Ever wonder why the first letter of BASIC stands for "Beginners"?

That said there is a reason why many languages, even very high level ones such as Python or Lua can STILL interface with C, because while it may not be simple it's design IS simple and cosistant with very few gotchas to account for which makes for a smooth learning process.

More importantly however is the ability to obtain feedback when programming. Humans are visually oriented and having some form of visual confirmation of program success or correctness is imperative. When testing the functions of the language, as well as our own code, many new programmers will right minitests to confirm their code is functional.

This is of course where C falls flat. Its true we have printf and scanf but that does little in the way of help the new programmer when trying to discern which of the plethora of IO functions available in the standard library is the correct one to use in any given situation.

Python or almost any other language mentioned here (with a few exceptions) would be a good fit just so long as you don't get stuck with them. Programming languages are tools used to solve problems. Different languages will be needed for different problems. And with time the tools will improve and change to better solve problems, or to handle new problems that appear.

Personally I would say she should start with what she expects to learn: C. Nothing like an early start to get you going! I was a complete newbie to programming just a month earlier (except for a few batch scripts, but those don't count) and I started with C. I'm now working with SDL regularly as well as several other relativly (for a beginner) difficult libraries.

IF theres is one thing that life has taught me it's that no matter how difficult, if you set your mind to learning something you often can! :)

0

When learning alone, maybe Scheme, maybe Basic, maybe Ruby ... even PHP is fine.

When I teach Newbies, I always use Smalltalk. It really helps to be able to inspect everything you have just done and show the newbie what happens on a line by line basis. In other languages, there is this switching between editing mode, that only distracts. Ruby brings IRB, but it isn't the same. That being said, IRB would be very good for teaching someone ruby.

When learning scheme alone, try to get a hold of DrScheme or anything else that helps you keep track of the brackets.

And when learning Basic, i believe these things have changed, but back in the old days Visual Basic 5 was quite neat for teaching. You could start with a GUI and the callbacks and the first programming task to do would be to keep the window look good on resizing. Very intuitive and instructive. Really.

And for someone who has played with HTML earlier, PHP is certainly a nice easy start.

0

Language not-programming:

  • HTML
  • CSS

thay are simple and they accustom the approach of the programmer ("Why this nto work?" etc )

After I suggest:

  1. Ruby
  2. Python
  3. Java if he can be followed by an "expert" because it'nt a language no much immediate.

But he want really became a developer, C is the best (as says Joel Spolsky here and here) (ONLY if you want became a GREAT developer)

0

I would suggest C or Java so that she can reuse her expertise. Moreover from the course perspective, C is important and its not too tough to kick start.

0

I started in Basic, its the best language for beginners IMO since it teaches all the basics. Following Basic I would suggest PHP since the syntax is very similar to C. I was learning C but gave up when I got to pointers, and then started learning PHP with the intention to go back to C once I learnt PHP. But i never felt the need to go back in 3 years :)

0

I would suggest to start with a procedural language where one can learn the basics of programming that is how to implement the logic.

I think C would be the best language if one wants to be a good developer, C makes a programmer to think :), which is very vital thing for a good developer.

Knowledge of C helps in learning other languages because many languages have similar syntax of C.

0

Aw, no love for Perl :,(

There is no 'one true beginner language'. All the answers here are probably pretty good (apart from C on its own). If you had to pick only one though, Python might be most useful since it is popular as a real development language, has some syntax similarities with C and has interactivity for those who like that sort of thing.

That doesn't mean you can't learn more than one language at a time. If the course centres on C then you can do some simple C tutorials while spending most of your time on a more beginner-friendly language. Or do a different course.

0

I started with Pascal, and besides it's a little old, i think it still be a good option, because it "teach" you the way of think to programming, and it sintax are close to english.

0

I started with Modula-2 back in 1994 as it's what we were first taught at university before then moving on to C. I would recommend that your friend starts with C though, especially since you mentioned that it's a pre-requisite for the course (which seems a little odd). Even though it's going in at the deep end, she might as well start getting to grips with it now.

0

I would say either Python (as much as I hate it), Lua or Visual Basic (or preferably C#!) .NET.

Python is more object oriented than Lua, however I find Lua allows you to do a great many things more that make programming in it a whole lot easier. It only gets complicated when dealing with Objects but once you get your head around that its easy. Basically everything in it is a 'Table', which I think simplifies everything.

As with Visual Basic and C#, they both have IDE's that actually help new programmers to a point. Intellisense is a great resource for those who are new to programming and the .NET Framework and if she starts struggling with something she will be able to easily find the answer. They both have Free editions of the IDE as well and both are well used in the industry. I think C# is very similar to C as well, although I haven't touched that much C at all....

0

Scheme may not be "fun" or "flashy" like Java or VB, but coupled with a good textbook that emphasizes problem-solving and algorithmic design over learning the feature set of a specific language will give her a good grounding.

Others have recommended SICP, but I'm going to suggest How to Design Programs for an easier (but just as deep) intro to CS.

0

Rebol is both OOP and Functional Programming Language. It's very easy to learn even for non programmers and with very little you can do amazing stuff like sending twitter in one line see http://reboltutorial.com

For programmers you can use Rebol to generate C# or Java code thanks to built-in parser and domain specific language engine.

0

I can't stop laughing at brainfuck existing. Now, that's some very good starting programming language! NOT!

0

Start with javascript. You can get going straight away with any browser and notepad. You'll learn about variables and functions and can see results on the screen straight away. You can also pick up some html, css etc and decide which you like best. Its really easy to publish your work for other people to see!

Through trial and error you'll learn about type systems, objects, namespacing, closures, scope etc which are things you may naturally come across on your 'adventures in programming'.

There are plenty of free tools such as Eclipse + Aptana once you move past 'Hello world' and lots of free online guides.

-10

Joel Spolsky thinks she should learn Java.