Hacker News new | comments | show | ask | jobs | submit login
Ask HN: what language should I learn next?
14 points by jon_dahl on July 17, 2008 | hide | past | web | favorite | 58 comments
I'm a Ruby developer, and cut my teeth on Ruby/Rails after a bit of PHP. I love Ruby and will continue to use it at my day job. But I'm starting a side project and want to learn something new. What should I try?

I've always wanted to get better at C and Lisp, but building a database-backed web app in either of these seems like a lot of work. How is Weblocks? Any other worthwhile web frameworks for Lisp?

What about Java, or a JVM language like Scala or Clojure?

I'm enjoying Clojure - in terms of web frameworks there's Webjure and Enclojure, for example. The latter seems more Rails-ish whereas the former is more Javaesque, but it's still pretty early days. I prefer Clojure to Common Lisp as it doesn't have a lot of the cruft you'll find in CL, it has some cool concurrency features, and you get easy access to any Java library you might want to use. Plus, the source code to the language itself and its supporting libraries is very readable and hackable, which is something I haven't found in other languages.

I can't really recommend web programming with C, although it's a wonderful language to learn; I'm sure you'll have many revelatory moments as you get to grips with it and discover things about the higher level languages that you normally use.

Common Lisp is definitely usable for web development, and Hunchentoot is a pretty decent web server and programming environment, although it's certainly not the only one.

My personal opinion is that one should learn, and become comfortable in, Java before attempting Clojure. Clojure is a very neat little language, but if you don't understand what it's doing under the hood on the JVM, a lot of stuff is going to end up being mysterious.

Don't get me wrong, I love the language to bits, but a lot of its beauty is in how it takes the existing Java model and does something cool with it - and to understand that, you need to understand what it's working with.

Interesting. That's the exact same argument I made above with C and systems programming. Clojure has caught my eye, and I'm familiar with Java, but I'm not as familiar with the JVM itself. Any resources that are good overviews of the JVM?

Well, if you want to carry the analogy further, to know Java is to know the basics of how the JVM looks at life. The JVM has concepts of class, inheritance, methods, instances, constructors, and garbage collection baked into it, and they have the same semantics as Java. Arguably, the only difference is one of coding: the JVM codes a Java method as a series of stack-based opcodes, and a class as a set of methods with attributes, but the basic operations are the same. JVM bytecode directly encodes all basic operations: "invoke method X on this class", "declare this method as public and static" - even "if an exception occurs between <this instruction> and <that instruction>, jump <here> to handle it".

By contrast, there's a level of indirection between Clojure and the underlying JVM. And so, for much the same reasons as it's a good idea to know some C when doing systems programming, you won't really understand what Clojure is doing (especially not the stack-traces!) unless you understand Java.

There's also the practical point that, if you're working on the JVM, you'll be wanting to make use of the massive class libraries available for it. They're all written for native Java, so you'll have to be familiar with Java semantics to use them effectively. (Although the Lispy macro goodness means you can then wrap them up inside a concise functional abstraction when you're using them).

If you still want to look at the JVM (for fun, or for implementation reasons), I'd say a good knowledge of Java is enough to just jump head-first into the specification: http://java.sun.com/docs/books/jvms/second_edition/html/VMSp...

Just want to second this. I just read much of the spec this summer, and was surprised how directly the byte codes corresponded to Java semantics.

Lisp really is THE language to learn. You can ask Paul Graham about it...

See the following link for how to write new language constructs, which cannot be done in most of the other languages.


OCaml. If you've been working with languages dynamically typed at runtime, using something statically typed at compile time will be very informative. Unlike most other statically typed languages, OCaml's type inference turns the type system from a thing that needs to be constantly appeased to a free reality check when you need it.

OCaml will also teach you functional programming tricks usable in Ruby, or several other languages. At the same time, it doesn't force you to learn almost everything all over again before you can do anything at all the way Haskell does. In my experience, OCaml is designed to be a practical, modern, statically-typed, multi-paradigm language, while Haskell is designed to be a conceptually pure language for experimenting with language ideas in new territories. Whether that's a good or bad thing depends on what you intend to use it for.

About the OCaml type system: http://enfranchisedmind.com/blog/2008/04/14/useful-things-ab...

