views:

2227

answers:

34

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?

+37  A: 

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)
Hank Gay
+1 Although I switched from Python to Lua some time ago, Python's syntax and Human friendliness would make it my choice as well for a beginner as well. Lua's "magic" and Ruby's "everything is an object" syntax is a bit too weird for someone with no understanding IMHO
Robert Gould
is there even a guide for non-programmers to learn python
zaratustra
http://homepage.mac.com/s_lott/books/nonprogrammer.html
S.Lott
Justify you answer.
OJ
+1 for good explenation
Filip Ekberg
+1 for the explanation
Alabaster Codify
I know people like to gloss over the indentation thing but: it teaches good indentation habits you can carry over into other languages.
slim
slim: good point, never thought of that, but when I see some beginners Java code it makes a lot of sense.
Joachim Sauer
Plus it gives examples with John Cleese
Cawas
+10  A: 

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

jcapote
+1. google "poignant guide" too ;]
that app seems to be borked.
zaratustra
There is also a "programming for non programmers" book from the Pragmatic Press I believe.
glenatron
+4  A: 

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

Hank Gay
+1  A: 

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.

okoman
Hold your hourses, we could argument all day about scripting being progrmming ;)I second the C-part!
Filip Ekberg
A CS major is going to have to grasp a variety of syntaxes eventually. Why do you think they can defer this, but they have to grasp pointers right away?
slim
@Slim: Because pointers and memory are important cornerstones of CS. The syntax differences between C# and Ruby are not.
Geoffrey Chetwood
+11  A: 

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!

Filip Ekberg
C as a beginner's language? That's just crazy. Most people would be lucky to even compile something before they lose interest.
slim
Actually I just re-read the question. If the target is to know C within a couple of months, perhaps jumping right in isn't such a bad idea.
slim
I actually think this is a terrible idea: C is a ridiculously complicated thing to learn programming from. Keep it simple and abstract away what you can at first I say.
annakata
-1: C is hard work. Important for pros -- not useful at all for n00bz
S.Lott
Hehe exactly, you can make C very pedagocig. Actually i've only tutored C++ which isnt very much different and some fundamentals is very easy to explain once they know C++. And since the chick attends to a CS program, i guess she know some about what shes getting in to :)
Filip Ekberg
You guys completely miss the point. What are the main parts when you Start programming? Do you focus on very complicated string operations? Do you start with OOP? NO, thats further into the jungle. You start by doing arithmetics, displaying text, logical operations and so forth
Filip Ekberg
These parts doesnt differ that much from language to language, besides you "import" stuff a little diferently, but it's hard for everyone the first time, dispite the language. Also when they do know the more basic stuff, C is a very good point to continue
Filip Ekberg
C -> Java is better than Java -> C, why you might ask? Because people get WAY to much compfy in doing the nasty stuff in Java. Read more here: http://www.joelonsoftware.com/articles/fog0000000319.html he has some interesting points.
Filip Ekberg
This is tough. I'd definitely recommend C before C++,C# or Java, and even go as far as say that C should be understood before Php and Javascript, however the caveat is C should be the second language you learn. First language should be really human readable, like Python, or may I even dare say Basic
Robert Gould
C first for sure. Gotta learn to walk before you learn to run. Abstraction is dangerous if you don't understand what goes on underneath the abstractions.
Geoffrey Chetwood
This is crazy talk. "Learn to walk before you run": yes. Python is walking. Pointer/memory management in C is running.
slim
@Slim: lolwut? You have to learn the basics before you get lost in abstractions. I hope I never have to work with a programmer who doesn't at least understand pointers and memory management as a base...
Geoffrey Chetwood
@Rich B: I completely disagree. Did you learn assembly before you learned C? Chip fabrication before you learned ASM?
slim
@Slim: Yes. I started out with learning the system architecture of Z80s, then programming with assembly. There is a heavy deficit of programmers these days that actually understand simple concepts like memory management, pointers and other basics.
Geoffrey Chetwood
OK, you're old school and have skills suitable for low level jobs. But there are many fields where more abstraction is better than less. In my enterprise services job, I'd rather work with someone who can structure a system in a 3GL than one who can avoid buffer overflow in 2.5GL like C.
slim
@Slim: I am 'old school'? I am 26. I would rather work with someone who has a base understand of how computers and programming works than someone who knows how to make a webservice.
Geoffrey Chetwood
I'm also of the school of learning the specs of your hardware before moving on, like Rich B, and I hope I'm not that old school (30). However It's seems like its easier for an average person to start with scripting, especially if they haven't been programming since childhood, like Rich or I have.
Robert Gould
Hardware? Huge swathes of programmers don't really give a damn what the hardware architecture is *because you don't have to any more*. I assume all you pro-C people also advocate teaching people Latin and driving stick?
annakata
@Rich B: even if you are tasked with writing a Web service?
slim
PS you can be 'old school' without being old!
slim
@annakata: stop being so ignorant. "Because you don't have to any more" <- lies, lies and more lies. I've seen a lot of those "good" scripters out there which have been working in any scripting languages for years, and guess what? They still do mistakes they would avoid if they just...
Filip Ekberg
..bothered to learn a REAL language from the start. You never get to high level to learn memmory management, and knowing about how the CPU handles threads, processes, adressing etc is just so important for me and i feel its important that my co-workers know the same.
Filip Ekberg
I couldn't agree more with Rich B. A programming language is meant to talk to a computer, not to another human, and not understanding the basic concepts produce the worst java, c# and whatever hl-language programmers.
Trap
In the latter company I worked for some 'expert' Java programmers with no low level programming background made a fabulously engineered server application which could handle... 200 concurrent connections... whoaaah! Yes, that's what I said "whooaaa".
Trap
If one can't handle C, then he better not enter a computer science college.
hasen j
-1 Actually, every *programmer* should consider learning C at some point. But, nowadays, definitely not the best option to begin with.
Cawas
@Cawas, int main(){} is easier to understand for a beginner than: public static void main(String[] ){} don't you think?
Filip Ekberg
@Filip yeah, but not easier than `print "Hello World"` with no need of `int main () {}`
Cawas
+2  A: 

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!

