Ask HN: What should I learn as my first programming language? - FalconNine
======
dutchrapley
If you have absolutely no experience programming, start with Python. There are
three things to learn when programming: 1) language syntax, 2) concepts
(conditionals, logic gates, loops, etc.), and 3) how to solve problems.

What makes python a good choice is that you don't have to spend too much
overhead learning language syntax in order to implement concepts, and you'll
easily be able to keep the learning of those two items separate.

Once you have a strong foundation in concepts, you can much more easily pick
up a different language. The biggest downfall there is that if you decide to
later learn Ruby or JavaScript, you might approach a solution as, "This is how
I would do it in Python." Don't fall into that trap. Learn the features each
language provides and how to use them.

Since you mentioned games, there's a couple of books on the topic that are
free: [http://inventwithpython.com/](http://inventwithpython.com/)

------
enkiv2
I always recommend Lua as a first language. It's about as straightforward to
learn as Python, but it's smaller and simpler, with fewer "gotchas". Once
you've learned Lua, moving to Python is about as easy as moving to Javascript.

I don't recommend Python or Javascript because while having a rich set of
third party modules is great for actual development, it's a detriment and
distraction for beginners. When you're learning the nuts and bolts of
programming, it's easy to be misled by how easy some common task is to perform
via API call and think you understand it when you haven't really been exposed
to it. This becomes a big problem when moving to some other language, where
library functions work in a different but equally straightforward way. When it
comes to things outside the core standard library, you should really learn to
implement them yourself before becoming accustomed to using third party
libraries.

Python is a great _second_ language, but the way you write things for a
beginner programmer is very different from the way you write things when
you're trying to be clever and squeeze a lot of behavior out of a few
characters or a few cycles, and python has too much of a mixture: searching
for information on how to solve a problem in python will get you equal numbers
of people who don't know how a for loop works and people who prefer to do
everything by passing lambdas around.

~~~
striking
I disagree with some of these points. Specifically, programmers should
necessarily be left unable to understand _everything_ they use. Packaging
systems are excellent for providing you with functionality without the mental
cost of having to understand how that functionality works. They're not a
distraction, they're how people get things done.

And Lua is not a great first language. If you know how to use it, it's a great
language; but its 1-indexing, tiny standard library, inability to distinguish
between hashmaps and arrays, confusing "metatables", and lack of external
libraries really make it tough for me to recommend as a first lang.

This comes from someone who used LuaJIT often with Love2D to prototype games.

~~~
enkiv2
Anything that's trivial to write (think "left pad" and 90% of what's in NPM &
PIP) shouldn't be used by people who can't conceive of how those things might
be written, if their goal is to learn to write things. I'm not suggesting that
beginners should start with writing bootloaders in machine code or anything;
I'm suggesting that beginners should master things like loops and functions
and variables before they start plugging together big chunks of other people's
code, lest they overestimate their abilities and take a major blow to their
self-esteem when they realize that they are completely incapable of doing
simple things in another environment because they never really learned how to
do things. Some of the biggest and most important hurdles to clear when
learning to code are related to learning to master things you've never
considered; convenient API calls are convenient to avoid considering. In this
way, a tiny standard library is useful: all of the things in Lua's standard
library are things that a beginner can afford to put off learning for a little
while.

Lua has a handful of strange attributes that distinguish it from most
programming languages -- 1-indexing, lack of a distinction between integer and
fractional numeric types, lack of a distinction between integer-keyed and non-
integer-keyed arrays (and lack of distinction between arrays and objects), and
the use of tilde rather than exclamation point in comparison. The number of
idiosyncracies is comparable to those in python and javascript. I don't think
that distinguishing between arrays and objects is useful for a beginner, nor
do I think that the fact that in most languages integer-keyed arrays are
special for optimization reasons is terribly important for a beginner. And,
metatables are an advanced feature -- they are similar to mechanisms in python
and C++ and aren't all that weird, but they won't even come up until long
after our hypothetical student is ready for their second and third language.

A first language is for learning. Whether or not it's useful for real work is
totally irrelevant; someone who doesn't know ten languages inside-out isn't
qualified for real work in any of them. Lua is a good candidate because
although it can be used for real work, it's not optimized for that. Instead,
it's a simple language that combines ideas that have historically been
separated for reasons related to ease-of-implementation and separates ideas
that have historically been combined to make ugly hacks possible. In other
words, it's a fairly internally coherent and conceptually pure language that
is easy to pick up because it lacks "gotchas" (except to people who come from
other languages, and are offended by Lua's improvements).

~~~
striking
90% of what's in npm or pip is not trivial to write. Calling database adapters
or HTTP libraries "distractions" is silly. And in the same sense, restricting
yourself to a subset of a language that makes it easily ported and contained
within any application seems... silly.

Furthermore, plugging together pieces of other people's code can very much
help in learning how to express concepts in the language. You can look at
existing examples of how it's done, and do it yourself. You make small
changes, then big changes, then write your own. Easy peasy.

Lua is a weird language for many reasons. Not that being weird is a bad thing,
but that makes it difficult for people to learn other languages. If you learn
a C-style language, you'll be more able to read other C-style languages.

And no, metatables are integral to Lua. You can't use prototypical inheritance
without them, and they're really difficult to wrap your mind around.
Furthermore, prototypical inheritance is very useful. If you've actually
learned Lua, you've got to learn about that aspect of metatables.

I love Lua for real work. Honestly, actually do. But I don't love Lua for
learning.

~~~
enkiv2
You need metatables for rolling your own OO system. But, object orientation
(particularly when, as in Lua, you need to roll your own) should not be part
of a beginner curriculum. Like I said, by the time you need to worry about
metatables, you should have already moved on to your second and third
languages -- you can learn about OO in the context of Python or JavaScript and
then later apply that to Lua.

------
striking
Don't learn a programming language. Learn how to accomplish projects.

Pick a project, whether it's a blog or an automated tea brewer or 3D model
viewer or something... and then pick a language that suits your needs.

So many beginners fall into this trap of learning just for the sake of
learning; I've found that people with projects and with clear goals make the
most progress.

If you want to learn a programming language, read any of the other comments.
(I agree with Python being first on the list.) But if you want to learn to
program, don't fit yourself into a category just yet. Be pragmatic and use
whatever's best for the job.

~~~
Tomminn
This is really great advice that jibes with my own experience. A small thing I
would add is that when you do this, the following main goals are possible:

1) To finish the project.