"Why Rubyists Should Learn OCaml" (a presentation): http://enfranchisedmind.com/blog/2008/07/07/rubymn-presentat...

Thanks - OCaml looks interesting, and would be a little further from Ruby than Lisp because of its static typing, right?

Any frameworks (or good libraries) for web apps? I enjoy digging into languages on their own, but I also want to get things done, which is usually easier with decent libraries for data persistence and user interface.

Some type terminology:

Statically typed: This variable will always hold a 16-bit int. vs. Dynamically typed: The value in this variable happens to be a 16-bit int right now.

Strongly typed: This is a 16-bit int, nothing else. vs. Weakly typed: This is bits in memory, we could try using it as a number. (Things like: "the" * 3 probably result in "thethethe" or a crash, rather than a warning or error from the compiler/interpreter.)

(Warning -- there are disagreements about subtleties in these definitions, much like what "Object-Oriented" actually means. I'm trying to summarize things enough to be useful here.)

Lisp is strongly, dynamically typed by default, e.g., the value in a variable is definitely a specific type, but could be replaced with a completely different thing. The type is associated with the value, not its container. (You can declare something to be only a specific type for optimization, though, and some of the better compilers also try to infer types, I think.)

C is strongly, statically typed, but the type system is full of holes, since you can recast anything as a void ptr and then something else. The type system is there for efficiency's sake, but it's easy to lie to, and it crashes hard if you aren't careful.

OCaml doesn't let you do this; it also automatically infers the types of things based on their usage, and gives you an error when it's ambiguous. If you want to do something that could take an int or a string, you would use a union type, e.g. " type int_or_string = I of int | S of string " and handle either possibility.

As for web apps, I don't have much experience there yet, sorry.

If you want to learn a new language and a new framework, you should try Seaside. It is a very interesting approach to web development.

In case you aren't familiar with Seaside, the underlying language is Smalltalk.

...which is a really cool language, and has a much more conceptually elegant implementation of OO than the C++/Java-style, I think.

Anyone want to contrast OCaml with Scala?

Scala is also multi-paradigm and has type inferencing. What would the differences be (to someone learning Scala, but no experience with OCaml)?

I'm a big OCaml fan, but heck if I've had a chance to use it yet.

If Microsoft can keep F# "pure" OCaml it has a great shot at winning the scaling wars. Stuff like workflows and monads are still messing with my head, though.

Perhaps you are asking the wrong question here. Instead of learning a new programming language for web apps, maybe you ought to try programming a type of application that is new for you. I think that taking a go at something like a client-server, embedded, mobile, or desktop application would help broaden your perspective and abilities more than simply learning a new language would.

Yep. I would learn Objective C and write an iPhone app.

Or I would say to heck with it and learn Lisp.

Why focus on a pragmatic language for web apps? You've got that already.

Great advice, ricree and m_fish. I think this is right on. That's why I don't want to learn Python - it looks like a great language, but I already have Ruby. I've been trying C and Scheme on the side, but through reading (SICP and K&R), and I've kind of hit a wall. I really want to put something into production that isn't written in Ruby, and an iPhone app would do the trick.

If reading SICP or K&R doesn't fire you up to write code, reading, say the Armstrong erlang book or the haskell books (intros by Hutton, Hudak,) won't do it. I think most of these languages, you can look in delicious and see everything that's been tagged on erlang, haskell, scala, factor, whatever, in the last week, what they're being used for, gauge quality/depth of toolset (emacs/textmate support, debuggers, unit test/BDD, profilers, etc), get ideas there.

great thread BTW , mazeltov

Well, learning C will help with the Obj-C side. If you want to learn iPhone programming (I'm picking it up myself, but I have a C background), there are several meetups in Silicon Valley.

What wall, out of curiosity, are you hitting with C?

Understanding the development cycle of an application. I can fire up vi and complete exercises, or build an artificial tool, but that only takes one so far.

Upmodded, but I feel compelled to add systems programming, which will probably mean C. After doing some lower-level systems programming where the whole point is managing resources, you'll gain an appreciation of the power languages like Ruby give you, and how much a web application framework abstracts away.

There's more to software besides the web. Start off by learning C. Learn enough so that you could understand this http://www.kegel.com/c10k.html - and see the implications of what's discussed there (low-level UNIX system calls, C code) on issues you deal with.

Finish learning C, by writing your own C compiler. Yes, really: pick up the dragon book, learn lexx/yacc and do it - it will test your knowledge of data structures and algorithms, automata/language theory and software engineering.

Learn Lisp or OCaml or Haskell just to know a functional language. Don't learn it to write webapps in it.

Learn Perl - and not just for webapps (although mod_perl is incredibly powerful as far as fast, transactional, web applications go), including Object Oriented Perl. Learn enough to automate your systems administration / operations tasks (being able to modify bugzilla would be a plus too).

I second Perl. You can learn enough Perl in a week to write neato sed/grep/awk type programs and shell script tupe stuff to outfit your command line however you like. Also... it's a good investment because your tools will run on any platform. You can soak up a measure of Unix culture as you go and you'll pick up a swiss-army-chainsaw that you can use when your usual dev tools don't cut it.

Going up to the next level in Perl has a larger learning curve than you might expect... but the "low hanging fruit" are very easy to get the hang of.

If I had the time, I would pick up C. I've spent a number of years working with higher level languages like Java and Python, and while they're good and fun and all that, I feel knowing a low level language like C is important to be an effective (insert any computer related task/job).

I personally am really interested in learning C and then figuring out how to tie my C code into a Python module - maybe increase the speed of some of my code...

That said, I had used some Scheme back in school to write a parser for a stripped down version of C, and while it wasn't the most fun project ever, working with a functional programming language really opened my eyes (up until then it has been OOP/Java all the way).

It's probably not worth learning another language for a web development project. You'll spend most of the time learning the syntax and the framework. Nothing which will expand your mind.

Try a functional language like Haskell, Erlang or ML. But you really need a problem to work on. A database-backed web app can easily be written in Ruby, but maybe there is a feature which requires background processing, write that in the newly learnt language.

BTW, how is your javascript?

"but maybe there is a feature which requires background processing, write that in the newly learnt language."

great advice.

Agree and a standard project to do in Erlang seems to be a webserver which will also increase your understanding of webprogramming in general.

If you want to stay on the OO path, I would suggest Smalltalk (Squeak), or the simple but powerful Io programming language (http://iolanguage.com/).

C is also an important language to learn if you don't know it already. You could use it to implement a simple database for a very specific task (http://cr.yp.to/cdb.html)

Languages every programmer should at least have some understanding of:

Lisp - because it's lisp, duh Smalltalk - to actually understand OO Prolog - it requires a completely different thought process, for better or worse Haskell - for understanding useful type systems and functional programming C - because it as low-level as you should ever need

Just my 2 cents

How about Italian? In terms of computer stuff... C is always a good one. Erlang is something kind of "new" and different, but at the same time quite practical for certain kinds of applications. Java's not a bad language to know, but it's not that exciting.

IO (iolanguage.com) is very cool. The Qi layer over CL (lambdassociates.org) is also worth looking at. q/kdb+ (kx.com) is very interesting, but needs a more complete toolset for a commercial product.

What if your language was nothing but macros? Factor (factorcode.org) is a fascinating example of this, and I think due in part to the project developers and the language paradigm itself, I've never seen any open project language take huge leaps in capability in such a short amount of time as as Factor has. Incredible stuff, but difficult to get into unless you can devote a large amount of contiguous time to it.

When it comes to Lisp, I don't know why it's dismissed just because there's always something wrong with one of the open projects. Just buy Allegro CL - there's something to be said for products which hold up against commercial rigor.

One addition: everybody should probably be learning Erlang.

Concurrency and parallelism is hot these days and functional languages are superior there. Learning a different type of language will widen your horizons and once you know one functional and one OO-language then it is quite easy to learn other languages after that.

My suggestions are Clojure and Erlang. Both are made for cincurrency, have web frameworks(maybe not as good ones at rails though) and are functional. Both also run on a VM.

Learning CLojure will also expose you to JAVA and the JVM.

I am in the process of learning OCaml and Haskell. If I can use them in production, great. If not, I'll still learn things I can apply to my Python work.

It is not difficult to build a database-based webapp using Common Lisp. Hunchentoot, CLSQL and something to generate HTML (CL-WHO and HTML Template are both good).

Clojure is really interesting, and may be my new favorite language. Parallelism is one of those things in programming that is rarely trivial in most languages. Clojure makes a lot of parallel problems easy and it has access to all of Java's libraries.

This is going to be unpopular advice, but I would suggest algorithms in C. You already know how to make web applications. Any reason you want to know how to make web applications again? Will Lisp or C web applications make you happier or more productive?

What will help you is probably a better understanding of algorithms/programming and I personally like C for that job. C doesn't hide stuff like higher-level languages do. It makes you think about how the computer processes the information and uses memory. I'm not suggesting that you ever use C for one of your webapps. I'm suggesting that knowing C and good algorithms will make you a better programmer in higher level languages because you will understand more.

Python because it is

1. easy to learn,

2. has lots of libraries,

3. is anointed by Google,

4. is anointed by Peter Norvig (http://www.norvig.com/python-lisp.html) .

Or go to Erlang. It's concurrency model is untouched. You'll be programming in Erlang someday.

I'm not sure you really need to "learn" another language, if you can program in one you can probably get by in another quite easily given a bit of practice and some documentation.

I think it would probably be worth learning new algorithms or trying to tackle problems which are totally out of your area of expertise if you really want to learn something new.

If you really want to learn a new language you could look at VHDL, and start designing some hardware! I did this myself as part of my research degree and its quite interesting to program code that gets implemented on hardware.

if you can program in one you can probably get by in another quite easily

Yes and no. That holds true within families - if you know an imperative language, you can pick up any other imperative language easily enough, it's just different keywords and syntax for the same thing. But if you learn a different kind of language - e.g. functional, then you first have to learn a new way to think, and that's where the value is.

As an example, f you want to, you can easily treat Python as a sort of super-shell-script. So it's easy to get into, but most of its power will be wasted. To get the most out of it, you have to learn to think "Pythonically" and that takes time and experience using it to solve real problems, and constant rewriting until you "get it".

Just to throw my two cents into the mix, some of the best computer fun I've had in recent weeks has involved playing with Processing.


As somebody who normally does a lot of Ruby, PHP, Javascript web consulting working dealing mostly with data and database stuff, it's been fun to stretch my mind and play around with a much more visual programming environment.

I think your next step should be a couple of static languages. Try C first (and object-c) and create a iPhone app, perhaps. Then try Java. I know, it is not popular around here, but it is good knowing one of the most used languages in the world.

With Java you can do server side programming, or even better do some mobile programmin (J2ME app for a phone, or an Android app).

How about Chinese? Probably more useful.

But seriously, python is well regarded and with G App Engine as a possible hosting platform using it, you can also learn more about design for hosted infrastructure apps.

I played around with Scala and thought it was really interesting.

Hindi! Everything will eventually be outsourced to india, anyway.

Seriously though... Python is probably the best option, followed closely by Java.

I guess humor (even when mixed with serious contributions) is down modded at HN.

Hindi! Everything will eventually be outsourced to india, anyway.

Please keep this kind of thing off HN.

It was a joke. Soon after followed by a serious comment.

I would agree with what you said, had the comment been completely devoid of content, but as it is, I think you're being way too harsh.

The funny thing is that once I considered learning Chinese because, at the time, I was in the middle of a hardware project where we had to deal with motherboard and other component suppliers located in China and our communications were constantly breaking down because we couldn't agree on a common subset of English.

So, if you really have to spend time with people who don't speak your first (or second, or third) language, it's always a good idea to invest some time learning their first one.

And it also shows you care.

Exactly. For maximum outsourcing utility you should learn Kannada or Tamil instead.

No Perl fans here?

Shame. :(

I, then, humbly suggest Perl. You might like it, and with your Ruby background it shouldn't be hard to pick up.

Try learning to write mobile code in Sleep. Its like Perl with anonymous functions all over the place.


Actually, its my language. Couldn't resist the opportunity to plug it.

I'd recommend Python, so that you can play with Djgano.



"who has a month to spare to learn another language?"

I don't agree, but this shouldn't be downmodded either.

I definitely don't have a month free to learn a language. But I have a few hours a week free, and I'm not in a hurry. :)


haskell without a doubt

haskell is on the edge of almost every interesting trend in programming tools.

parallelism? check STM? check closures? haskell is closures functional programming? better than any other lang continuation style? check type inference? check good library support? check (kinda) repl? check etc etc

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact