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.

Pitfalls in learning to program

Tim H. commented:

[…] do you have any advice based on personal experience from when you first started coding? Things to do (or avoid doing) or perhaps something that you know now that you wish you had known when you first started?

Oh, please. I wish I could say that I took all the right turns while learning–if I had, I’d be a much better coder than I am–but that’s not the case.

This is probably more than you bargained for, but here–you’re now the… third? commenter to get a full post in reply to a question.

Building on your own

The biggest thing is that building stuff outside the books and classes is the most important thing to do. I’ve been coding in some form or another since I was about twelve: RPG Maker XP at 12, basic web design at 13-14, VB at 15, Java at 16, and then I went to college–I didn’t choose all my tools, most of this is an expression of what classes/books/programs were available to me at the time. But I usually didn’t go out and build stuff with what I learned in my classes.

I did try to make some games with RPGXP, but I was pretty awful at it because I didn’t know Ruby (the game maker has a Scratch-like interface that generates syntax) and the English documentation was very lacking (I looked). And I put together a few web sites for my parents’ birthdays that… were actually pretty nice-looking, but never got published. I was kind of lukewarm about VB, and I had a hard time coding in Java on my own computer for some reason–something about NetBeans not wanting to work.

–Basically, I tended to use the stuff I self-taught (RPGXP and HTML/CSS) more than the stuff I learned in classes (VB and Java). I did have a class on HTML/CSS, but not before I self-taught it, which was good because the class was horribly outdated. That repeated itself with the Linux class–which was taught very well and was up to date, but didn’t teach me as much as I’d learned by tinkering.

School isn’t as useful as you think

This pattern has held consistently through college: I learn better, and learn more relevant stuff, by screwing around with stuff on my own than by sitting in a class.

What I learned in class: Flash, old Dreamweaver (which was as bad as Flash), VB, Java, pseudocode markup, flowcharts (as if I couldn’t make those before), Windows networking, shell scripting, C#, .NET programming (sort of–the class had serious technical difficulties)

What I’ve self-taught: RPGXP (sort of), HTML/CSS, Linux, Python, working with an API, and a tiny bit of FileZilla and phpMyAdmin for freelance web work. Plus all the stuff I read online about programming and startups and businesses and new technology and other awesomeness of that stripe.

What I’ve used: the second list (minus RPGXP really)

What I feel like I know well: the second list (minus RPGXP again)

I’ve long maintained that I’m going to college to get a degree (formal credentials) and to meet people. I’m much less there to learn, because if that were my only priority, I could accomplish it more cheaply and efficiently by sitting around in an ethnic restaurant of my choice with some books and my laptop every day.

Although, probably the teacher who’s taught me the most is Mr. Noord, because he rarely stays on topic for more than half an hour, and the stuff he ends up talking about tends to be more useful and interesting. Don’t tell the school board.

It’s totally different for networking students though. Then classes are way more worthwhile because the school has the hardware they need to work with, and networking is easier to teach in a class.

Programming is an art form that can’t be taught in a class. Programming is a separate skill from knowing the syntax of programming languages, which can be taught in classes. Knowing the syntax is like memorizing a French textbook. But to learn French, you have to speak it (write programs), listen to other people speak it (read programs), let them correct your speech (take criticism from older programmers), learn the current grammar and slang rules (style and best practices), and keep using your skills.

Classes just don’t usually let you mess around with stuff, and when they do, they put lots of restrictions in place: how long you get to work, how fast you have to work, what you can make, and what other things you have to do or write in order to discuss what you learned so someone can prove you learned it and somehow quantify what you did. It’s a real pain. And then you have to pay for them, instead of getting to spend the money on new books or tools or hardware.

I’m not saying that schools can’t be useful. They can be! They can teach the basics and introduce you to other programmers, and they introduce you to some great teachers and other students. They just won’t teach you the sort of skill that makes a great programmer.

Books are quite a bit better, but still watch out

Books still won’t get you all the way; you have to build on your own. But, at least for me, they’re definitely more productive than classes, in terms of learning a new technology or language.

Books tend to a) be cheaper, b) invite you to mess around freely and without restrictions on time or what you do with the example code or stuff like that, and c) let you choose your tools. When you buy a book, there aren’t required classes. You get to study what you want.

The tools you choose are important

The main reason I’ve never used VB or C# or Flash or the other stuff I took classes on isn’t necessarily because the teacher was bad or the curriculum was awful. On the contrary–I’ve had mostly great teachers.

But the technologies are pretty crap, to be honest.

If you’ve been around very long, you know about my burning hatred of Visual Studio. I didn’t always hate it so much. I used to be lukewarm towards it, back in the days I was using VS 2012 for my Visual Basic classes. We had technical difficulties with it even then, and it liked to crash and all sorts of crap, although nothing like the temper tantrums it’s thrown in my more recent classes.

