On Languages

Tim H. asked:

As a neophyte I’m still learning which programming language is mainly used for what purpose and why. Everyone seems to have a different opinion on the matter. Is there a standard outline of programs and their uses? A secondary question that spawned from the previous is that I’ve heard several say that some programs have “more power” than others; how does a language have more power over another one?

There isn’t exactly a “standard outline” per se, unless you count Wikipedia or maybe if you collected statistics from GitHub somehow. I can’t offer you much more than my own experiences, impressions, and opinions about which tools are meant for–or used for–what purpose.

Your second question is easier to answer, as Paul Graham (a favorite essayist of mine) has already written about the topic quite extensively in essays “Succinctness is Power” and “Beating the Averages“–which I would recommend reading in their entirety, but in case you’re in a hurry, here are the basic ideas.

A programming language should get the job done as simply and succinctly as possible. A language that makes you jump through hoops and take lots of extra steps to do something isn’t a powerful one; it may appear more readable, but it’s also a lot longer. A powerful language should give the programmer freedom to break rules sometimes if they decide it would make the program shorter, rather than having tons of “guard rails” intended to protect stupid programmers from their own mistakes. (If you’ve ever done any programming using Microsoft languages, or something like Ada or Pascal, you know what I’m talking about.)

Basically, it should let you do stuff–quickly and simply. That’s what makes a powerful tool.

Languages and their uses

Paul Graham covered this a bit too.

Again, this is somewhat subjective; everyone has their favorite language that they default to more often than others, and some people may use a tool for something that isn’t exactly mainstream. I also don’t pretend to be an expert on all–or, indeed, any–of the cultures surrounding the tools in this list. I haven’t even used all of them. This is just about what I’ve seen people use the tools to build, and what I’ve heard other programmers talking about.

I won’t cover every language out there. Just the ones that are in reasonably common use today. No one uses Pascal any more, fortunately. I’m also not covering esoteric programming languages. Furthermore, I won’t cover all the dialects of a language; that would be silly. So if you’re looking for your favorite language and it happens to be Clojure or Scheme, you’re only going to find Lisp.

If I missed an important detail about your favorite language or something like that, feel free to add your comments below.

Also, although I have Opinions on certain languages, I’m willing to admit that they may be better tools in the hands of someone with a different programming style or different level of expertise in that tool than I have. But nothing will make me like .NET or VB.

Assembly

A really low-level language used for things like device drivers, and also a teeny-tiny piece of C’s compiler or something (I think?). Most people don’t program in this casually; those who do are usually old-timers who like to be close to the bare metal.

Bash/Bourne shell language

A pain. It’s not bad for entering everyday shell commands, but writing scripts with it is pretty darn annoying (and that’s its only use, unless someone figured out a way to use it for something else for some reason). Most programmers use Python or Perl instead for tasks that would otherwise require Bash scripting language.

I’ll kind of cover sed and awk under this umbrella. Quite frankly, they’re a pain to work with too, although they are powerful tools. They’d be less of a pain to me if I used them frequently, but I don’t. Most people consider them to be pretty confusing, though.

C

A solid language that’s been around forever. Considered quite low-level, but not as much as Assembly; low-level enough to give you control over nitpicky things and allow you to optimize, but is also finicky and doesn’t do much for you. It’s the base language of Unix and Linux, and is what you use when you need to do systems programming, or you want to write an application that runs really fast and you don’t mind taking longer to develop it. C is what you learn when you want to find out more about how programming languages work. However, to be an efficient programmer, you shouldn’t use it when it isn’t necessary–building everything you write in C wouldn’t be quite as crazy as, say, trying to code an OS in Java… but it’d be up there.

C++

Written by Bjarne Stroustrup, C++ was intended to be C’s successor. Instead, it became an independent language serving a different purpose in its own right. C++ is famous (or perhaps infamous) for being… rather elephantine. If someone mentions they know C++, at least someone else in the room or conversation will say, “What, all of it?” C++ has a lot of fans, and you can certainly do a lot with the language, but it’s considered to be kind of crufty and over-designed, with too many features and libraries and add-ons. See the Jargon File entry on second-system effect.

I haven’t used it myself, so I don’t have an opinion on it either way.

C#

I have used this. Not in a big project or anything, but I had a class on it. It’s basically Java, but tied strongly to Microsoft’s Visual Studio. I don’t know much about the language outside that context (I’ve heard Microsoft opened it up, so presumably you can use it outside VS), but I don’t like Visual Studio, so I don’t like C#. I’d just use Java if I wanted something that looked like Java.

COBOL

Unfortunately, this is still around.

Erlang

A functional programming language. Has a small following, I think mostly in academic circles. I don’t know a ton about it.

