Ask HN: Convince My Friend To Learn Ruby, Not Java, As A 1st Language

5 points by jasondrowley ↗ HN
A bit about my friend: He's absurdly good at chess, has a BA in English from the University of Chicago, and really, really wants to learn to code.

I'm a PHP and JQuery guy myself (in the process of learning "real" JavaScript), so other than making some blunt generalizations about Java programmers vis-a-vis Ruby programmers, I'm not of much help.

Some things he'll want to know: Which is easier to learn? What're the employment prospects for skilled developers using Ruby vs. Java? If he decides that Ruby isn't for him, how easy would it be for him to learn Java's syntax with some Ruby under his belt, and vice versa? If not Ruby or Java, than what other languages should he pursue learning? (I recommend JS, but he knows I'm biased.)

Anyways, after a few weeks of talking with him about learning to program, my friend seems pretty dedicated. He's willing to put in a lot of time into this. Any resources you can post for a newbie programmer would also be much appreciated.

Thanks, HN!

15 comments

[ 0.28 ms ] story [ 44.2 ms ] thread
Tell him to learn both but Ruby first. When you start programming, you're learning as much about the environment (OS, files, network) as you are the language. Ruby will help keep that simple.

Then, Java will give exposure to a "harder" language with an enormous ecosystem, plus the JVM itself.

Knowing both Ruby and Java should make him eminently employable.

I suppose everyone has their different motivations, but for me, programming was always about building stuff. I was more passionate about creating things than the tools that I used in that process. Personally, I would have a hard time pushing myself if the motivation was for nothing more than learning a skill for improving my job prospects.

You are not the same person as your friend. Your interests are different. Your friend should let his gut lead him. There are many different areas of specialty in which a coder could go and the tools for each are different. For example, you wouldn't use the same tools to hack on the Linux kernel as you would if you were doing web development.

Don't try to convince your friend of anything. Just let him pave his own way.

What does he want to make? This should be the primary deciding factor every time "what language should I learn" comes up. Java is particularly suitable for writing simple GUI applications and mobile apps. (Android or J2ME) Ruby seems to be more useful than Java if you're interested in writing web applications. Both are fine if he just wants to write command-line apps, but Java's speed will pay off if those command-line apps are doing serious number crunching.

Have him give Processing (http://processing.org/) a spin- Processing is 99% Java, but you can start writing loops, conditionals and functions without learning what a class is. It's very easy to work your way up from Processing to full-on Java.

See, I don't know what he wants to build. He's still figuring that out.

I recommended Ruby because I think he's going to end up working on web apps and the like. I also think he's inclined to get involved with the startup scene, where I know Ruby is very popular (esp. among those shops which aren't going the "pure" HTML5 route of HTML, JS, CSS, etc.)

Suggest Python... it has the benefits of both.. You can get Ruby-like efficiency in web development, and you can build robust desktop apps using WxWidgets and other similar gui libraries. An added bonus over Ruby, it's readable ;-)

Of course, I'm biased...

The funny thing is, I encouraged him to learn Python first, precisely because of its efficiency and flexibility, etc. I pointed him toward "Learning Python", the absolutely massive book from O'Rielly, and Learn Code The Hard Way for Python.

I have no Ruby or Python experience, but my friend claims Java is easier to learn... At least from his perspective.

Basically, I tried to convince him to learn Python before compromising on Ruby. If you could make a convincing case for him to learn Python instead of either Ruby or Java, I'd be much obliged.

Note: I suggested he learn Python or Ruby because I think he's going to end up in the startup scene, where those are the de rigueur languages (alongside the HTML5 family of markup/programming languages).

I suggest Learn Code the Hard Way by Zed A. Shaw (http://learncodethehardway.org/). It's online, it's free and it's brilliant. I'd suggest him to go with Python as his first language.

If he wants to be a good programmer, he should be able to pick up languages rather quickly after he learns his first one. So switching language is not an issue. Keep in mind though, learning the first one will take some time.

Yeah, this is a great option. In fact, run the full gauntlet. Zed mentioned in the blog that you could start out with Python, hit the SQL and Regex books and then move to C. By this time he might have the objective C book done and you could hit that one also. At this point you pretty much know what you need to know for building both web and mobile apps.
I'm not sure easy to learn needs to be your first criteria. My list goes something like this...

1. Best tool for the job. This is heavily weighted towards what I already know if my familiar tools are good enough but not otherwise my first choice.

2. This could be a subset of #1, but library availability could be a deciding factor.

3. Availability of documentation. A lot of comfort comes from finding those gold mines of great documentation. I would argue that Ruby (and community projects built in Ruby) has been the weakest among the top web programming languages for documentation, but this is just a "shoot from the hip" feeling.

Perhaps your real battle is finding better learning materials than that of what your friend has found? Also, even if a language is difficult to learn, with good documentation and daily practice, then level of difficulty shouldn't be an issue. The bottom line is that your friend will have to put in X number of hours to get experience no matter what path he chooses. For example, given a year of sustained effort, your friend might have been further with Ruby than he would have been with Java, but not by much. He would have a good amount of knowledge either way.

Javascript might be another interesting option. If you are doing web development, then you have to learn it eventually. You can do front end and back end. However, Node for the back end probably isn't the best way to go for beginners because of point #3.

Another consideration might be the path to landing a job. I started out with freelancing and PHP has been good because the market for it is huge. However, much of that market is CMS related (Wordpress, Drupal, etc) rather than building apps from scratch.

I would recommend Racket as a first language. It's tiny, can do a bunch of things, and has a reasonable intro to programming book here: http://www.htdp.org/2003-09-26/.

If he passes on that, Lua would be a good option. It has all of the goodies we'd expect with JS or Python (other than being the only language you can run in someone else's browser), but lacks a great deal of bloat, unintuitive scoping rules, and gotchas associated with weak typing/falsiness/that's-a-unicode-when-i-wanted-a-str.

Above all else, though, he should probably pick something other than Java.

My rationale here is that Racket or Lua will make it easy for him to learn programming because the language will be so simple as to require almost no time to learn. Then, ideally, he can use his established knowledge of programming with whatever other language he likes. Learning some larger language like Python or Ruby first would be more difficult, but is not a bad idea. Learning Java first will be even more difficult and may cause long-term damage depending on the amount of OOP koolaid he ingests.

Can I ask a really dumb question? (I myself have only been programming for about 9 months, so take this into account.)

>>Learning Java first will be even more difficult and may cause long-term damage depending on the amount of OOP koolaid he ingests.

What kind of long-term damage are you talking about? Are you saying there's anything wrong with OOP as a paradigm, or something wrong with Java w/r/t OOP? Or am I missing your point entirely?

OOP is a good idea some of the time, and Java's OOP is good enough a lot of the time. The problem I have with Java is that the programmer must use OOP in all sorts of situations in which it isn't really the right thing to do to make up for deficiencies in the language. Particularly, the language does not have first-class functions or closures, and the boilerplate necessary to fake these features is so big that I would seriously consider solving a problem in a worse way.

The danger is that a person may think that the way things must be done in Java is actually a worthwhile way of doing things in general. Such a person would be in a state of permanent confusion in which the meaning of the question "How will I solve the problem?" has become "How will I partition the behaviors and data involved in a solution to the problem?" This second question is a good thing to think about, but not before the first one, and certainly not instead of the first one.

I don't think it was a dumb question. I didn't actually encounter any people like this for a long time.

I wouldn't suggest anyone learn Ruby as a 1st language. I say this from a readability standpoint. I'd recommend python as a 1st language. My second recommendation is .NET / C#. You get the most bang for you buck. (WinForms / Silverlight / ASP.NET)

I know everyone is over hyped on open source xy or z but in reality these require a good knowledge of a lot of various pieces of technology.

ruby is a decent language, but it's not a good first language. a first language should really be simple, not have too many constructs and avoid special cases entirely. ruby is definitely not minimal, and it does have some special cases that change it's behavior. That's not to say that java's a particularly great first language; it avoids syntactical inconsistencies entirely, but has no fewer special cases than ruby in how it works.

I'm not a big java hater, but it's community and tools kind of suck. java projects seem to all be made in monolithic IDEs and built with monolithic build tools that are customized with an XML file. the java community isn't as open as other communities; in ruby and JavaScript and python and especially Haskell, there is a great community who is very willing to help and provide free tools for anyone to use. java just isn't like this.

I think Haskell is a great first language pedogogically, people who start with it don't have the same difficulties as those who convert, and it really helps to teach a lot of advanced ideas more easily.

however, getting a job with Haskell isn't as practical. if he wants to make a startup then Haskell is great. otherwise he should consider learning clojure or python.