But now that I know what programming is actually like, I look back on it and realize how boring and tedious it was. It sucked! No wonder I wanted to go into psychology instead. I thought coding was cool, but sometimes I wondered if I just thought the idea of coding was cool and I liked the romantic techie-nerd image it let me imagine, because what I was doing was not that much fun.

(Straight-up HTML and CSS isn’t very fun either, to be honest. Once you get good at it, both the novelty and the challenge kind of wear off. I’m looking forward to learning to code dynamic web pages, though.)

Java was okay, but we didn’t get very far into it, the coding examples were largely busywork, and it was really complex. I think we just got a bad textbook, honestly.

The books you choose are important

The difference between a bad textbook and a good textbook is like the difference between a bad teacher and a good teacher.

Here are the different kinds of books:

Diving Into ASP.NET, MVC, TLA, GPS, and SAT by J. Random Microserf

This will probably have some geometric feature on the cover. It’ll look deceptively shiny and colorful, but it’s as engaging a read as the Terms of Use agreement for the technology it’s purporting to teach. Said technology will of course be the kind that has a Terms of Use agreement, because these books are usually made in order to sell both the book and the IDE or language or whatever the book is about, plus all the attached certifications (which probably all have test prep books of their own).

They’re written by someone who probably does not like the technology they’re writing about, even if they say otherwise in the intro. This will translate into the writing, and you will end up not liking it either.

Generally, these books are best used as eBay fodder or, if the technology described therein has already flunked out (it will soon if it hasn’t), as expensive firewood.

Learn Foo in 24 Hours!!!!

You will not learn foo in 24 hours.

You may get a basic but deceptively broad understanding of foo. But you will not have learned foo.

This book is not quite firewood. It may be helpful, if not so in-depth.

Weird homebrew-looking e-book sold on Amazon

?????

Head First Foo

Made by O’Reilly. This will have a lot of pictures and silly jokes. They’re great for learning from if you need to get a complete understanding of a technology quickly, or if you’re a beginner and you’re kind of intimidated.

I lose patience with them, though, under two circumstances:

  1. I have something I want to build, and I don’t want to sift through 50 pages of pictures of tigers and pizza before I find the bit of information I’m looking for. What I need is not exactly a reference book; I just want the info in a more dense and organized form.
  2. I’m trying to read it as an ebook. They don’t translate well to the format. Don’t buy these as ebooks.

Notably, they’re bad reference books, as you might have gathered. Don’t get them for that either.

Making Stuff with Foo

This could be “Building Dynamic Websites with Django”, “Creating Apps with Kivy” (<3), et cetera.

It’ll contain something like this in the intro.

I’ve been using this technology for foo amount of time, and I think it’s a great tool for doing bar because of how it bazzes the quuxilators. I tried some other ways of doing bar and overall, I like this one the best because it’s well-designed and has great features.

Anyway, I thought a lot about how to write this book, and you might notice that the example code (which is on GitHub at [URL], by the way) is actually not a bunch of different projects–it’s just a couple projects, and we change them over the different chapters so you can see the development cycle better.

I really hope you have fun making stuff with foo using this book. If you find any errors along the way, send me an email at foo@gmail.com.

Not exactly, necessarily, but approximately that tone–you get the idea. The tone of the book will be friendly, but practical and not too goofy. These are great books!

It has a picture of an animal on the front?

That is probably an O’Reilly book. It is worth its weight in gold.

These are very often the “Making Stuff with Foo” variety.

If O’Reilly doesn’t make a book about a technology that is well known enough to have school classes taught on it for, say, a year… that technology may not be worth learning. Unless you can find someone else who wrote a good “Making Stuff with Foo” book about it, and then it might be okay.

Dry Internet documentation

For when you already know what you’re doing. Confusing, frustrating, and boring if you don’t. Buy a book.

Good Internet documentation

Save your bookmarks!

Make stuff. Solve problems. Meet other nerds. Eat cake. Browse GitHub. Play a board game. Tinker with stuff. Install Linux on something. Eat cake again. Hang with your nerd friends.

Have fun.

Happy hacking!

I found another useful trick in VirtualBox

You know how I love VMs because if it all goes pear-shaped, you can bomb the thing and make it over?

I found out how to make it even easier to revert changes by using snapshots. HowToGeek already covers this subject well, so I’m just going to link to them; this post is here as reference material for those of you who are following my site to learn about virtualization. As noted before, not all aspects of VMs and the software that builds them are obvious. I’m still exploring this technology, too; I’ve only been at it for a couple months maybe, so I haven’t discovered all the features yet, but I’ll update here when I find anything new.

Here’s HowToGeek’s article: http://www.howtogeek.com/150258/how-to-save-time-by-using-snapshots-in-virtualbox/