Ask HN: what language should I learn next?
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?
62 comments
[ 2.5 ms ] story [ 94.5 ms ] threadSeriously though... Python is probably the best option, followed closely by Java.
Please keep this kind of thing off HN.
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.
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.
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...
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.
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.
Scala is also multi-paradigm and has type inferencing. What would the differences be (to someone learning Scala, but no experience with OCaml)?
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.
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.
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.
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...
See the following link for how to write new language constructs, which cannot be done in most of the other languages.
http://nostoc.stanford.edu/Docs/livetutorials/macros.html
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 thread BTW , mazeltov
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)
Shame. :(
I, then, humbly suggest Perl. You might like it, and with your Ruby background it shouldn't be hard to pick up.
http://sleep.dashnine.org/
Actually, its my language. Couldn't resist the opportunity to plug it.
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.
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".
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. :)
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.
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
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
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.
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?
great advice.
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.
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).
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.
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).