tags:

views:

218

answers:

14

My friend would like for me to guide her into learning programming. She's already proven enormous aptitude for thinking like a programmer but is scared of the idea of programming since in her mind it's relegated to some magical realm accessible only to smart people and trained computer scientists (ironically, I am neither but that's beside the point).

My main question is the age-old and irritating question: which language should I chose? I've limited it down to these:

  • PHP: dead simple to start with and I remember enough of the language to answer all novice questions. However, I can think of a million reasons why I wouldn't recommend this as a first language. The most diplomatic of which is that there's no desktop app option to which I would feel comfortable subjecting a novice.
  • Python: supposed to be wonderful for beginners and generally everything I've heard about it screams that this is the correct choice. That's the problem: everything I've heard about it. I don't know it yet and have a lot of projects going on right now so I don't feel like learning it yet -- but I'm going to be the tech-support when any little thing goes wrong. I know there are tons of online resources but in the frustration of the moment, it's always going to be just me.
  • C#: this is the language I'm most comfortable with so I know I can be good tech support. I also love this language and its versatility and community. The big drawback here is that I remember when I first learned it after doing mainly PHP, Perl, and JavaScript and I found the experience overwhelming. You are simultaneously learning: programming concepts, C# syntax, strong typing, OOP, and a complex powerful IDE with a bazillion options and buttons all over it.

edit: another pro for C# if a console or desktop app, from the start she could send it to non-tech savy friends and family (who all have Windows XP or later) without asking them to install a new library and without having to figure out how to package it with something special to make it work as a stand-alone. As far as I know, the opposite is true for Python.

+2  A: 

I'm not sure if you'll get objective answers to this question, as everyone has their favorites. However, among the ones you list, I would suggest C# due to the sheer number of scenarios that would open up for her (web development, UI, console applications, xbox 360 games, silverlight applications, and windows mobile/windows phone 7 development, to name a few).

Jeremy Bell
It's also a pretty easy language to learn and use and the development tools for it (visual studio express) are nice too.
Jeremy Bell
+4  A: 

From those 3, I would recommend this order:

First: Python
Second: C#
Never: PHP

Python is simple -- you can write simple programs without having to worry about classes, access modifiers, static member functions (as opposed to C#, where "Hello, world" requires the creation of a class with a public static member function -- good luck explaining all those in lesson 1). As an added bonus, Python teaches you to indent your code well.

C# is also a good language, but I think that it asks too much of new programmers. OOP is something that you should learn once you've got your head around the basics of procedural programming and basic object programming. It's hard to teach people why OOP is generally considered to be good practice when they don't even know what a variable is yet.

PHP is just horrible. Sure, if you want to throw a quick web page together (as it was designed to do) then it's fine, but it hardly promotes good, well-structured programming.

Peter Alexander
Those are all good points. However, you don't need to teach all those concepts in lesson one. Just start with an existing "Hello World" program and have her change the Main function to say something different, then gradually introduce more concepts. I've seen first-time programming students go from zero programming knowledge to being able to design and implement relatively complex programs for their experience in just a few short months - so don't underestimate those motivated students! :)
Jeremy Bell
I don't think that it will confuse everyone, but I have noticed a lot of people that learn Java or C# first that just make everything public and static because that's how they wrote their first programs. In my opinion, it's best if you only need to use language features once you learn them.
Peter Alexander
+1 For Never: PHP
Helper Method
+6  A: 

Which language should I choose?

This is close to, but not quite the right question. The right question is:

Where can I find a language, development tools, and reading material that are designed for people who are just learning, but will scale up to "real programming"?

The answer is How to Design Programs and PLT Scheme. Fifteen years have been invested in the development of materials that have been shown objectively, in serious studies, to lead to better outcomes for beginning students.

Start there and get to Python in the fullness of time. Teach yourself programming in ten years.

Norman Ramsey
+8  A: 

I would dissuade you from thinking that "in the frustration of the moment, it's always going to be just me." Languages come with communities, and teaching her how to ask intelligent questions on IRC, Stack Overflow, etc. will do more to empower her than your particular choice of language.

That said, Python has wonderful pedagogic features. At its heart, it's a procedural language, so you can start off with dead simple top-to-bottom execution, only introducing her to functions once she's ready, and you get to keep all of the familiar syntax and conventions that she's already learned. When you get to the point of adding in classes and modules, you can do so without having to disrupt any of the foundation that she's already built.

Callahad
A: 

I would suggest that you find out what she wants to accomplish as a programmer, what she finds interesting, then use that as a basis to pick the language to use.

EvilTeach
I suspect that the first thing is to get into it at all, and find out it's possible.
David Thornley
+3  A: 

I think that you are really answering your question yourself: C#.

  • You are comfortable with it and that means a lot to know the subject to be a good teacher.
  • It is a versatile language, that can be used for numerous scenarios.
  • Several "entry-points" to start learning:
    • Console apps for "real" programming.
    • Winforms for point-and-click and some event handling code.
    • ASP.NET for web.
  • Commersially wide spread if she wants to make programs for a living (although she should learn more than one language in that case).
Anders Abel
C# has the nice win of getting to easily make guis on Windows, but the drawbacks of getting into that depth right away!
Gregg Lind
+6  A: 

Of your choices, I'd pick C#. I say this as someone who doesn't know C# and loves Python.

My reasoning is:

  1. During the beginning of the teaching phases, you're going to have to be very hands on. She's not a senior programming learning a new language; she has to be taught a new way of thinking, a whole new discipline. So your knowledge/expertise in C# will definitely be a huge factor.
  2. C# has great tools for the beginner. A wonderful IDE will make her able to focus on just the code, at the beginning, without worrying to much about how everything fits together. With time, you can slowly explain how all the files get compiled, linked, etc.
  3. Knowledge in C# will be easy to translate into working programs for various platforms, i.e. executables that other people can run, without too much extra work.

I would like to suggest another choice, especially for someone who is unsure: teach her HTML/CSS/Javascript.

The big benefit is that it's really really easy to see results, and with a little more work, you can even see some really good results. This will definitely encourage her to keep at it, from the start, because she'll actually be able to make something she can admire (and others can admire) pretty quickly.

Also, the learning is very simple: first some basic HTML, which is not too programming-like. Then a little CSS, which again isn't too programmatic. Then, slip in a little Javascript, first for little effects around the site, then slowly build up from there.

After those languages, you can move on to C#, focusing on ASP.NET, and she'll be well on her way to a serious, useful website.

Edan Maor
+1 for HTML/CSS/Javascript.Just don't get into browser incompatibilities and type-coersion problems!
justkt
It sucks that JS gets into the DOM right away. That's confusing as heck to newb's, in my experience. No good REPL either.
Gregg Lind
@Gregg - Yeah, those are big problems, especially the lack of a decent REPL (Python wins easily here: I can just fire up IDLE and show people actual working snippets in 5 seconds).
Edan Maor
+1  A: 

Given your options and if I was going to teach someone programming today IMHO I'd choose C#. Why? Because it's simple yet powerful.

Simple: easy to understand the language constructs and consequently easy to teach.

Powerful: Generics, LINQ, etc, etc, etc... countless features allowing you to implement the more diverse tasks.

In it's current incarnation (C# 4.0) there's also dynamic power.

To see C# broader acceptance worldwide take a look at C# tag at StackOverflow.

Leniel Macaferi
+1  A: 

Picking from you list with no further info, I'd agree with C# as front-runner, followed by Python and finally PHP. It wins in my book for being the best for general-purpose programming tasks, (relative) portability of projects and executables, as well as having a strong debug mode. An easy-to-use debugger is key for a new programmer to learn what is going, especially once you get to the bootstrapping mode of "download that interesting source and try it out" stage.

Python is greatly portable, and does have an OK IDE/debugger for the price :/, but has enough platform quirks to get it running on Windows that I'd give it a pass for this job. Also, the indenting rules of Python can be very challenging for a novice to maintain if they get messed up.

I don't know enough of PHP to really comment.

Learning C# is a good bridge to Java or C++, so this is probably the most pragmatic choice if her interest develops into a vocation.

For later sessions, you might also consider adding some other items into her coursework, such as using SCM tools for version control (e.g. install TortoiseSVN/AnkhSVN on her system)

Sounds like fun - Best of luck!

holtavolt
Whitespace issues are solvable by using a Python aware editor on Windows (like Scite). We've had lots of luck teaching it that way, and very few students had *that many* whitespace issues, especially with a tutor.
Gregg Lind
A: 

I think the language doesn't matter that much. It comes down on how good you are at teaching.

With a good teacher, C for example can be a good choice for a first programming language. And if you start with C, you won't have much problems getting into higher-level languages.

Last week I even saw a C book for kids ^^.

Helper Method
A: 

(echoing many other comments)

Not Java (or C++, or C#). Java goes to objects right from second one. The machinery of the language itself shouldn't be a hindrance (i.e., it should be invisible) until the user is ready for it. Other win features:

  1. easy to work with text/strings
  2. good interactive REPL
  3. simple data structures
  4. good community

From these, any of Python, Ruby, (Scheme, Bash) would all be fine. JavaScript meets this, save for the REPL, and the nastiness of getting into the DOM right off.

Gregg Lind
I really like your points except for recommending JavaScript. I would far rather tell her to just take "static void Main" on faith for a while rather than trying to explain the DOM.
Dinah
I'm not recommending JS either because of those things.
Gregg Lind
+1  A: 

I would actually choose Visual Basic... specifically Visual Basic .NET using one of the VB Express editions from Microsoft.

Visual Basic Express edition is free from Microsoft. It has the advantage of all of the wonderful tools (IDE, text editor with syntax coloring, intellisense, integrated debugger, a rich set of templates, visual designers for UI elements among other things) that are also available for C#. But, IMHO, Visual Basic code is way easier for a lay person to understand than C# simply because VB reads more like plain English. Plus, since you already know C#, you know enough to help her with VB. The syntactical differences are small enough that an experienced C# developer can immediately understand VB code.

April
Not a bad idea. I hadn't looked at it this way. I (obviously) pidgen-holed my thinking to C# as my only .NET consideration.
Dinah
A: 

C#. Has the best development tools, the best community support, has the best language infrastructure.

stormianrootsolver
A: 

picking from your list, i would recommend python. because it is dead simple like Callahad described it very good earlier. especially for beginners. and you can learn for yourself something new ;) but based on your own experience, c# would be a better choice. it is maybe not so simple to learn like python, but you have your experience which should help a lot for teaching.

Thomas Sittig