There has to be a first for everything. You may want to learn computer programming for personal reasons. Or, like many colleagues I've worked with, you might have gotten hired by a tech firm and realized that learning to program could help you better understand the customers and your environment.
In any case, programming is one of the great disciplines. It can improve the rigor of your thinking and help you appreciate the good and bad points of the software that is increasingly entwined with our everyday lives.
This article briefly lays out some possible first languages to learn, as well some other choices that I would recommend as a second language.
JavaScript
My top choice for a first language is likely to be controversial. But JavaScript has lots to offer a newbie. It's part of any browser, so you don't have to download anything or run a special program. Just write some JavaScript into a file and run it as a web page in your browser. Furthermore, the language is broadly useful, because all kinds of organizations need web pages, and JavaScript is an indispensable part of them.
Actually, you should learn HTML and probably CSS before learning JavaScript. They are languages all their own (although I wouldn't consider HTML or CSS a programming language), but they're not hard. It's easy to try out new features, there are scads of documentation (such as an HTML tutorial and a CSS tutorial from the standards committee that maintains the languages), and you can see the results of experiments immediately in living color. Together, this set of languages give you a nice introduction to computing and a step up in mastering Web technology.
JavaScript has one other advantage, not often appreciated. It uses a structured syntax—a way of organizing your code—that is shared by many other languages. These are sometimes called "C-like languages," because they derive this syntax from the mother of modern programming languages, C. (Yes, some programmers like one-letter names for languages.) JavaScript code uses various punctuation (braces, brackets, and parentheses) to indicate what each part of the code does. A typical chunk is:
current_choice = ta_array[i].getAttribute("name").replace("choice",""); if (correct_value == current_choice) { correct_value = i; }
You'll get comfortable with all that strange punctuation as you start writing JavaScript code. And then you'll find it easier to learn a whole bunch of other languages.
Python
Python is a more conventional choice for first languages and is guided by the Python Foundation. Proponents often point to the supposedly simple syntax of Python, but it gets just as complicated as most other code when you start doing serious work. The code shown before in JavaScript would look something like the following in Python:
current_choice = ta_array[i].get_attribute("name").replace("choice","") if correct_value == current_choice: correct_value = i
There's still syntax to master, but Python lets you write your first programs without learning too many perplexing concepts.
The best reason to learn Python is the cornucopia of powerful libraries and services written for it. A library is just a collecting of useful tools that do something such as math, text manipulation, or even machine learning (the current preferred way to do artificial intelligence). Languages benefit from network effects, which means that as more people use the language, more libraries and other resources become available for it.
A lot of the most powerful programming functions nowadays are offered by online services through an application programming interface (API). The services love Python, so you're even more likely to find a Python interface than to find a Python library that does what you want.
A Python interpreter lets you enter individual lines of code and view the results. This instant feedback can be a valuable learning tool.
Although Python is the current darling of the computer field, different languages win that honor at different times. For a while, Ruby was riding high, especially because a package called Ruby on Rails in the early 2000s offered a new paradigm for handling web requests. As programmers moved away from Rails, Ruby also became less of a challenge to Python. But the languages are similar in many ways, and a lot of people still love Ruby.
Ideas for a Second Language
Many language zealots, disappointed that I haven't given the blessing to their choice so far, should take heart and keep reading. I may give the nod to their favorites here.
Shells (Command-Line Interpreters)
Although graphical interfaces are wonderful, every computer system provides a command line where you can issue powerful commands in text. (It may be almost impossible to find on a cell phone, but the command line exists even there.) Called the shell on most systems, this environment is well worth learning and constitutes a language all its own.
Functional Languages
JavaScript and Python are examples of one programming paradigm, but quite early in the computer field, a very different paradigm called functional programming was invented. Some advocates say it's the only right choice, while other advocates find room for both paradigms. And many languages have elements of both—don't get sucked into arguments over what is a "true" functional language. The best ideas from functional programming have made their way into JavaScript and to a lesser extent into Python. One popular functional language is Elixir, a simple interface into the classic Erlang language.
Mobile Development
Just as web programming became crucial in the 1990s, the opening of the iPhone app store in 2008 made everyone want to write a mobile app. If that's your dream, the two languages you need to learn are Swift and Kotlin. Swift was developed by Apple for its iOS-based mobile devices, while Google adopted Kotlin for Android development. The two languages share the popular traits of other modern languages, including some functional aspects.
There are high-level frameworks that produce Swift and Kotlin output, supposedly letting you write one program for both types of modern devices. Even if you use such a framework, I suggest you learn Swift and Kotlin. This will help you understand what's going on under the hood, and make it possible to learn from or maintain programs written by other people.
A Production-Hardened Language
While most of the languages I've mentioned so far stress convenience, many organizations look for languages that stress rigor. (Don't flame me, because I'm not suggesting that any language lacks rigor; I'm just referring to attitudes among large corporate coding centers.)
For several decades, Java has been the main language of corporate computing. Its syntax is somewhat similar to JavaScript, but otherwise the two are totally different languages. Java is still a safe choice if you want to get a job as a programmer.
However, unlike most languages, Java is tightly controlled by one company, Oracle. They will soon start charging for use of their toolkit, which is a matter you can leave up to your employer if you are using Java at work. But this change makes the language less appealing for free and open source software, or amateur projects.
The up-and-coming contender for most hardened language is Rust. It may make a great second language.
The C family
I already mentioned that C played a historic role in computing, and that many other languages copy its braces and other syntax. It's a kind of lingua franca that every serious programmer is expected to know. Instead of plain C, though, programmers today prefer one of the newer and more powerful versions, notably C++. Start with C, and then consider learning C++.
SQL
This is the standard for querying and updating databases. It dates back to the 1970s and has never been displaced. If you have almost any kind of database, it's useful to be able to ask questions such as, "How many people in my city voted in the 2019 election, and how many owned their homes versus renting them?"
Conclusion
Programming languages have been a rich and varied menagerie from the start. This diversity shows no sign of disappearing. Each language has its own talking points and starts out with a certain understandable hype. I hope I've helped you make a choice by highlighting some considerations for choosing a language.
When you join a company or project, the most important criterion for using a language is what's already in use. The second most important criterion is what language has the most libraries of interest to your project.
Finally, let me extol the value of an integrated development environment (IDE). Many programmers swear by their old-time text processor, and some of these text processors provide great programming features. But an IDE, typically offered through a graphical interface, gives you lots of support that can save you hours of fussing around.
Whatever your choice, give programming a try. It’s a valuable skill that will add another dimension to your education.
Comments