Fortran

A low-level dinosaur that’s still hanging around. It must be useful for something, but AFAIK the lowest-level programming language that’s still used widely is C. Assembly gets used for device drivers and that’s about it; I don’t know if Fortran maybe occupies the same niche alongside it, or if nothing new is being written in it.

Go

C, reinvented by some Google coders. I don’t know much about this one, but here’s the Wikipedia page on it.

Haskell

I get the impression that this is kind of the hipster of the programming world. It’s supposed to be a great language, but it’s mostly used for academic purposes, rather than in production environments. It’s a functional language, like Lisp and Erlang, and as such is kind of an underdog because functional languages are generally not that popular due to their syntax, which looks scary.

HTML/CSS

Not technically programming languages, as they aren’t Turing complete. They don’t have all the logic structures and utilities that true-blue programming languages have. They still count as computer code, but an HTML document is not really a “program”–it’s a set of instructions to a browser, which is a program.

However, they get a place on this list because they’re responsible for allowing many, many of our programs these days to run, by building the web sites that surround many of our most useful pieces of software. HTML and CSS are almost necessary for a programmer to know how to write. Fortunately, they’re not very difficult to learn either.

They aren’t used for anything other than web design, unless there’s some weird niche I don’t know about.

Java

Java, the industry standard in programming languages but notoriously un-fun to program in. It’s got tons of libraries, the Java Virtual Machine lets it run cross-platform, and it’s slower than slug slime. Not the worst language out there, but not the best either. It’ll certainly get you a job, but is usually not what you want to use on your own projects. (Exception: Android mobile apps. It’s the native language for the platform and so is usually the easiest tool to use for that purpose. This may change in coming years as projects like Kivy mature.)

I found a good article the other day that explained it in more detail if you’re interested. Apparently it’s supposed to be winding down in popularity, but ten years from now, even if it’s true that nobody will be using it to write new things, we’ll still be dealing with legacy applications that are written in Java.

JavaScript

JS covers both client-side and server-side scripting (now). It’s the trendy language of the moment for this, often used by those who bash PHP. JS has grown up over the years. I’ve been thinking about learning it, but I’m kind of booked on projects for the moment.

Lisp

A theoretical paper turned programming language. “Hey, look, it works!” It’s been around forever, along with C, and has a bunch of dialects; there’s Common Lisp, Clojure, Racket, Scheme, Emacs Lisp…

Its syntax looks scary, with all its parentheses, and the concepts involved are alien to any Lisp newbie, but functional programming is supposed to be so elegant and beautiful that merely understanding how Lisp works and being able to write in it is said to make you a better programmer.

I want to learn Lisp, but haven’t gotten a chance to yet.

Machine language

01000110 01101111 01110010 01110100 01110101 01101110 01100001 01110100 01100101 01101100 01111001 00101100 00100000 01101110 01101111 01100010 01101111 01100100 01111001 00100000 01110111 01110010 01101001 01110100 01100101 01110011 00100000 01110100 01101000 01101001 01110011 00100000 01100001 01101110 01111001 01101101 01101111 01110010 01100101 00101110

.NET (various)

Visual Studio is crazy and awful. The .NET framework means you need to develop on Windows machines, which is Not Fun, and use Windows hosting, which isn’t as secure. It’s also, in my experience, an extremely brittle system full of… maybe not full on spaghetti code, but at least rotini code. It’ll take you a long time to learn to work with well, and won’t be fun to use. However, it’s in vogue with employers, so if you’re worried about your job prospects… I’m sorry, just learn Java. I really don’t like .NET.

Okay, let me expand on this a little so you know it’s not just the fact that I’m a *nix user and it’s unfamiliar.

I don’t mind frameworks and libraries and whatnot, and I don’t mind IDEs. They can be really useful in certain projects. But I don’t like IDEs that try to set up a whole bunch of project code according to some framework. If your framework requires a lot of code just to get things up and running, it probably isn’t designed very well. That’s excusable when the platform expects a certain configuration of files and directories, but usually this isn’t the case, or isn’t the case to the extent that the framework sets up for you.

Welcome to .NET.

Some code tools (I use this term to mean a language’s collection of libraries, frameworks, etc) are like stir fry: they give you a basic (or not-so-basic) set of ingredients and you can combine them however you like in order to get a certain nutritional value and flavor palette. That’s a good tool; you can make something that appeals almost no matter what mood you’re in. Some are like Subway sandwiches, where you get this framework and this library and this package and you stick them together and you get basically the same thing every time. That can be good if you want a Subway sandwich, although it’s kind of boring after a while.

