

Ask HN: what language should I learn next? - jon_dahl

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?<p>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?<p>What about Java, or a JVM language like Scala or Clojure?
======
pmjordan
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.

~~~
meredydd
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.

~~~
scott_s
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?

~~~
meredydd
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...](http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html)

~~~
jimbokun
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.

------
silentbicycle
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...](http://enfranchisedmind.com/blog/2008/04/14/useful-things-about-static-
typing/)

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

~~~
jon_dahl
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.

~~~
richcollins
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.

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

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

------
ricree
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.

~~~
mechanical_fish
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.

~~~
jon_dahl
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.

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

~~~
jon_dahl
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.

------
strlen
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).

~~~
learninglisp
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.

------
rmanocha
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).

------
vikram
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?

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

great advice.

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

------
richcollins
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>)

------
wilkes
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

------
davidw
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.

------
jksmith
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.

------
schtog
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.

------
Zak
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.

------
gaius
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.

------
giardini
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.

------
mdasen
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.

------
kenver
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.

~~~
gaius
_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".

------
CPops
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.

<http://processing.org/>

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.

------
ardit33
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).

------
ccwu
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.

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

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

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

~~~
j2d2
_Hindi! Everything will eventually be outsourced to india, anyway._

Please keep this kind of thing off HN.

~~~
PieSquared
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.

------
manny
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.

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

<http://sleep.dashnine.org/>

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

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

------
noodle
python

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

~~~
jon_dahl
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. :)

------
brlewis
BRL

------
breck
French.

------
cypress-hill
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