2) To learn a language.

3) To finish the project, but also learn a language.

4) To learn a language, but also finish the project.

My $0.02 is that: 1) tends to lead to short term hacks; 2) and 4) tend to lead
to dwindling motivation; 3) is ideal. And if it's your first language, do the
project while you read a good generic programming book like 'code complete'.

------
Sir_Cmpwn
C, on a Unix system like Linux or BSD. It'll make you learn how your computer
works, which is an essential skill to have and will help you understand
everything else you learn.

~~~
aq3cn
That's how it is done in universities. That's how I started. My professor even
did not allow compilers which can specify errors. We were supposed to find out
errors on our own. And you know, I had to learn vim first to be able to write
anything. He just wanted to make it impossible to have any aid. The
recommended book was by Ritchie and Kernighan.

[http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-
Eb...](http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf)

I enjoy those days and happy that I scored A in his class. It has given me
confidence for sure.

------
r2dnb
I learned C when I was 11, an uncle gave me a book as dense as a dictionary
covering all the aspects of the language, as well as algorithms. He called it
"The Bible".

For 1 year I woke up at 5:00am every saturday and sunday, to use the only
computer we had at home before other people were up so I could do every single
exercise of the book (there was about 20 per chapter, 10 first trivial, and
the rest were small projects of increasing difficulty).

I consider that this experience is what made me the best programming student
even at college, and an excellent developer when in the workplace. The lessons
I learned from C are still priceless even though I mainly develop in managed
and OOP languages today.

This will teach you basics that will never fade, there're certain Google
searches you will never make again.

The important thing when you start is to know how a computer works, and how
lines of code are interpreted and executed by the computer, as well as how to
express and solve real world problems with computer instructions. You don't
need to know every detail, but the less magic it feels, the better.

~~~
r2dnb
Forgot the most important part :

>The important thing when you start is to know how a computer works, and how
lines of code are interpreted and executed by the computer, as well as how to
express and solve real world problems with computer instructions.

And C is both low-level enough and high-level enough to allow you to do all of
this at the same time. _

------
Lordarminius
Someone show Ruby some love:)

Learn Ruby.

Its a beautiful language well worth the effort and it has a _HUGE_ ecosystem
behind it. You'll never lack for resources. It is powerful and I found it
doable to learn it all on my own.

It will aid in the transition to making dynamic websites because it is used in
Rails.

In the early part of my learning I found that the break in compatibility
between python 2 and 3 was irritating and confusing to me. Some of the good
books were on python 2 and I had been informed the world was moving on to 3.
Ruby has major versions (1.9 vs 2) but no break.(I started out by trying to
learn python but switched midway to ruby)

The only caveat is if you want to do math heavy stuff or machine learning -
python excels at that.

Python is frequently recommended by people with a CS / computational
background. I did not have that.

Some people do not approve and I understand. But this was my experience. YMMV.

~~~
FalconNine
Hmm. I kind of want to go for Ruby...but how would it do if I wanted to make
simple games? Nothing too fancy but simple pixel games or clicker types.

~~~
Lordarminius
> ....but how would it do if I wanted to make simple games?

Yes ruby can be used for games. [https://www.sitepoint.com/is-ruby-good-for-
game-development/](https://www.sitepoint.com/is-ruby-good-for-game-
development/)

------
cocktailpeanuts
Imagine you're an alien who just arrived to Earth. You are trying to decide
what language to learn.

One hipster tells you "You need to learn Esperanto! That's totally cross
platform and the most ideal language ever!"

Another hipster tells you "Learn latin! That's the most legit language ever.
All other western languages are based on it!"

But all you want to do is live in the US and make some friends. Will you go
learn Esperanto or Latin, instead of learning English? Don't listen to these
hipsters.

I agree with another guy on this thread saying don't learn a language for the
sake of learning it. Because you will probably become a mediocre dabbler that
way. Only learn if you want to accomplish something because only by using it
in a practical context you become proficient at it. Otherwise you can maybe
tell your friends "Hey I know Esperanto!" but does that really matter? There
are thousands of other more valuable things you can do with your time than
learning Esperanto, especially if you're looking for the "first language to
learn"

~~~
Ericson2314
Java has no Shakespeare.

------
Spoom
Python is a good choice. I would argue that C, followed by C++, might have
more applicability later on; a lot of languages are modeled on one of those
two. They also are lower level and so give you a more in-depth understanding
of how memory allocation works.

------
fitzwatermellow
There are a lot of great "visual" programming tools you can play with, often
right in your browser. Typically designed for kids (Aged 6 to 106)!

MIT Scratch: Create shareable stories, games and animations

[https://scratch.mit.edu/](https://scratch.mit.edu/)

Minecraft: Hour of Code

[https://code.org/mc](https://code.org/mc)

Processing: flexible software sketchbook for learning how to code within the
context of the visual arts

[https://processing.org/](https://processing.org/)

Google Blocky: the library for building visual programming editors

[https://developers.google.com/blockly/](https://developers.google.com/blockly/)

~~~
n00b101
+1 for Processing

------
newscracker
Mods, please add the "Ask HN" prefix to this one. I thought this was an
article on some other site.

------
hgeorgako
Julia. [http://julialang.org](http://julialang.org)

It's got everything you need to succeed in the future.

------
tinalumfoil
Javascript.

It's simple enough, completely ubiquitous and has an incredible amount of
online resources. To start, just open developer tools in your favorite browser
and type console.log("Hello, World!");. Congratulations! You've just written
your first computer "program". Now go try one of the thousands of great
javascript tutorials for absolute beginners.

Once you learn the basics you're now able to code anything from a basic
website to an embedded machine. Your code will work on any operating system
and can be distributed on a platform (the web) that makes it trivial to show
off your work to your friends.

But even if you don't choose Javascript, please avoid some people's
suggestions of learning systems languages like C, C++, Rust or a paradigm-
specific language like Java, C#, Haskell. Yes, these are all fine languages in
their own right, but you'll spend a month writing boilerplate you don't
understand, which is both confusing and unhelpful. If you have any friends
that can program and are willing to help you, following what they know may
also be a good idea.

------
AlexeyBrin
* Want to make webpages ? Learn JavaScript, HTML and CSS.

* Android apps ? Learn Java.

* iOS apps ? Learn Swift.

* No idea what you want to do, but strong desire to learn to code ? Learn Python. You could use Python for general purpose programming, small games and so on ...

~~~
FalconNine
How much easier will new languages be after I've learned Python, assuming
that's what I go with?

~~~
AlexeyBrin
Once you learn a programming language, the second one is usually much easier
to learn.

------
nnq
1\. Learn an "easy" general purpose scripting language ( _JavaScript_ because
you can just type F12 in your browser _now_ and start writing code, or
_Python_ if you want something just as simple but more "logical" and "sane",
Lua ok too) until you feel you "grok" the basics: once you can write a simple
text-based questions and answers game that uses a loop, and you know how to
write a simple function that returns another function (called "higher order
function" but do not be scared), it means you "grok the basics.

2\. Pic the _platform /domain_ of your first project and use the easiest
language that is still a first class citizen of that platform. Easy guide:

    
    
        - iOS -> Swift (don't pick Objective-C if you haven't touched C or C++ before)
        - Android -> Java (don't pick JavaScript first, unleast you have serious *web development* experience, the zillions of all-slightly-wrong options and choosing a framework madness will make your brain explode even if the language is simpler!)
        - web browser -> JavaScript
        - web server -> anything *except* Nodejs (JavaScript) or PHP, you don't want to start by diving head first in callback hell and a zillion ways to do everything and you also don't want to learn all horrible worst practices accepted in PHP-land that you'll have to unlearn later: *Python* or *Ruby* or *Go* are ok here but avoid large frameworks (choose something like Flask for Python or like Sinatra for Ruby first)
        - linux -> C
        - desktop/console game using Unreal engine -> C++ & UnrealScript
        - dektop/console/mobile game using Unity engine -> JavaScript and C# are both ok here
        - windows desktop -> C# or JavaScript depending on your purpose
        - macos desktop -> start with Swift, got to Objective-C if you can't get to your goal using Swift
        - hardware hacking -> "Arduino C" as suggested by someone else or Python if the platform you're hacking supports it
        - machine learning / AI -> Python

------
reacweb
I like very much [http://www.codeskulptor.org/](http://www.codeskulptor.org/)
because of the small entry barrier: easy syntax, small ecosystem, no
installation, good documentation, possibility to write small games.

If you are young, you can also motivate friends, emulation, ...

And for you second language you will probably know better why you want to
leave codeskulptor: \- full python to have bigger ecosystem \- java if you
want an IDE (eclipse or netbean) \- javascript, html, css if you want to build
a "startup" \- haskell or scala if language is your interest \- C, unix if
system interests you \- C++ if you are masochist \- Excell VBA \- ...

------
Ericson2314
[https://www.pyret.org](https://www.pyret.org) then Haskell.

The other advice might allow you to check off marketable skills faster, but
these will make you a better programmer.

------
thesnowdog
How to Design Programs:
[http://www.ccs.neu.edu/home/matthias/HtDP2e/](http://www.ccs.neu.edu/home/matthias/HtDP2e/)

~~~
webwanderings
This looks interesting. Which programming language is this geared towards?
(PS: am not a programmer).

Edit: never mind, just read the preface.

------
arnold_palmur
I would say Python - it's a great general purpose language of which many
interesting things can be built.

------
hedora
The language doesn't really matter much at the end of the day. I think I
started with "high level" COSMAC VIP assembly (and I'm not _that_ old... I
needed something that would drive 5V electronics.)

First pick a project. Most people pick video games, or light electronics
(simple robot, nest replacement, etc). Then, pick something with a strong
community and lots of documentation geared at newbies. I strongly recommend a
Raspberry Pi (but buy the ~$60 official kit with power supply and SD card --
they have crazy compatibility issues with SD cards and USB chargers). The Pi
comes preloaded with beginner-oriented things like PyGame, a computer music
language, and software to drive cheap breadboards for electronics projects.
There are tons of tutorials online.

Alternatively, maybe download Unity, and watch the YouTube 2D game tutorials
(the open source suggesions in other replies are also fine, and most of the
language suggestions make sense for some project or another).

By all means, if you have an experienced programmer that is willing to help
you, tell him/her about your project idea, and ask for help picking a language
and setting up a development environment. A suboptimal language choice will be
more than made up for by in-person tech support.

------
Zalos
Like many others I don´t consider HTML and CSS programming. To some PHP isen´t
even a programming language it´s a scripting language. But I ended up
programming/scripting PHP. I like it, I feel at home in it, and it does what I
want to accomplish. Make stuff for the web. 14 years ago I started learning
HTML, I wanted to make websites, after that I had delusions thanks to movies
like Operation Takedown, Hackers and Antitrust about being a hacker. I learned
the basic concepts in C++, C# and Java, but I diden´t know what I wanted to
do, so I froze, and stopped learning in those languages. There is a term PHP
is forgiving and it is, some of what is natural to PHP might bite you in the
ass if you go on to C# for instance or Java. But you´ve still got a bunch of
programming concepts down that you can reuse. If you can find a drive,
something you want to accomplish in the language, be it a web or desktop
project. Then you will learn. I hope you find this useful. Whatever you decide
to do good luck on your journey to becoming a programmer.

------
oolongCat
Honestly, Follow any of the mainstream languages you will be alright.

When I began programming I had this exact question myself, and deep down the
actual question was "what language is the easiest to learn and is there a
language that will not make me quit because its too frustrating?".

I think becoming a programmer means you have to be able to handle a lot of
disappointment, and you should be able to deal with the fact that you have to
constantly learn (you asking this question on HN means you are going on the
right path, it means have that explorer inside you). You will have to deal
with frustrations and to do something over and over again until you have
perfected it. (this is why I think a lot of us see programming as an art)

So learn any programming language, build the smallest thing you can imagine,
start with a hello world, make a calculator, make a text based game, etc etc
and keep going until you are fed up of programming and want to take up farming
instead.

And one more thing, please don't think memorizing syntax is going to make you
a great programmer, great programmers program, they make things and they make
more things. Make things and never stop.

All the best.

~~~
optionalparens
I agree with this completely. I started with assembler, moved on to C, Lisp,
Fortran, BASIC, Pascal, and C++, and then many more from there. It never
mattered. Sure, I sometimes used the wrong tool for the job and made life
harder, but those experiences shaped me.

You can make mistakes and you will learn from mistakes. You can build a house
out of cardboard and it might not be a good house, but if it provides you
shelter and you call it a house, it is a house. Don't get caught up in the
cult of programming language. The good thing about this cult is when you meet
people who say, "I am an <insert language> guy," you can turn on your
skepticism detector to an extreme level or pretty much ignore them by default
because they are either stupid, inexperienced, naive, or living in some bubble
that probably won't be the same for you. The tools analogy really does work
rather well - you can pound in a nail with a set of plyers, but hey, why would
you and why wouldn't you invest in buying more tools when you can afford it?

Getting things done, failing, learning, and problem solving are what you want
to be doing among many other things that have little to do with language
choice. Don't be too ambitious, just stick with it and get things done.

While I wish more people were better at programming, the truth is you don't
even have to be good to succeed on some level. I wish it weren't true, but if
you saw the source to most games, you'd cry. When you go up against time,
budgets, other people, technical limitations, and more, the end product
suffers, but to most people, as long as it succeeds doing whatever they deem
valuable, then you won.

Parent really gives good advice to start small. You want your gratification
loop to be as constant as you can make it. Trying to build Minecraft, Skyrim,
Call of Duty, whatever as your first game might be an option for a few people,
but for most it isn't. Don't try to do it, just get things done. If after
awhile you see that maybe you can't seem to learn other languages, which does
happen with a lot of people, I'd say that maybe it's time to look elsewhere
for a career.

------
fcbrooklyn
I think it depends on you, to some extent, so without knowing you it's harder
to say. The big question is "why?".

1) Are you learning to program because you have something specific you're
dying to build? Depending on what it is you dream of building, there may be a
language that's more appropriate than others. If you want to build a mobile
app, you pretty much have to learn either swift (iOS) or Java (android). If
you want to build a web app you could reasonably choose Ruby, Python,
Javascript, Elixir, or probably a dozen others I'm forgetting. If you have a
lot of data you want to analyze, you might want to learn R. If you want to
write games, then Lua is a great choice. etc.

2) But maybe you don't have a project in mind, you're just interested in how
it all works. In that case, you should know that it works a lot of different
ways, and different languages will teach you different things. Learning C will
give you a great understanding of how computers actually work at a low level.
Learning Ruby will teach you a lot about object oriented programming, which is
currently the most popular paradigm. Learning Haskell, Elm, Elixir, or Erlang
will teach you about functional programming, which is quite a different
paradigm but one that's getting a lot more popular lately. If this is what's
driving you then I'd say you should learn 2-3 languages that are sufficiently
different: something low level, something high level and object oriented,
something functional.

3) But maybe you want to learn to program because you hope to get a well
paying job asap. I'm not sure that's such a great idea, but if that's the
plan, then I suggest something where there are a lot of jobs right now.
Javascript, Ruby, or Swift, most likely. Learn one of them sufficiently to be
useful, and get yourself in a position where you're getting paid to do this.
Then, if you want to have a happier life, follow the advice in section 2.

~~~
angryasian
4) If you're looking for a career as a programmer, I'd search jobs in your
area to see what most companies are hiring for and focus on learning that
language.

------
meira
HTML, CSS and JavaScript was what I first learnt almost 20 years ago and I
still think it is a great path to beginners

~~~
jomamaxx
I don't mean to sound negative - but the HTML stack is the worst thing on
earth to start leaning to program in.

HTML, CSS are not 'programming', and both they and javascript are a
convoluted, dysfunctional mess.

Yes - they are easy - but they are all super quirky and those quirks form bad
habits.

Python is a great place to learn basic algorithms and syntax. Java is a great
way to learn types and basic OO. C is a good place to learn how to deal with
lower-level things, but it can be challenging for beginners.

Javascript _should_ be a great place for beginners - but it's full of so many
oddities, that I think starters will be misled. Every JS environment is
different, and it's hard to tell what works where. It's also managed by
consensus and varies a lot.

~~~
meira
Yep, I don't disagree with you. I gave a practical approach, which worked
pretty well for me, I think. I also think that the native web stack (HTML, CSS
and javascript) will keep growing until it becomes ubiquitous. But as it is a
personal bet, I don't always use it as an argument.

~~~
jomamaxx
'web stack' is a natural entry point for newcomers because 'they can do
stuff', i.e. make web-pages that do things they can touch and feel. So it
makes sense on some levels ...

But for programming proper ... no way. I wish that were not the case.

------
mshenfield
You'll learn the most if you have projects you want to do, and different
platforms are closely tied to particular programming languages. Choose the
platform you are most interested in, and try to be conscious of what you are
missing - whatever language you choose.

Cross Platform Games - Mono/C# w/ Unity

Web Apps - JavaScript (HTML/CSS too)

iOS Apps - Swift

Android Apps - Java

Scientific computing/data analysis - Python or R

Robotics - C++, though Python and Node (server side JavaScript) frameworks
exist w/ lower barriers to entry

Once you learn one and have built a few things with it, try to learn another
that takes a different approach. For example learn a compiled language after
Python, or an interpreted language after C++. Try out a functional language
like Haskell/Clojure/Elixir. You'll start to see how the language you chose
helps and constrains your programming, and where it falls short or offers new
hurdles.

------
zild3d
As you can see there are many answers provided, and the reasons all seem to
conflict with each other. I hope you are able to disregard any advice that
blindly suggests starting with language X, without knowing anything about your
background or interests. Currently the 1st and 2nd highest voted answer are C
and Lua, which provide completely opposite reasons for each.

There is no unanimous cry of a single language "JAVA! Definitely start with
Java!" because there is no right answer. There are more similarities between
every programming language than we tend to admit, and the right answer is the
one that will keep your interest and solve your needs.

Do a little research on what programming language is often used to work on
topics your interested in, but don't sweat it too much. Pick one and start
making mistakes

------
interdrift
C# of course, easy and nice!

------
hawski
My wife started some time ago to slowly learn python as her first programming
language. REPL is very handy. But I am not sure that it was a good choice. She
will not see results visually. Maybe better choice would be JS with HTML and
CSS?

I'm mainly C and C++ developer and I worry about dynamic nature of python. I
am not sure that seeing failure in run-time is all that helpful. But that's
just static vs dynamic typing dispute.

What I really have to do is to sit with her and talk. What would she like to
achieve? Is she bottom-up or top-down learner?

I was also thinking about awk. It is small and nice language with immediate
results. Learning it requires learning regular expressions and I wonder is it
a right time.

------
yoz-y
Depends on what you want to do and what you got.

If you have a Mac or an iPad I would recommend learning Swift. Playgrounds are
a very neat way to start hacking and seeing results immediately and you will
end up learning a language that is very modern and has a good future.

If you want to learn not only programming but also how computers work (and are
really motivated) then C is a good starter as well. It requires more
commitment but you will also learn how computer memory works.

Finally if you want a simple language I can recommend Scheme. This was the
first language we learned at engineering school and although I have had quite
some experience with programming before going there I found it very
refreshing.

------
tempodox
If you want a language somewhat close to math, take OCaml. If you have an even
more mathematical mind, take Haskell. If not so much, choose a language that
has static typing, so you learn what a type is right from the start. This will
save you many headaches later on, especially in languages with dynamic typing.
If you're going with C, because you want to know how software works from the
ground up, fasten your seat belt and wear a helmet. And don't panic, the worst
that can happen is your screen exploding (aside from your head every once in a
while).

------
macintux
I've long thought that learning an imperative language first hindered my
comfort level with FP. I felt like learning a functional language first would
prepare me better for learning anything else.

So, maybe Elm or Racket?

------
eof
It really depends on your ambitions. I like the idea of lua as a simple/pure
langauge; the problem is mainly the support and reception of it doesn't lend
itself to growth so much; since lua is mostly used, in practice, as part of
systems more complex than itself.

I am grunching this thread, but I think the obvious choices are python or
javascript; unless you know exactly what it is you want to build, and it is an
'App'; in which case you might as well start just learning the native language
necessary to build on your desired platform.

------
norea-armozel
What do you want to do? If you want to do stuff with the web then learning JS
is obviously a necessity. Anything else is pretty much open to your choice.
Like everyone else has said focus on the goal of what you want to do first
since major languages are supported for a wide variety of use cases ranging
from PCs to embedded electronics to even robotics. Once you tackle the most
basic thing you want to do the rest comes easy or easier (depends on how
complex the thing you want to do).

------
hitgeek
your comments say you want to learn to make small games as a hobby. Look for
resources that teach you how to make small games and don't worry about
learning a programming language.

You will learn programming as you go, and gradually find a language or
framework you like.

If you want want to make games, but you pick up Python 101, you may get bored
and move on, because its not what you are interested in. I recommend physical
books for beginners. Look for books like "Programming [X] Games for
Beginners."

------
shae
I've been teaching programming to someone with zero computer experience. This
person had difficulty with mutating variables in Python, so I switched to
teaching them Haskell. This person has found the equational
reasoning/substitution of Haskell much easier to mentally model.

I'd say about two thirds of the people I teach have no difficulties learning
Python, and one third do much better learning Haskell because then variables
don't vary!

------
9214
I'd say LISP family via SICP book. Almost zero syntax, multiparadigm (i.e.
ain't force you to do something in a strict way), lots of high level stuff,
extendable. Once you'll learn Lisp - you won't care in which programming
language to code at all, since it covers all of the ground.

Another variant is Rebol and Red, with them you could start tinkering with
GUIs in no time, in other aspects it's similar to Lisp, Forth and Ruby.

------
falcolas
Lots of people answering with a great first language - here's a second, third
and fourth (assuming the first is an OO orientated language):

Lisp (Clojure) - Learn how to think functionally (Go deeper with Haskel)

C - Learn how to think imperatively and work with low level OS concepts (Go
deeper with Rust, C++, Go, etc)

ASM - Learn how the computer _actually_ thinks (Go deeper by creating a toy
OS)

And finally, create your own language with a parser and compiler.

------
specialist
Techical writing (in your native tongue).

Write the instructions for creating a peanut butter & jelly sandwich. Have
someone try to follow your instructions. Did you get a sandwich?

If yes, you're now a programmer.

When picking a computer programming language, most important is having a buddy
/ mentor who can help you climb the learning curve. If you're looking for
local resources and communities, maybe start with meetup.com.

~~~
pbaehr
Replace "Have someone try to follow your instructions" with "Have someone who
hates you follow your instructions" for more accurate results.

------
melling
What do you think you will enjoy doing? Web pages? Android apps? iOS apps?
Pick something fun then choose the right language.

~~~
FalconNine
I'm not doing this for work or school or anything, just for fun. I want to
make small games as little pet projects, not aiming to make money or anything,
just to have a hobby.

~~~
devnonymous
Learn Python. It is a general purpose language. Since you are specifically
looking to start with games or for little pet projects, I would recommend:

[https://inventwithpython.com/](https://inventwithpython.com/)

------
marcosdumay
Well, unless you really want to make a project that needs them, do not start
with C, C++, Java, C#, or swift.

Those languages are complex. There's a lot to learn just to master syntax, a
lot of restrictions you have to be aware, and a lot of learning material
pointed at big projects that will be harmful to somebody just learning how to
program.

~~~
rikkus
Which language is better then? BASIC? I see a suggestion for Lua too, which
seems attractive.

~~~
marcosdumay
Python, Ruby, Lua are all great. If you want to make it serious and will go
into lower level languages later, Pascal is great.

------
2AF3
Learn about the trade-offs, you'll be more productive in C# or Java and have a
more pleasant debugging experience over C, but C gives you better
understanding of hardware and opens doors for embedded devices, OSes, IOS.

------
ssrmedia
C# :)

------
imre
python 3 and to help you visualize some concepts, use thonny
[http://thonny.cs.ut.ee/](http://thonny.cs.ut.ee/) which i find quite unique.
Later for real projects you want to use some better IDE. Hands on learning:
[https://www.hackerrank.com/domains/python/py-
introduction](https://www.hackerrank.com/domains/python/py-introduction)

------
zeveb
I'd be tempted to say Smalltalk or Python.

Real BASIC was awesome, but I don't know anywhere which would have a
traditional, old-fashioned BASIC. Maybe an Apple II emulator?

------
joekinley
Erlang

~~~
Lordarminius
> Erlang

Genuinely curious. Why Erlang?

~~~
Jtsummers
I think a case could be made based on the relatively straightforward syntax
(very few gotchas).

I mean, most functions will look like:

    
    
      f(X) when is_list(X) ->
        firstExpression,  % commas separate a sequence of expressions
        secondExpression; % semicolons tell us an alternate sequence follows
      f(X) when is_integer(X) ->
        thirdExpression. % periods terminate the block
    

Case expressions (similar to switch/case in other languages, cond in various
lisps):

    
    
      case Expression of
        Case1 when SomeGuard -> Expression1;
        Case2 when SomeOtherGuard -> Expression2;
        _ -> DefaultExpression
      end.
    

Receive expressions:

    
    
      receive
        Case1 when SomeGuard -> Expression1;
        Case2 when SomeOtherGuard -> Expression2;
        Case 3 -> Expression3
      after 1000
        TimeoutExpression % handle timing out
      end.
    

Note how they're all following the same form (this is also a selling point of
python, its syntax is pretty consistent, especially for the features used by
beginners).

The conflation of strings with lists and characters with integers can be
problematic, as sometimes a list of integers will display as a string if they
fall in the printable character range (and this isn't what you want). This
creates confusion, but it's surmountable.

Variables don't vary in erlang, but if a new user isn't accustomed to doing:

    
    
      x = y
      x = x * x
      x = x + 4
      x = sqrt(x)
    

then they won't have too big a problem doing:

    
    
      X1 = Y,
      X2 = X1 * X1,
      x3 = X2 + 4,
      X4 = sqrt(X4).
    

It is more cumbersome, but it's also likely that those intermediate variables
could have more descriptive names.

The concurrency model is fantastic, and will, IMO, be greatly beneficial to
anyone new to programming. Not because it's available in every other language
(without libraries it likely isn't), but because it gives a really good mental
model for concurrency that can be mapped to other existent concurrency
implementations in other languages. It also helps to encourage a design based
on loose coupling and high cohesion, which many (most?) of us believe are good
design principles.

Syntactic sugar around list comprehensions, maps, binary comprehensions make a
lot of algorithms very concise (though perhaps not performant, but this is
effective for a first pass implementation when you're aiming for correctness
and not speed).

The library ecosystem was less comprehensive last I checked (several years ago
now), which made integrating some useful libraries very challenging. But I
believe this has changed, and the Elixir project has certainly helped a great
deal here as well.

The performance of numerical code hasn't been good. And a lot of people
mistake concurrency for parallelism expecting performance boosts that just
won't happen. Concurrency is largely a design/communication principle, not a
performance one (though it can and does aid performance). So those are areas
for concern.

There's probably more pros and cons, but I've got to go now.

~~~
Lordarminius
Great case you make there! I'm off to look into Erlang :)

------
chrisamanse
Swift. Create mobile apps instead of websites.

~~~
LeicesterCity
Why mobile over websites? Just curious, because I'm also a newcomer that is
debating web vs. mobile.

------
jlebrech
Arduino, it's C but cleaned up a little bit and you can go under the hood a
little bit too.

------
neom
GoLang and JavaScript are pretty important areas to know these days and into
the future. Node is still big and will continue to grow on embedded devices
I'd hazard. I would also recommend learning Python and if you have time swift
(native apps!).

~~~
jlebrech
i'd try Go and Elm, although you'd encounter some JS and HTML a little bit
with Elm.

------
keyle
You could go old school and start with Pascal. It's a great learning
experience. And isolated from the real world to some extent, which at the
start is a good idea (there isn't 300 frameworks staring back at you).

~~~
randcraw
Agreed. Pascal has several advantages as a first language. The original Pascal
(oP) language is small and quick to learn. ISO Pascal (iP) adds objects to oP,
so the transition from oP to iP invites a graceful transition from procedural
to object oriented thinking.

As a type safe language, Pascal also introduces concepts of data placement and
memory management early on, and supports dynamic allocation and pointer access
clearly and painlessly.

Learning C, C++, or Python after Pascal should be quick and easy, since
they're just variants and generalizations on the primitives learned from oP
and iP.

------
optionalparens
I'm going to be blunt, almost all the comments thus far suggesting a specific
language are wrong. This happens everywhere, every time someone asks this
question. I would instead pay much more attention to anyone speaking generally
about problem solving and learning. I've learned countless programming
languages and eventually you'll get to the point where learning a new one is
just a matter of spending some time with it on a project. You're not married
to any language ever unless you're a terrible programmer, so you can always
switch to something else and at most, you've lost time.

My suggestion would be to pick a problem, analyze the problem deeper to see if
it's even worth solving, then proceed from there. That alone is a huge
subject, but it's really what you need to be comfortable with if your goal is
to be a programmer. If you simply want to have a language or two as tools (ex:
scientists), then sure, dive right in, but you will forever be stuck at a
certain level if you approach things that way unless you are really lucky or
really brilliant (most of us are not). Otherwise, take the time on the problem
you want to solve, first and foremost, every time. The problem generally
(obviously some exceptions) has little to do with language, computers, or
anything technical, even if the problem is actually focused on a computing
topic. If you still want to solve the problem after doing things like figuring
out who/what/where/when/why, then try to pick the language(s) and tools that
best fit the problem. Unfortunately it is hard to do this without having
programmed in a language yet, but you can at least do some basic research,
reading, and so on to find the best tool for the job.

You will fail in this your first time, and probably your first ten or even 20
times. Most programmers fail in this their whole careers, so do not get
discouraged. The best you can do is learn from your mistakes when trying to
solve problems with technology, and try to do better the next time. Even if
you fail to pick the "best" tool for a job, making a mistake will teach you so
much and you'll build on this going forward. This also means you can always
change languages if you think it won't work for your next project or you just
want to learn something new. Getting things done, learning patience, solving
problems, critical thinking, balancing everything, and countless other non-
technical things are really what it's all about and learning them will keep
you going. Language choice can save you lots of time, lead to better results,
and much more, but it often is just a distraction for the average problem.

You mentioned you wanted to make a game. I would say 99% of programmers I have
ever met say this and very few of them have gone on to make games at all, and
even less, professionally. Saying you want to program a game first is like
saying your first race will be an ultra-marathon with no training. I am not
trying to discourage you, rather I am trying to be real and help you think
about what goals you want to set for yourself. For reference, yes, my first
program was a game, but this was a long time ago and I'd say it's a miracle I
continued.

I have worked on games and game engines professionally and would be happy to
discuss more things related to the learning process. To avoid being "that guy"
who never gives any specifics and is just a contrarian, I will tell you the
honest truth as it has been for a long time in game programming -- If you want
to be at all decent at game programming, you must learn C and C++, and
eventually at least a decent understanding of assembler would really help you.
Anyone who tells you otherwise is wasting your time, lying, and/or has never
written a game (why this is would be a huge post). You can be productive and
write good games in any language, but if you are anything like most of us, one
day you will want to write a game that is not just a toy, text-based, or a
glorified web page. There's nothing wrong with those games if that's your
thing, but I've rarely met anyone who has the long-term goal of writing those
games except for spammers, crazy people, or unscrupulous people (ex: Zynga).
Again, that's not to say your game has to be written in C or C++ (you can
write amazing games in C# using Unity for instance), but having command over
those languages still teaches you so much of how a computer works, how to
optimize games, and will save you when eventually you'll want to communicate
with things written in those languages and not treat them like a magic black-
box. For the goal of being a game programmer, it's a good use of time even if
you never write anything professionally in C or C++. It's less about the
mechanics of C or C++ and more about learning how things work at lower-levels
and expanding the size of your "safe" zone mentally. Likewise, you'll want to
learn quite a bit of math for most game programming, be in matrices, algebra,
geometry, calculus, diff eq, etc. So you may not even want to learn C or C++
as your first language, and that's fine, just know that long-term if you are
serious about games, you will have to do that. The message is that you need to
focus on computer science skills, not language specifics in order to work
towards that goal, even when working in other languages. In the process of
doing this, you will learn a lot more about what I said earlier - picking the
right tool for the job, which means not just languages, but libraries,
editors, formats, algorithms, etc.

Building a game, at least remotely well, requires quite a lot of skills that
are far beyond a new programmer's abilities and it is nearly impossible to
master them all in a lifetime. You need to learn the basics first and to
understand your limitations and resources - you won't be building a AAA or
even a nice looking indie game for a long time unless you are truly
exceptional, lucky, or have a team of people doing it mostly for you. At best,
you'll produce something that on the surface works, but your programming
ability will suffer and if you eventually do work with competent people, they
will think you are terrible or hate you. That said, building a game will
require you to learn so many areas and thus teach you more than almost
anything the best way - hands on. It's a balance of getting things done and
doing them right, and knowing where, when, and how to cross that line is
vital. When you first start, you won't even likely have any ability to filter
out all the information out there that is wrong, will waste your time, is bad
design/BS/awful. Some programmers never learn this, but this too is hugely
important.

I strongly advise you to see if programming is something you even want to do
first, figure out what you like to do, where are your deficiencies, and work
from there to figure out what your role would be in game dev, where you need
help, how to judge others, etc. A game can be a motivator to learn more and
teach you things along the way, but it can also drive you away, overwhelm you,
teach you bad habits that you will never shake, and generally lead you astray.
As such, just writing simpler things that solve real problems might get you
there faster and sharpen your skills better along the way, while ensuring you
don't throw up your hands. You might be different, but that's the pattern I've
seen in most people. Pick a reasonable, small problem you care about, match
the tools, go from there, repeat, potentially with new languages after you get
comfortable programming for awhile.

------
s81
pascal or haskell

------
taphangum
P.H.P

~~~
V-2
Stop trolling the OP. How would you feel if he believed you and actually
picked up PHP?

~~~
david-given
Modern PHP's not actually that bad; most of the language's reputation comes
from much older (and much worse) versions.

And it _is_ really good at providing server-side programming to a web site
with the utter minimum of work --- after all, that's why it's used so much! No
compilation, no deployment, not even any need to have two files open at once;
just stick a couple of lines of PHP into an HTML file, hit reload, and you're
there.

I wouldn't call it a particularly _interesting_ language, but if the OP
reckons they'd be motivated by building web apps, it's a perfectly reasonable
choice.

~~~
babyrainbow
It has not improved much. It has added some superficial things. But I am
afraid that the worst part of the language is still very much alive.

>No compilation, no deployment, not even any need to have two files open at
once; just stick a couple of lines of PHP into an HTML file, hit reload, and
you're there.

>And it is really good at providing server-side programming to a web site with
the utter minimum of work

This is exactly the problem with the language. It lets you cuts corners when
those corners are there for a reason. For example, look at the ease of
deployment that you have mentioned. For a novice, this will be appealing. But
for someone with experience with web applications, it might look appalling
that you can map urls directly to execute arbitrary files in a directory.

This theme is found throughout the language. In an attempt to make work easier
for novices and to make it easy to work with data send from html forms, the
language has been packed with so much weird behaviors that you need to learn
before you can build stuff in php with any sort of confidence.

And that is just the tip of the iceberg....