But .NET is like tofu… in a world where there are no cookbooks on how to prepare tofu. Theoretically, you can make good stuff with it, but nobody knows how it’s made or how to prepare it properly. There’s no good documentation. The kitchen is probably a wreck by the time it’s done, and the end product is kind of an unpalatable mess.

If you look online for .NET tutorials, you’ll only find those written by dispassionate Microsoft technical writers. I had a whole class where the best book the teacher could find was so bad for learning from that we were all over the Internet trying to find better tutorials.

We didn’t get anything done in that class.

I like to know what all the code in my project is doing. If I’m using it, I want to be able to read and understand either the code, or some reasonably thorough documentation. .NET doesn’t let me do that. When you have the IDE create a project, it makes a project directory full of dozens of files and folders which do weird mystery things. I don’t like that.

That’s why I don’t like .NET.

Objective-C

Don’t know much about this apart from that it’s used for iPhone apps. It’s some kind of C flavor, obviously.

OCaml

I’m pretty sure this is still a thing, but I have no clue what it’s used for. Comments?

Perl

A useful language that’s still an old hacker favorite. Used for basically the same things Python is used for now. They’re not the same language by any means; they carry different philosophies about how programming should be done in their language–but the most obvious difference between the two is that Python looks like English and Perl’s syntax looks like a cat walked across your keyboard.

This isn’t so much of a slight on Perl as it seems, really. Even Perl advocates admit that a given line of Perl code would make an acceptable name for a volcano in Iceland. It’s actually a mark of how good the language is that they use it anyway.

PHP

It’s popular to rag on PHP and promote JavaScript right now, but there are some nice frameworks written in PHP and it’s a decent back-end web language. It’s mostly used for server-side web scripting, but you can use it as a client-side/general programming language too. It’s often used in conjunction with a SQL flavor, such as MySQL or SQLite, in order to work with databases.

PowerShell

Windows’s pale imitation of a command line shell, not nearly as powerful as bash or the other *nix shells. You can write batch files, which are kind of like shell scripts but kind of not.

Python

A high-level scripting language with plenty of libraries and frameworks for nearly anything you want to do with it. There are a few things you can’t do with it, particularly optimization and it has limited options for making mobile apps (Kivy is still under pretty heavy development I think, and is kinda slow). Python is certainly not the fastest language, but it’s better than Java because it’s easier and cleaner to read, and is a lot of fun to work with.

R

An open-source language used mostly for scientific and statistical programming. I’ve heard of people using it alongside Python.

Ruby

If you don’t use Python, you probably use Ruby. They’re pretty similar. I haven’t done much with Ruby, just played around with the Codecademy tutorial a few years back.

Ruby is supposed to be more Lisp-like than Python, but that’s just what I’ve heard.

A lot of people use Ruby for Ruby on Rails, its web framework, which is supposed to be really nice and has a sizable open source community. I haven’t worked with it myself.

Scala

I don’t know much about this one, apart from that it’s kind of in the Lisp family tree and Wikipedia says it’s got some object-oriented stuff involved too. Comments?

Scratch

A teaching language. Like programming with Legos. It’s nonthreatening and cute, a good way to get kids into coding. You don’t actually have to write code, you just drag and drop lines and modify them with drop down boxes or whatever.

Simula and Smalltalk

Not the same language. They’re both early object-oriented languages I don’t know much about, and I’m not sure if they’re still in use. However, for their influence on many of the current main players, they get a mention on the list.

SQL

The infamously boring database manipulation language. Super useful though. Usually used in conjunction with another language, often PHP.

Vala

I’ve seen this used, but only in one place: the source code for Gnome Tetravex. It looks kind of cool.

Visual Basic

Started off its days as completely toxic to programmers, then grew up a bit. It’s dying a slow and horrible death right now as a generically yucky Visual Studio and .NET language. Sadly, I’ve taken two or three classes on it because it was what was available at the time; I think it’s the reason I didn’t hit larval stage earlier. I found it really boring to program in. You can make .NET stuff or, like, Windows XP-looking programs with it. Also, with this language, you’re inextricably bound to Windows. Just… yuck.

Advertisements

7 thoughts on “On Languages

  1. Parentheses in List are not that scary, actually.
    You get used to them pretty quickly. If you have not already and got some spare time, try reading SICP. It is pretty fun and mind-blowing… And it only looks scary. It uses the Scheme dialect of lisp.

    Like

  2. If you’re looking to learn Lisp, Clojure is pretty easy to start with. Try https://www.4clojure.com/problems to get a handle on functional programming. After you’ve got it down, I’d switch to Racket.

    OCaml is used heavily at Jane Street, and Microsoft’s F# apparently borrows from it heavily. In fact, a lot of newer languages borrow from some combination of OCaml, Haskell, and Smalltalk, including Ruby and Rust.

    Haskell’s syntax actually looks much less scary than plain C. At times it looks just like pseudocode. The scary part is the way people try to explain some of the language features. E.g., https://wiki.haskell.org/Monad

    You can still use Smalltalk; a couple of implementations are Squeak and Pharo. There’s a great ebook called Pharo By Example that walks you through several simple projects. Smalltalk is very interesting for the way the environment is actually part of the language… You have access to nearly everything, and everything can be changed.

    Assembly is still important, though less for development and more for reverse engineering. If you wanted to dissect a piece of malware for example, or even debug some closed-source software, you would need a decent grasp of assembly. It’s also helpful for understanding the machine’s architecture, which in turn helps you understand what your compiler is doing, which can be vital when you bump into weird problems/language features. I can’t imagine knowing C++ without knowing at least some x86 asm.

    Like

  3. I work as a Scala dev, it’s a nice language. Not really similar to Lisp, as far as I can tell, though I myself haven’t gotten around to learn Lisp either, so I wouldn’t really know.
    It is kind of functional, and also object oriented, which makes it somewhat weird but also very useful and flexible.
    Runs on the JVM, with all the advantages (bytecode compatibility with any existing Java stuff, which means lots of libraries) and disadvantages of this (not enough memory in the world). But all-in-all, it’s a really pleasant to use language, orders of magnitude better than Java (I loathe Java ).

    Like

  4. “I’ll kind of cover sed and awk under this umbrella. Quite frankly, they’re a pain to work with too, although they are powerful tools.”

    No disagreement from me about sed, but I’m a little surprised you call Awk “a pain”, too. Have you read The Awk Programming Language yet, and have you done the exercises? In it, the inventors of AWK (Aho, Kernighan, and Weinberger) use the language to write an assembler, a little database program, a little interpreter for a subset of AWK, and other fun projects. I would bet high odds that you’ll like it. Go figure!

    (On a tangent,”Any book written by Brian Kernighan” deserves to be a section of its own in your reading-list blog-post, in my opinion.)

    Like

    • I have not! Thank you for the recommendation, although it’ll be a while before I get to it. I want to write a forum this summer, and I also want to learn Clojure and possibly start on C, and then JavaScript and maybe Ruby are next on my list. I also don’t recommend anything I haven’t personally read at least partway through.

      18-year-old girl, remember? I can’t know everything. 😉

      Like

      • Well, writing a forum in AWK would definitely be a pain. And the things in The Awk Programming Language — the assembler, database and such — are more notable for their hack value than for getting useful things done. Writing a database in AWK is a bit like those projects where tinkerers build models of battleships out of matchboxes. Useless, but in a playful and fun way. And they teach you what you need to know to write the kind of things AWK is actually useful for. (Scripts between two and twenty lines for which Perl is overkill and shell not expressive enough.)

        Eigheen years? Mozart had twenty-five symphonies published by the time he was your age! What’s holding you back? 😛 (Seriously though: You’re an interesting, funny, and insightful writer. I really enjoy reading your blog.)

        Good luck with your forum, and happy Lithping with Clojure!

        Like

      • Nothing’s holding me back, just diverting my attention. I’m on my fifth novel (which my mom is growling at me to finish because she wants to read it), I draw pretty darn well, and last year I made a 10g aquarium into a little aquatic ecosystem in a box*–in addition to running a blog and learning programming and getting into college a year early. Mozart was more dedicated to one thing than I am. 🙂

        Hehe, but thank you a bunch for your compliments ^^;

        I don’t know Perl or awk, just bash and Python. This must give me terribly low status among script coders, even below my cat–he walked across the keyboard and hit enter and it ran fine. He won a Perl contest and gained Internet fame. Someone in Iceland wept at the beauty of his program, and named a volcano using the main body of its text. CS grad students wrote papers about it. I envy his ability.

        More seriously, I don’t actually write a lot of scripts. I only need them occasionally, probably because I don’t have to work with a ton of other people’s code yet. *shrug* Not that they aren’t valuable, though. Scripts run the world. 95% run web sites, 4% run obscure tasks for programmers, and 1% are for the highly important brace positioning wars. *mischievous smile*

        Ooh! Speaking of which, have you seen this? https://www.quora.com/What-are-some-smart-things-that-lazy-people-do/answer/Igor-Gois?srid=MMZ8
        It’s hilarious!

        ——-
        *Came in really handy with all this traveling I’ve been doing–I haven’t had time to clean it for months and all that happened was that I trimmed out about $20 in aquarium plants and a golf-ball-sized wad of cladophora algae last week; it had become a jungle, but the fish were fine. Aside from one platy having a panic attack when he got temporarily stuck, anyway.

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s