The First Language
In the last few years, I have had the privilege of helping a few different people get started in the world of programming
It brings some questions into sharp focus. One of the first, biggest, and most obvious is, "Where should I get started? Which programming language should I learn?"
It's a good question, and its also a little frustrating, because its hard to get a straight answer by asking around the internet. You will get a bunch of strong and contradictory opinions, coupled with a bunch of people who seem strangely evasive. Those people will say things like, "You should compare them and pick the one which is best suited for your needs" or "It doesn't really matter. Pick whichever one you like the most." But of course when you're starting out, you have no context to compare languages or even "like" any one in particular.
One other thing that muddies the waters, is that most discussion of the subject seems to focus on comparing surface features of the different languages. They typically argue that for a beginner language
It should not take a lot of boilerplate to code to get started with a simple application
# Python
print "Hello World"
is better than
// same thing, in Java
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
It should have a syntax which is reasonably close to plain English
ie, it should not be overloaded with !@#$%^&*() characters. Ruby seems to do a truly extraordinary job at this, and Python is almost as good. In other words
# Ruby
10.times {puts "Hi there"}
seems much better than
// Same thing, in C++
for(int i=0; i<10; i++){
std::cout << "Hi there\n";
}
Based on these, a lot of people recommend Python or Ruby as a good place to start (Python seems to have become the favorite of college classes, and Ruby of coding bootcamps).
While I don't disagree with the final conclusion that those are good languages to start with, I do disagree with this sort of analysis. I think its barking up the wrong tree. Those characteristics are fairly superficial, and there are other things which ought to be given greater weight.
Do you have a particular goal in learning to program?
Consider your circumstances for learning to program. Do you have an idea for a killer iPhone app? A particular field you'd like to break into? A particular company where you have a foot in the door?
If so, learn the language which best suited for that goal. Having that direction and motivation is powerful enough to eclipse any differences in learning curve between programming languages.
This illuminates one of the dirty little secrets of programming: That most languages are very much the same. If you've learned to program in one, picking up others is pretty straightforward. What separates languages is much less their syntax, and more the libraries and tools which are available for them. For instance, Swift is a nice but not terribly remarkable language. What really distinguishes it, is that it is the language which allows you to program on the iPhone platform. The Unity framework for creating games could have been built for any number of languages, but it just happens that Unity programming is done via the C# langauge. Learning Ruby makes the Rails framework for creating websites available to you, and Python has become the language of Data Science... not so much because of intrisic characteristics of the Python language, but because there is a robust ecosystem of libraries available in Python for processing, analyzing, and presenting data.
Thus, if you want to break into Data Science, you should learn Python. If you want to work in the family business where Visual Basic is the language of the land, learn Visual Basic. If you have a killer iPhone app you dream of creating, Swift is the language for you.
Data Science: Python (R is well thought of too, but Python is more versatile for non-data-science applications)
HTML5 Games: Javascript
iPhone: Swift
Android: Java or Kotlin
PC Games: I haven't used it personally, but I hear the Unity framework with C# is a good bet
Windows Desktop Programming: C#
Embedded software: C, and then pick up some C++
General Web programming: Ah, that's a big field, and there are lots of options. More discussion below
No, no specific goal like that. I like computers and programming looks like a very promising field. I'd like to learn whatever will get me up to speed quickly.
I think in this case, there are a number of options, and a few factors to consider
It should be a popular language
This isn't a big consideration for a 4-year computer science degree, because you learn multiple programming languages over the course of that degree. But for someone who's learning through informal channels, I think the best way to grow is to get a job writing software as quickly as possible, and its much easier to do that if the language you've spent the last year or two practicing is the same as the one you'd be doing work in. Being popular also tends to mean that there are lots of training resources available on the internet.
In other words, it should probably be in the top 10 or so in this index of language popularity.
It should be easy to step through with a debugger
Even for most professionals, having a GUI where you can set a breakpoint by clicking a little red dot into the margin, and inspect a variable's contents at run time by hovering the mouse over, makes coding an order of magnitude easier. For a beginner, a debugger will often help them understand in minutes things that would otherwise take them hours of frustrated head-scratching. For these reasons, I think it's essential to choose a language that not only has an integrated debugger available, but has one that's easy to set up. Most of the major languages are pretty decent in this regard, but it is a slight knock against Ruby, which doesn't have fantastic IDE integration.
Is should make it easy to get started creating Graphic User Interfaces of some sort.
This, I believe, is the single most important factor.
I think the true hangup where people get stuck when they try learning to program doesn't come because they don't get variables or types or classes or for-loops. Its because they work through the tutorials past those things, and then they say, "That's cool. I think I've even wrapped my head around that Linked List. But I don't feel any closer to being able to put it all together into a REAL program: The kind that shows up in a window on your screen and has buttons and GRAPHICS"
In programming, we have to start simple, and that usually means starting with text-only programs that run from the command line. But I think the most valuable thing a language can do to help beginners along is to give them tools for event-driven GUI programs as soon as possible. With this in mind, I can think of two top candidates:
Pure HTML/CSS/Javascript with a little bit of Node
Javascript is popular (it will be the final language), and Chrome Dev Tools give you stupendous debugging right in your web browser. HTML and CSS are a little less intuitive for getting started than a drag and drop editor, but they are very powerful, and they are becoming the universal language for describing user interfaces. I think there are few introductions to the world of programming that are more powerful that being able to enter a few simple html tags into a text file, and then to be able to open that text file in a browser and see it render as a real live user interface.
From there, you can write behaviour with the help of a framework like React, or even just jQuery. You could introduce the server side with any language, but it seems simplest to just use Node. That way, everything is just Javascript, with no need to master an additional server-side language. A nice bonus here is that Google Chrome comes preconfigured as a world-class Javascript debugger, and it will even attach to a node process with very little configuration.
The other one is C#
C# by itself is a decent beginner language. I think for beginner comprehension, C#'s strong typing is a help, rather than a hindrance. C# has all the nice parts of Java, but with many of the rough edges smoothed over. But my main reason for recommending it is because it makes it so easy to get started with a basic Winforms GUI app. You just build an interface by dragging and dropping controls into a form, and then it gives you start writing code in handler functions for the various events those controls can trigger. There's hardly any boilerplate that needs to be written. If you need real-time behaviour, you can just add a timer to the form and add behaviour to the timer tick event, and if you need access to a database, there are wizards and grid controls which make it easy to start on the basic CRUD operations. Of course, as you gain experience you will run into the limitations of WinForms, but it's relatively smooth from there to migrate to more powerfull toolsets like WPF and ASP.net MVC while staying within the C#/Visual Studio ecosystem.
Honorable Mentions
iOS with Swift / Android with Java:
Many of the advantages of starting off in Winforms seem to apply to starting out with App development as well.
Ruby on Rails / Python + Flask
For all the reasons mentioned at the beginning, Python and Ruby are smooth, beautiful languages which give a fairly easy learning curve for getting started with command line apps.
Ruby's Rails web framework offers an excellent toolset to get a basic web app up and running quickly, and to start experimenting from there. Plus, it seems to me that Rails does a fantastic job of encouraging developers to use good patterns, such as separation of responsibilities, REST-ful APIs, and unit testing.
Python is a similarly beautiful language, but with better IDE integration than Ruby. I also suspect that, for the student going down the Web Programming path, it might be easier to get started with a minimalistic web framework like Flask, rather than a big, full-featured one like Rails. Python seems to be the most popular beginner's language out there, which means there's a particularly good variety of online training resources across the internet.
My only reason for not recommending these more highly, is that neither of them offer quite as rapid a path for creating interactive graphics. Neither has particularly friendly libraries for creating desktop GUI's, and to get very far with web apps, you need to learn Javascript/HTML/CSS in addition to Python or Ruby.
Subscribe to Axten Software
Get the latest posts delivered right to your inbox