

Ask HN: What's a good programming language to start with? - pizza

Well, I'm reading Dive into Python 3, and it's a little filled with jargon (thank goodness for the ease of google). I know a little VB6, but I think it's time to put on my big-boy pants and learn a real, or 'real-er' programming language. Any suggestions?
======
ErrantX
I'd actually suggest giving Python 2.6 a shot. It's not significantly
different BUT in some aspects I think it is a little easier to
learn.Incidentally I find the Activestate Programming Network (ASPN:
<http://aspn.activestate.com/ASPN/Python>) a really useful resource for python
learning - especially the cookbook.

PHP might be good to learn (so long as you avoid the bad habits it invokes) if
you interested in web programming. I know others might scoff a little at that
suggestion: but the online documentation is stellar and you can pick up the
basics in a few weeks.

C is also hellishly useful because it will teach you some core concepts. In
fact I would poke around in C anyway whatever you choose - just for
"background".

~~~
dkersten
I would choose Python and Django over PHP, just because its very VERY easy to
fall into the "bad habits" trap with PHP.

C makes an excellent (and important) SECOND language, but a pretty terrible
first, IMHO.

~~~
jokull
Starting with Django is a bit like learning to snowboard. No pleasure just
pain for the first days. Once you get the hang it's bliss.

~~~
ErrantX
I might bear that in mind andf give it another shot. I much prefer PHP for the
area's Django seems to be useful for simply because it was painful to get
into!

~~~
jokull
It doesn't really feel like you're getting anywhere the first couple of days
because there are so many things to get right and learn about. Hang in there,
check out the Django book and read tutorials that teach you cool stuff
(balance between taking small steps and seeing cool stuff to look forward to).

If you're feeling adventurous check out virtualenv right away (Python not
Django specific)

------
SwellJoe
Python, Ruby, JavaScript and Perl are all fantastic learning languages. They
have good books (Perl probably wins on this count and JavaScript probably
loses), good communities (again Perl is awesome with PerlMonks.org, but all of
them have good communities), lots of interesting features that will bend your
brain in pleasant ways (all are dynamic multi-paradigm languages allowing OO,
functional, and imperative programming techniques), while automatically
handling all of the stupid tedious stuff that C and Java and C++ and Objective
C impose on you, and they are useful real world languages that people use to
build real software every day.

For sheer ubiquity, JavaScript can't be beat. In five years, I suspect we will
all be writing a lot more JavaScript, no matter whether we are frontend web
developers or not. But, for now, the backend is still better written in one of
the other languages I've mentioned (or PHP).

gdp mentioned HTDP and SICP. He's right, though you have to phrase your
question differently...because the language of those books is not a language
most real world programmers would suggest you learn. And yet, if you want to
be a good programmer, there are probably no better resources. The books and
lectures are available for free from various (legal) sources, and provide a
really solid foundation on which to build your programming skills. I strongly
suspect spending 3-6 months on these two resources and learning Scheme would
accelerate your development in any other language enough to repay the upfront
cost within a year or two. Becoming a programmer is a multi-year investment,
so that's a really good deal, even if it looks like the long way around.

------
gdp
It really depends on your objective. If you want to be able to go out and
score yourself a coding job and earn money quickly, any one of PHP, Ruby or
Java would be ideal.

If you want to become a good enough programmer that it becomes pretty much
irrelevant _which_ language you are asked to code in, I would recommend
starting with something like Scheme, perhaps with the aid of either:

<http://en.wikipedia.org/wiki/How_to_Design_Programs> or
[http://en.wikipedia.org/wiki/Structure_and_Interpretation_of...](http://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs)

------
intellectronica
You're probably better off starting with Python 2.6. Python 3 is not seeing
wide use yet, and the Python community is still revolving around Python 2.6,
so that's what you'll be able to get lots of help with. IIRC Dive into Python
is written for people who already have experience in programming, so it might
be a bit hard if you don't, but there quite a few books about learning how to
program with Python.

You can use many languages to learn, but I'm pretty sure Python is indeed the
best choice for a first language.

------
cpr
Why not try Squeak? It's a modern Smalltalk with a complete graphical
interface, and learning it well will thoroughly warp your mind into the 100%
object-oriented approach to computing. (A very useful warp. ;-)

It's freely available and runs on all major operating systems.

<http://www.squeak.org/>

And then if you get Peter Seibel's "Practical Common Lisp" book and learn
Lisp, you'll be completely ruined for any "blub" language like Java or C++.
But you'll be light-years ahead of the crowd...

~~~
cpr
Oh, and I should add that you'll be well-prepared for Ruby or Python, if you
go this route.

------
parse_tree
It definitely wouldn't be for everyone, but learning assembler first is
something to consider (you'd have to enjoy it of course). There's a great,
great free book on this, it'll walk you through code and you'll really get a
grip on how the computer works:

[http://download.savannah.gnu.org/releases-
noredirect/pgubook...](http://download.savannah.gnu.org/releases-
noredirect/pgubook/ProgrammingGroundUp-1-0-booksize.pdf)

I started out trying Scheme, Java, Ruby, etc. and was constantly in a state of
confusion. I could never just go with it because I'd always want to understand
the implementation of the commands before using them. Ruby was particularly
bad - I had no clue how a language or computer worked and was constantly
overwhelmed with all of the different options for doing something.

Programming in assembler you get a small set of commands that won't take long
to memorize, and you'll have to build up from there. It's not as hard core as
people make it out to be - when I was really into it, I could produce output
in at a similar rate to C. Once you get a little assembler under your belt,
you could begin mixing it with C, and you'll get a rock solid grip on C
strings, callback functions, pointers, etc. that so many people have trouble
with.

EDIT to add:

Also, using GDB (the Gnu DeBugger) with Emacs text editor is excellent for
learning assembler - must use it!

------
jacquesm
I suggest you get an 8 bitter, or an atmel or a pic chip and learn how to
program on that, as close to the hardware as possible. So, yes, that means
assembly.

This will give you invaluable insight in how a computer works on the inside,
then work your way 'up' from there.

That's much easier than to have this feeling that there is this 'magic carpet'
that is holding you up in the air but you have no idea how it works.

Almost every high level language will make a _lot_ more sense if you come from
the basement up.

~~~
plinkplonk
" but I suggest you get an 8 bitter, or an atmel or a pic chip and learn how
to program on that, as close to the hardware as possible. So, yes, that means
assembly."

This is a great idea!

If for some reason you don't want to work with actual hardware, I reccomend
this book(<http://www1.idc.ac.il/tecs/>) . Dr Schocken uses Java to build a
variety of emulators all the way from flip flops to a small computer you can
write Tetris for, using a compiler you build.

A google tech talk based on the book is here
<http://video.google.com/videoplay?docid=7654043762021156507>

"Almost every high level language will make a lot more sense if you come from
the basement up."

Exactly right.

------
cullenking
There are a couple considerations. First, you want a language that is not too
intimidating or difficult to start with, or you may fall off the bandwagon.
Many programmers broke their ground on languages which allowed them to quickly
get something tangible (a reward), like BASIC. Some people don't need this,
and can jump straight into a language like C and love it, however only you
will know if this suits your personality.

The other consideration is to pick a language that has some sort of structure
and encourages a good understanding of underlying concepts. Working with C for
example, really forces you to know and understand how a computer works.
Something like Ruby (my favourite) allows you to easily ignore these inner
workings. This has a speed and ease of development advantage, but could be
detrimental to your core understanding of CS.

I personally love programming with Ruby, however from personal experience I
can say the large amount of different programming styles which Ruby can
encompass can cause you to write some really odd and sloppy code while you are
learning. Additionally, there are an infinite amount of crappy examples of
Ruby code, and relatively small amounts of good code. My recommendation if you
go the route of Ruby is to ignore many of the articles/blog posts on beginning
Ruby (they are drumming up ad traffic), and dig around in the source code.

Additionally, you can writ Ruby in a multitude of styles. Flexibility is
always good, however, it can lead to some real serious slop. My first year or
two of writing programs that were more than simple scripts were with Ruby, and
they are some awkward and sloppy programs. However, the pleasure of producing
those programs was probably greater than if I had tried to struggle through
with something like C.

I am lately leaning towards suggesting javascript or actionscript for a first
learners language. First off, both have an awesome ability to quickly get you
something tangible. They have a really good layout system (mxml or html/css),
and you can easily share your creations with others. Both can can be written
in a C style, or can be very object oriented. Neither require crazy
development environments.

------
dejv
It depends on what you want to accomplish, if you want build some real stuff
like web apps then I will take Ruby or Python for start.

If you want to take this route for taste of programming I will take a Haskell,
it is much more easier to start with it if you do not have much experience
with imperative paradigm.

------
jamongkad
If I were to start over again I would have started with Scheme as a good first
programming language.

~~~
nopassrecover
Really? Or is this just because you have learned all the necessary concepts to
understand Scheme and why it is an attractive language.

~~~
apgwoz
There are many reasons to learn Scheme first:

1\. Virtually no syntax, which is often problematic to first time programmers
of C-style languages: "You mean I have to have this curly brace here, and this
semicolon there?"

2\. Only one choice for looping, recursion. Recursion is a fundamental concept
in computer science and programming, yet many people do not grasp it. Scheme
learning materials will teach you how to write recursive programs the right
way. Plus, recursion is a very elegant, and easy to understand way to express
many algorithms such as those used in sorting, a common exercise when learning
programming.

3\. Higher order functions - This makes it easy to teach abstraction. Build
small components that do general things (i.e. fold, map, filter). This sort of
thing applies to OOP down the road, as well as to every other paradigm. Break
things into small units that do one or two things and that's it.

4\. Unbounded numeric tower, which means you don't have to focus on things
like, "ints can only express up to 2^32 if they are unsigned," which in many
courses has to be taught (prematurely, I'd say) to explain why I can't compile
or run a program that multiplies the largest numbers I can type. Something the
curious will surely try first.

~~~
nopassrecover
Yeah they are all good, but the syntax while more concise is actually more
difficult to map to a non programming mindset.

Objects in their very naive form area pretty straightforward concept to get
(Oh a Car is a type of Vehicle).

Iteration is more natural than recursion (I prefer recursion, it's elegant,
but it's not how people think to start with).

And most users won't run into the boundaries of variables when beginning
learning either.

The one thing I will give credit is that the syntax is less voodoo, but I
still think the ideas of assignment and a mental model of state combined with
the imperative "Do this" approach is easier for non-programmers to understand.

------
blackmac
I would suggest to learn C. It might sound a little bit strange, but when you
consider it, it's probably one of the best things you could do. Most of the
modern languages you will need are somewhat based on C. That is especially
true for compiled languages, but most script languages take their fair share
of C too.

You will learn about pointers, which is important in ANY language, binary
trees and stacks are good to know about too.

~~~
dkersten
I disagree.

While I think C is a valuable language to learn and I agree with your reasons
for learning it, I do not think it should be someones FIRST language. It would
make a great second, though. Why? Because C (and C++) has a lot of confusing
cruft that a beginner just doesn't need to know about. The noise in the
language is too high and too much work is involved in achieving relatively
simple things. A higher level language also has quicker returns, which
definitely helps keep someone whos just starting out motivated. Most high
level languages have better tools to learn with too, like an interactive read-
eval-print-loop.

I would recommend Python. Not Python 3, but Python 2.6 - better library
support. I recommend Python because it takes very little to get working and it
comes with everything a beginner would need bundled. When you're learning, you
don;t need direct hardware access, you don't need direct OS interfacing, you
don't need high performance (and probably wouldn't get it anyway until you
learn how to write good, fast C). You DO need to get things done quickly (its
hard to learn, otherwise) and you DO need an environment that doesn't require
much background knowledge to work in. In Python, a simple program is simple.
Theres no need to learn about "main" (and therefore functions), about
includes, printf format specifiers and so on - just to write a hello world. As
your skill increases, you can gradually add more language features:
conditional statements, loops, I/O, functions, data structures, classes,
functional programming tools, libraries, metaprogramming. You dont have to
deal with manual memory management and you'll get more meaningful error
messages than "segfault".

You learn a lot about PRGOGRAMMING (rather than having to deal with the low
level complexities of C) which can then be applied to almost any language. If
you outgrow Python (and I don't think you ever would, I know people who write
some amazing stuff in Python, including HIGH PERFORMANCE CODE) you can learn
C. I'd recommend it as a second language. Everything you've learned from
Python will be applicable in C too. At this stage you should be well versed
and pointers should come a lot more easily. You can also use Python and C
together - its not even that hard.

You could easily replace Python with Ruby in the above, if you prefer. Python
and Ruby are pretty much equal players.

If you don't mind going a less mainstream, I'd suggest learning Factor: a
fast, powerful, very dynamic, native compiled concatenative language. It has
pretty much all of lisps powerful features, with some ideas taken from Forth,
Smalltalk and others, has an active community and very clean codebase. (The
library code is some of the highest quality code ive seen) being stack based,
it may take some effort to get into the mindset though.

~~~
timwiseman
All excellent points. But remember the original questioner already knew some
python and some VB. C is probably an excellent choice for him, though
personally I use Python for the vast majority of my code. Of course, my work
has morphed to be more system and database administration than programming
lately so I may be biased by that.

------
Goladus
My suggestion is to find some problems that you need to solve before picking
the language to use. If you already know so Visual Basic, the languages I'd
consider learning first, depending on my situation, would be:

    
    
        Javascript
        C
        Python
        Scheme
    

Or maybe:

    
    
        Erlang
        Haskell
        OCaml
        Mythryl
    

I have very little familiarity with the second set, I only recommend them
because they have features that are much different from the first set, and if
you are interested in a more functional approach it might be helpful to
approach it less intellectual baggage from the imperative languages.

Also, I only recommend learning C first if you plan to do a serious, thorough
study of the language and need it for a low-level project. Get _C, A Reference
Manual_ by Harbison and Steele, read the whole thing, and tackle a significant
project with that knowledge. You can make progress with a half-assed approach
to learning Python. If you try that with C it will be very painful.

------
joeld42
If your goal is to get things done in the real world, Python is a great first
choice. Learn C/C++ next.

Don't listen to these scheme/functional wackos. It's great -- and once you've
been programming for a few years you should definitely learn it, it will
improve your programming and allow you to think more elegantly about problems.
But starting with scheme is like tying sandbags to your ankles and then
training for the hurdles -- in theory you'll be able to jump like superman
when you take the sandbags off in a few years, but realistically it's just
going to make a challenging task even harder.

Just my 2c, of course. I started with BASIC, then 6502ASM, them Pascal, then
C/C++, then a bit of APL and lisp variants, then Python (which was like a
dream), then some more scheme, and now I pretty much stick to Python/C++, with
a bit of Javascript on the side.

------
nopassrecover
You should go with C#. It uses the classical imperative syntax which lets you
learn a whole lot of other languages and is similar abstractly to VB6. It's
also got a lot of nicer features that will help you patch towards higher level
languages eventually, but it sounds like that is a little too soon for you.

------
joechung
Python is a real programming language. Keep at it!

If you want to learn an advanced programming language, try Haskell, ML (F#),
or Lisp (Scheme).

C is a good programming language to learn. It can be quite unpleasant to debug
C programs though.

~~~
troels
> It can be quite unpleasant to debug C programs though.

Yes, but if you can do that, you can debug anything. Literally - Most high
level languages are implemented in C, so debugging them eventually means
debugging C code.

------
bbsabelli
Start with Visual Studio (VS) and program in either vb.net, or preferably
c#.net. VS helps a lot while you're learning, and you can choose to program
for either windows or the web. Add the MVC framework and you get a fairly
decent web development environment where you can then look into JQuery and
maybe even SQL.

Once you're happy there, a move to Python, PHP, Ruby or Java will be
relatively easy.

You don't need to know a language like C unless you plan to work with the
elders.

------
ogdoad
Indeed Scheme (and SICP) would be a good choice; at least I wish I knew that
back when I started out with C -- can be done, but don't do it. Besides
Scheme, Clojure (which is also a LISP) provides the added benefit of having
full interoperability with the JVM; I'm currently giving it a try, and it does
seem worth the time and effort, quite the humane choice I'd say for a first
language. VB6 of course does not count.

------
nudded
If you want to wrap your head around OOP and Java, Bluej (bluej.org) is really
usefull. It's used in my university (in the first half of the year, then we
moved on to netbeans fcourse) to teach us the begins of OOP.

------
pclark
Ruby

~~~
csbartus
Definitely ... it is the latest worth-noting language hitting mainstream
today.

The most simplistic, user-friendly and well suited for all your tasks.

~~~
Jim_Neath
Agreed.

------
wlievens
Scheme, the SICP way.