annakata
not sure if Blue is still supported, but the IDE used in Blue is now called BlueJ and is excellent for beginners. check out the resources here: http://www.bluej.org/
Nick Kavadias
Good info. I'll edit that in.
annakata
going from C# to C would be painful. Might be better to start straight in with simple stuff in C.
John Ferguson
If you haven't programmed before, and you're self learning, these are the types of languages that will get you going. I'd like to add another plug for Alice here: www.alice.org.
NomeN
A: 

Joel Spolsky thinks she should learn Java.

Dana Robinson
I knew I'd get modded down for this but I couldn't help myself.
Dana Robinson
lol @Dana, that's how I feel sometimes....just can't help myself.
kenny
What's funny is that there's actually useful information in the linked article.
Dana Robinson
And to anyone inclined to vote, please don't vote this up. It's even funnier with a big negative score.
Dana Robinson
-1 to make Dana laugh.
Robert S.
I love Java, but since you asked ... -1
Ross
-1 because it's funnier :p
Nicolas Dorier
+2  A: 

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.

Damien
Hard to vote on this since you gave three answers. C - no. Python - yes. Basic - no. -2/3.
S.Lott
+1  A: 

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 :-)

WestDiscGolf
+1  A: 

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

Shane MacLaughlin
Then edit the question and insert the related question. Certainly not helpful as an answer.
Geoffrey Chetwood
@Rich B, I inserted a link in the answer above, what exactly is wrong with that?
Shane MacLaughlin
+1  A: 

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.

slim
A: 

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.

A: 

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)

alepuzio
In the first of those, Joel recommends Scheme in more places than he recommends C. But in both, he's not recommending a *starting* language. He's just saying that those paradigms neeed to be covered before you complete a degree.
slim
Hi Slim,Joel recommends Scheme for understand recursion and functional programming (http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html) and C if he want became a REALLY developer, not if he want writes "script code"( http://www.joelonsoftware.com/articles/fog0000000319.html).
alepuzio
True, but he does not recommend that they be used as a starting point: only that they are useful things to understand in the fullness of time. It's good to have read Shakespeare. That doesn't mean we give babies Hamlet as their first book.
slim
PS your edit acknowledges that. Some of the other answers recommend C as a first language. That's madness.
slim
@slim: What about C scares you so much? It is a very simple language. I have seen many beginners pick up C and run with it. It sounds like you are basing your opinion off your own personal fear of C.
Geoffrey Chetwood
+1  A: 

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.

Breton
A: 

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.

Tuxist
+3  A: 

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

tpower
+1, thanks to this language we can know very early if someone is self-motivated to program :D
Nicolas Dorier
And here's a Hello World written in OoK!: http://stackoverflow.com/questions/483997/what-language-has-the-longest-hello-world-program/484007#484007 Plus that is a very good list of bad languages for beginners. ;)
Cawas
A: 

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 :)

Click Upvote
A: 

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.

coder
+1  A: 

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!

Henrik Hartz
+1  A: 

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.

joel.neely
well said! and +1 for Alice, I have been looking into that one and it was seriously addictive. Plus its a safe and simple primer for common programming constructs. Alice 3 is not quite there yet, a few bugs and the gui is not yet as good as it could be but nothing major and you can fool around with the sims (with awesome prescripted complex movements!). Alice 2 is the safe bet though.
NomeN
A: 

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.

John Ferguson
I have deep affection for Perl, but newer scripting languages show it up in certain areas. Deep data structures in Perl are very hard to grasp: where to use a ref, where not to, etc.
slim
A: 

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.

nunolourenco
A: 

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.

Ian Devlin
+4  A: 

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.

James
+3  A: 

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.

EnderMB
sure, when classes have begun she should be programming C. But then she is receiving training by teachers, people that (hopefully) have a diploma in education. Before classes begin however there is nothing wrong with a primer language with direct visual feedback (which has been shown too motivate and intrigue the best).
NomeN
+1  A: 

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.

Nick
1. no language needs an IDE, I code in gedit or notepad a lot because I can't be bothered to download something for the short time I spent with the language.2. javascript bites you in the ass too much for beginners, lets get them started with the basics.3. copy paste development can be done by any idiot, but you'll hardly learn from it, which was at the center of the question.I can't believe anyone voted this up...
NomeN
I upvote you for this!
James Westgate
A: 

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....

Dalin Seivewright
A: 

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.

Barry Brown
I love Scheme.. never used it in a work environment, but still love it :)
David Brunelle
+1  A: 

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).

Giovanni Galbo
+1  A: 

C# or other .NET Languages.

MarlonRibunal
+1  A: 

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! :)

A: 

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.

Rebol Tutorial
A: 

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

Cawas
A: 

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.

James Westgate