Hacker News new | past | comments | ask | show | jobs | submit login
Stack Overflow Scala Tutorial (stackoverflow.com)
143 points by timf on Sept 26, 2011 | hide | past | favorite | 25 comments



Will Scala make all of my dreams come true? I'm in the process of turning myself into a Ruby pro and was wondering if perhaps 2-3 years down the line Scala will be sexy and Ruby will be boring and I'll feel left out of all the fun ;)


To be honest I've never understood that, if you have an app to write, or a problem to solve, or users to help, how using one language over another can make that big a difference to one's overall job satisfaction (assuming of course that said language isn't actually painful to use). If Ruby makes you happy today it will go on making you happy in 2-3 years. Remember what Confucious said, if you chase two chickens they'll both get away.


To me it concerns such as: - how fast is it changing? Am I going to have to re-learn it every 6 months? - how good are extensions for this language? Will people still be supporting their gems (for example) 2-3 years down the line or will it be a wasteland of abandoned relics? - will a new language have significantly better native libraries that will allow me to do more straight out of the box? - will a new language allow me to do more in fewer lines of code, thus decreasing the amount of mistakes I make? - will there be tons of questions asked about this language so I can google for answers to my heart's content?


Why not just learn both of them? It would not hurt you to have more than one language you are good at, especially if they are very different from each other.


It's mostly a time investment issue for me, and I feel it's true for everybody else. We have only so much time available to learn new things (as opposed to writing production code), and so you want what you learn to pay off as much as possible long term.

You wouldn't argue "Why don't you just learn every language out there?", right?

The prob is that being a "pro" takes a really long time. For example to be a "C#" you need to really dive into the CLR and its internals, be familiar with all of the new features that's been added to .NET in the past years, get familiar with all of the tools out there (VS is basically a topic on its own) and then likely some related technologies like WPF / WCF depending on what you're writing. That's a LOT of learning and practicing for one language, and you probably don't want to throw all of that away long term.


Why not just learn both of them?

Because of Confucious.



Scala is slow to compile. This was exasperated for me by the fact that I had just finished spending 2 weeks working in Go (which compiles stupendously fast) before trying scala.

I don't understand people who can put themselves through that much pain. FSC doesn't come close to addressing it well enough. I think anyone who's used to the compile-free nature of dynamic languages is going to have a hard time with Scala until it's resolved.


Compiling speed is slightly improved in Scala 2.9. Using sbt will reduce the time too. It's not as fast as Go, though.


You make your choice and pay your price. Want a great type system? What code that runs really fast? Haskell and Scala are the only two choices that really fit the bill.


There are a number of other languages that fit the bill: F#, OCaml, and ATS, for starters. Shen (the newest version of Qi) was released last week so there's that too, if you're into Lisp.


In the enterprise, there are no other languages that fit the bill besides Scala. You underestimate just how much java code exists out there in any commercial bank, IB, big corp., yada yada. Its an order of magnitude more than your wildest imagination. Sad, but true. Now, how are you going to migrate all of that to Scala ? Easy - just do nothing for the legacy non-buggy stuff, write any new functionality in scala, and continue bugfixing legacy buggy java code in java. That's the only alternative. Not migrating to scala is gradually becoming a non-option. Too many advantages over java to even begin listing at this point.

Now if you are an MS shop, its a different story. And ofcourse none of this applies to startups, who can use pretty much whatever they want.


And OCaml (which compiles fast) and F#.


exacerbated


Scala provides two things: an expressive type system, and access to the JVM. The JVM is fast, and has a ton of libraries. If you write web apps that fit comfortably in one or two boxes you'll likely never need the speed. If you've never used a language with a modern type system it's well worth learning one, though Scala is not the simplest to pick up.


     If you write web apps that fit comfortably in
     one or two boxes you'll likely never need the speed.
This is hand-waving the fact that the JVM really is good only for server-side applications, and nothing more; mostly because bindings to native APIs are shunned by Java developers and because Java SE may be fast, but it starts slow and it consumes tons of RAM -- 16 years after Java was launched, 16 years of Moore's law, and Java apps still feel like crap.

It is kind of ironic that if you want to write well-behaved OS X, Gnome, KDE or Windows apps without dealing with Obj-C or C/C++, you're better off building on top of Ruby/MacRuby, Python or Mono/C#.


    > Java apps still feel like crap
fud, shit code feels slow in any language


So you're basically saying that all Java apps are made of shitty code?

Interesting.


i know you're trolling, but, i do speculate that java makes it difficult to write tight code.

[1] http://www.dustingetz.com/java-sucks-because-it-makes-functi... [2] http://www.dustingetz.com/java-sucks-2-the-java-api-is-state...


Ruby is a great language and ecosystem to be a Pro at. Get good at Ruby, then learn something like Scala/Erlang/Clojure. Scala and Ruby complement each other quite well, especially if you're using JRuby.


I'm curious, why exactly are languages such as Scala/Erlang/Clojure/Haskell often mentioned as the "end goal" of one's language journey? Is that because they generally allow you to do the most with the fewest lines of code?


I didn't mean it as an "end goal", just as languages which promote different paradigms versus Ruby (actors, functional programming, lisp-ness, etc). They also have different performance characteristics, if you need that sort of thing.


that info page assembled out of SO questions is pretty neat.


I've been asking questions about Elisp for a while, hoping to build up a body of work that I can reference. There's a whole bunch from anon that are from me before quit in frustration.

http://stackoverflow.com/questions/2170528/writing-hello-wor...

http://stackoverflow.com/questions/2260294/awk-print-2-1-in-...

http://stackoverflow.com/questions/1642184/extracting-urls-f...

http://stackoverflow.com/questions/2032503/getting-stock-pri...

http://stackoverflow.com/questions/1541682/lisp-script-to-pa...

http://stackoverflow.com/questions/2264286/generating-a-quiz...

http://stackoverflow.com/questions/2263983/processing-comman...

Now I'm back and still throwing out a few as I think of them.

http://stackoverflow.com/questions/6172054/how-can-i-random-...

http://stackoverflow.com/questions/4640040/how-can-i-generat...

Basically, the HN crowd could help make short work of building a great starting point for less popular topics like Elisp, Haskell, Scala, Scheme, CL, etc. One technique that is particularly useful is to solve small real-world problem.


I appreciate your effort. The questions are interesting, and it's educational to read through the answers since the problems are the right size, more than just "find the right Emacs library function" but short enough to read through in a few minutes.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: