

Ask HN: What programming language do you recommend starting with? - whereareyou

Where should a beginner who is interested in coding start?  Is there a language, like latin, that can help form the basis for understanding other languages and make learning easier?
======
inetsee
If you are serious about thinking that Latin would be a good precursor to
learning other languages, then I would recommend that you learn Scheme. Scheme
is a dialect of Lisp, which was one of the first programming languages. Scheme
was designed to be used to teach the fundamentals of programming, and was used
for quite a while at MIT in their introductory programming course. The
textbook that was used for the course (Structure and Interpretation of
Computer Programs) is freely available online, as are quite a few video
lectures that teach from the book.

There is another dialect of Scheme called Racket, that has an entire
development environment intended to make it easy to learn Scheme. Racket uses
another book titled "How to Design Programs", that is also freely available
online.

Learning Scheme will give you a solid foundation in the fundamental concepts
of programming.

If you would rather start to learn programming with a more mainstream
language, Python is the programming language that MIT is now using in their
introductory programming course.

For more information use your favorite search engine to look up "mit ocw
gentle introduction programming" or "sicp" or "htdp".

~~~
Fixnum
> Is there a language, like Latin, that can help form the basis for
> understanding other languages and make learning easier?

As inetsee says, Scheme is this. It will provide you with a firm basis for
actually understanding how programs execute. (Theoretically, learning C will
also do this, but if you want to come from that direction I recommend learning
some assembly language instead, since the semantics of C are surprisingly
complex). Stretching the analogy rather dangerously, Scheme is as relevant to
the past, present _and future_ of other languages as Latin (though this is a
conceptual rather than historical truth), as pedagogical/minimalist as
Esperanto, and as expressive as English.

Also, if you find HtDP too tame or SICP too challenging (certainly possible
unless you have a science/math background, though most parts requiring
specific knowledge are optional), try Concrete Abstractions
(<http://gustavus.edu/+max/concrete-abstractions.html>).

------
jfaucett
Pulling on the parallel to human languages I'd say c is the latin equivalent
(except that c is still actively in usage). Basically, c was there first, you
could and still can build anything in c and though its easier than x86 its
full of pendantic features much like the latin case system. Also because c has
been so successful its had a huge influence on just about every succeeding
language - again much like latin. So I'd say learn c meets your requirements.
Nonetheless, just learning c won't get you acquainted with many usefull
features, just like knowing only english won't let you realize that common
words like collegue or friend can carry gender connotations that automatically
tell you if its a male or female friend/collegue (or that word order isn't
important when your language has cases).

In that respect I think Java plays a role similar to say 18th and 19th century
French - the post latin lingua franca. Java took a lot from c, but implemented
many new concepts and design philosphies to programming and brought them to a
wide audience. Although Java is kind of on the decline, and many other newer
languages like Go push the envelope further, Java and java philosophies have
still had a large influence on PHP, Ruby, Go, etc.

As far as what the english equivalent would be in this contrived metaphor...
I'm unsure maybe we'll just have to wait, but in the meantime with c and java
you shouldn't have a problem understanding just about any programming language
currently in use.

~~~
mratzloff
I'd say the English equivalent is PHP: a mongrel language that succeeded
because it absorbed everything, where you can say things 10 different ways.
Most developers know enough of the language to be conversant, making it a kind
of lingua franca.

From a historical viewpoint, English is just as much a weird mishmash of
everything as PHP is.

~~~
jfaucett
I think you got it :), also PHP is kind of like the "fluent in english"
requirement on every job post. While we're at it, what would the Lisp
equivalent be?

~~~
logical42
Esperanto.

------
ninthfrank07
If you enjoy watching videos, I'd recommend starting with the CS101 Udacity
course (Intro to Computer Science: Building a Search Engine), which you can
find here:

[http://www.udacity.com/overview/Course/cs101/CourseRev/apr20...](http://www.udacity.com/overview/Course/cs101/CourseRev/apr2012)

This courses will introduce you to the Python programming language and will
also explain you how search engines work. It's a perfect course for a
beginner, because it assumes no prior programming knowledge. It's also very
interactive, because you often have to answer questions or to implement your
own procedures in Python (you can write you code, run it to see the output and
submit it for validation directly in your web browser).

Looking at the syllabus, you can get a very good idea of what exactly you will
learn throughout the course:

Unit 1: How to Get Started (Your first program: Extracting a link)

Unit 2: How to Repeat (Finding all of the links on a page)

Unit 3: How to Manage Data (Crawling the web)

Unit 4: How to Solve Problems (Responding to search queries)

Unit 5: How Programs Run (Making things fast)

Unit 6: How to Have Infinite Power (Ranking search results)

Unit 7: Where to Go from Here (Exam testing your knowledge)

I took this class a few months ago and I found it extremely interesting!
Especially Unit 5, where you will learn how to implement hash tables
(<http://en.wikipedia.org/wiki/Hash_table>).

------
orangethirty
You have a fairly good understanding already, although you have not realised
it. Being able to _see_ that there are a set of core principles (Meta
principles, if you will) at work behind every language is a big (and hard)
step for beginners to take. Alas, you already surpassed that point. Yet, you
should not waste any time learning how to _code_. Invest your time learning
about patterns. Every program out there is a pattern. From the moment you
start to think about how it may work, to the moment you ship it, all you are
doing is thinking up patterns that aim to solve a problem. Let's take for
example the following problem:

    
    
         You have to get some data from the user through 
         a webpage. The pattern to do that is to include a
         form in the webpage where the user types in the 
         data we want. Then the user submits the data by
         clicking on a button. Following that we receive 
         the data and store it in a variable or 
         array (like a  bucket, but for data). From that point
         forward we process it with things called functions 
         ,which are nothing more than little bits of code that
         only have one task to complete. We then test to see
         if that data is in a condition that we can use it. 
         Thus we include in the pattern a set of conditionals
         to test if the data is good to go. If its not good to
         go, then we either fix it or trash it. Our pattern
         might include some functionality to tell the user that
         the data typed in is good, and conforms to what we 
         need. We may also need to return the data in modified
         form to the user. Maybe the user wanted to know
         what is the meaning of the word *perro* in English
         , so we send back the answer to the user. Perro is 
         dog in spanish.
    
         Now, let's write a simple program that follows that
         same pattern.
    
         <!-- the form where the user submits the data-->
         <form action="/submit" method="post">
         <input type="text" name="search">
         <input type="submit" value="search">
         </form>
         <!-- /of form -->
    
    
         <?php
            //the following code is not secure at all.
            
           $input = $_POST['search']; //look up there where it says name="search".
            
           function translate ($input) 
           { 
             if($input == "perro") //does the user want to translate the word "perro"?
             {
                return "dog"; //if he/she does then give him the translation.
             }
               
             else
             {
                return "I don't know.";
             }
           }
    
        
            //let's use the function to test the data.
    
           $output = translate($input);
           echo $output; //this displays the information back to the user.
    
    
         ?>
    
    
    

But wait, we can also do it in python. Let's use a simple python program to
show you how.

    
    
         #Python 2.7.X
        
         input = raw_input("What do you wish to translate?") #get the data from the user.
    
         def translate(input):  #the translate function.
             if input == "perro":
                 return "dog"
             else:
                 return "I don't know"
    
         output = translate(input) #use the function on the data gotten from the user
         print output  #display the results back to the user.
    
    
    

See the similarities in the programs? Notice the pattern? Even though they are
two different languages (three if we include HTML), they both follow the same
basic pattern to solve the problem at hand.

You must now focus of learning new patterns of how given problems are solved.
For example, getting data from a website, processing it, etc. Patterns do get
more complicated as you advance, even to the point of not being able to
understand them. But dont feel bad, most problems are solved using the simple
stuff.

From here on, I would focus on learning every possible language I could get my
hands on. But learn by doing, and not by reading (read -> test and repeat).

If you need any assitance, feel free to email me. Best wishes.

~~~
jkaykin
Couldn't be explained better. Do you teach?

~~~
orangethirty
Yes.

------
LarryMade
There is assembly language, which is the root to all higher level languages...
but I would not recommend anyone start there unless they are using a micro-
controller or other tiny platform.

If you aren't too savvy on computer concepts I would suggest python - probably
the easiest to get into and whatever platform you are on (Mac, Windows, Linux)
python exists for it, has libraries for just about anything you want to
explore, sound graphics, etc.

Second choice would be C - lower level than python but more understandable to
the neophyte than assembly would be. C runs a lot of system functions on
popular computers.

------
csense
> Where should a beginner who is interested in coding start?

Python is a very easy language to learn and is also very powerful.

> Is there a language, like latin, that can help form the basis for
> understanding other languages and make learning easier?

Assembly language. It's a text language that corresponds one-to-one [1] with
machine language, the numbers which are given directly to the CPU for
execution [2].

I would _not_ recommend assembly language to a beginner, but rather to an
intermediate-level programmer who's already proficient in at least one other
language. The main problems with it are (1) it's not portable, (2) it's not
easy to find tutorials and documentation geared toward beginners, (3) it's not
easy to find programmers who are comfortable with it, and (4) it tends to
produce very long, difficult-to-read programs.

So even if they know assembly language well, most programmers don't use it
directly very much; there's a reason that it's mostly a dead language outside
of very specific areas.

Learning assembly language immensely helps your understanding of how computers
work, and gives you some idea of what operating systems and higher-level
languages must do behind the scenes to provide the tools that they give you.

To summarize, assembly language is a mostly dead language, with very limited
direct practical use in modern times, which, when learned, will greatly help
your general understanding of other languages -- and which cannot be avoided
if you want to master complete knowledge of how computer software works.

[1] Modern assemblers often provide higher-level tools like labels, macros,
and linker data, so the correspondence isn't necessarily one-to-one.

[2] I originally said "used directly by the CPU", but modern CPU's, at least
in the Intel world, translate the user software's machine code into a
proprietary internal code that's only visible to the hardware. This is largely
a workaround for the fact that the x86 is constrained by backward
compatibility to be a CISC-style machine, even though we now know RISC-style
machines are much simpler and faster. The extra abstraction layer provided by
the translation from backwards-compatible user instruction set to the internal
proprietary instruction set means the latter can be RISC, can be shuffled
around however the chip designers want, can use a strange number of bits per
instruction, can be tied closely to tiny architecture details which may change
in next year's chip, can actually change instruction order to increase speed
as long as we can prove it doesn't change the semantics of the user program,
etc. And all we software people see of this is that, inside the CPU, magic
happens -- which makes our programs run faster.

------
zachgalant
The programming language isn't really the important thing to learn. The
important thing is learning how to think and how to break large problems into
smaller ones.

I really recommend against starting with C or assembly because they are hard
and can discourage you. Even trying to start by making something with Ruby on
Rails can be very discouraging.

The best way to start is to work from the beginning and learn the fundamentals
of programming and how to think rather than focusing on a language.

I'm making CodeHS (<http://codehs.com>) to help teach beginners in the most
user friendly way possible by stressing the way of thinking rather than the
programming syntax.

We're providing help to beginners because we know that people can get stuck.

We're about to change our pricing, but for now, you should check out the free
trial. We'd love to hear what you think.

------
jspiral
I tell the majority of people who want to dabble with programming to start
with javascript, because the environment setup to make something run is so
trivial, and they get positive reinforcement from making something that
relates to other sites they actually use, not command line output.

If you're really looking for a latin equivalent, I agree with the previous
posters (a lisp, python, and c all have merit and are worth getting to
eventually).

My own early learning path was basic -> dos shell -> c -> c++

I'm glad I learned c, wouldn't really mind having missed C++.

------
dragonbonheur
Just learn BASIC, which will give you the least frustration and the most
enjoyment. Head over to basic.mindteq.com and choose a compiler (yes, compiler
- they exist) and integrated development environment. You might be interested
in Freebasic, which will enable you to create games or other software without
having a whole lot of dependencies to download. There are versions for Windows
and Linux and you can easily interface C code to create slick GUIs on both.
Head to zetcode.com to find out how to mix GTK to freebasic. Head over to
petesqbsite.com to find a great community and lots of tutorials.

Other nice BASICs are AutoIt (Win), FnxBasic (Win), Envelop (Win), Microsoft
VB Express edition (win), Gambas (Linux), Xbasic (Linux and Windows), GFA32
(win)

After learning that language you'll be able to move on to others, even to C
which has pointers because freebasic uses pointers too.You'll find a lot of
tutorials on the web and a great community for almost all of those.

Lots of people are going to say BASIC is inadequate for serious computing but
if you go their way you'll find that the desire to learn has left you by the
time you finish reading even one text. Ultimately it's your decision, not
theirs.

TL;DR: You can learn BASIC in a weekend. Great community, easy to learn, will
accomplish great things, will help you understand other languages.

------
gyardley
I wouldn't approach it this way.

Instead, I would think of a project I wanted to build, pick a language well-
suited for that project, and then learn that language as I got building.
Learning through doing is the best way to make learning easier - far better
than studying the programming equivalent of Latin.

------
Uncompetative
The most beautiful, well designed, programming language I have ever
encountered in my 20 years of research is the equational programming language
Q:

<http://www.musikwissenschaft.uni-mainz.de/~ag/q/qdoc.pdf>

------
8jef
If I were some alien coming to Earth and asked myself what language to learn,
I'd start with English, not Latin. English seems like a pretty obvious start
when trying to communicate the earthling's way. Then, once I've mastered
English, I'd drill a bit and find out about its roots and cousins: French,
German, Latin, ancient Greek, etc. Then I would learn Chinese.

So my first question would be: What's English equivalent in programming
languages? PHP? Java? C? Then, because programming languages have entered in a
very fast paced evolution period recently, with new languages popping out
every given month, what programming language the most prominent programmer
elites are using right now? Go? Any other C variant? JS? Ruby? Etc.?

------
shrughes
Just start with Python. I don't know why some people are not recommending
Python but they don't have your best interests at heart, they aren't actually
thinking of the language that's quick to get up to speed and enjoyable to
learn with, and instead are going with some absurd platonic ideal designed for
a parallel universe in which their recommendation might make sense.

I'm specifically pointing at the highly voted posts mentioning C and Scheme.

------
davidxc
I think Lisp and C are the important languages to learn as a basis for
understanding other languages, and programming in general. C is a low level
language and gets you thinking about things like memory, memory addresses, and
pointers. Lisp, on the other end, is a high level language with powerful tools
for abstraction, like using macros to create new syntax.

However, I wouldn't recommend either language as your first. I recommend
starting with Python. It's an easy language to learn, but also powerful. It's
closer to the languages that are used in industry, has a lot of libraries, and
you'll be able to quickly develop useful applications in it, which will make
programming fun.

After a few months of Python, learn Lisp and C. Like others here, I also
recommend learning Scheme, which is a clean dialect of Lisp.

------
mitchi
Java or C++. Both have great IDEs (Visual Studio, Eclipse, Netbeans) that come
with a debugger and make tools, so that you can focus on learning the language
before learning what a linker and a compiler is. The debugger is also a must
for learning properly by trial and error.

Don't bother with anything else.

------
ishbits
Maybe go straight to functional. Check out Scala.

------
lelf
Scheme, Haskell

