
Brand new Scala-lang.org - bad_user
http://scala-lang.org/
======
rtpg
Nice to see the language page be as easy on the eyes as the language itself.
There's almost no excuse not to use Scala if you're deploying on the JVM.

On a related note, does anyone else see the Scala logo and confuse it for a
symbol representing databases or hard disks? It just doesn't click with me

~~~
RyanZAG
_" There's almost no excuse not to use Scala if you're deploying on the JVM._"

There is one incredibly good reason - possibly the most important reason. How
easy is it to find a Scala developer if you need to expand your team compared
to a Java developer?

I'd put it the other way around: what excuse do you have for spending more per
developer? (There are some excuses here, but they're far from clear cut.)

In addition, Scala tends to run slower than Java which can have a further cost
if you're scaling to many servers. Porting Java code to Android is also far
easier than porting Scala code.

~~~
trailfox
I guess it depends on your team. We didn't have much trouble with Java guys
picking up Scala very quickly.

Scala performance is on par with Java if you keep your wits about you, but you
do have to be mindful of the code you write. Scala collections (esp. maps,
doubly so for immutable.Map, but also mutable.Map) are (currently) slower than
the standard Java collections, but it's easy to use an implicit conversion
wrapping a Java HashMap with little to no overhead in the very small number of
situations where this type of thing is a bottleneck. For comprehensions can
also cause some overhead, so if you're really pressed for performance a while
loops is always an option.

If anyone from typesafe/Scala is reading this: please bring the performance of
mutable.Map on par with java.util.HashMap

~~~
mark242
If map performance is really an issue for you, you should look into using the
parallel collections. For maps with less than 10k entries, I'm unable to see
any difference between the immutable/mutable and ju.HashMap collections. For
maps with >100k entries, it makes sense to farm out your iterating to multiple
threads.

~~~
trailfox
Put and lookup are much slower vs ju.HashMap. For most use cases where the
system is already multithreaded the parallel collections don't gain us
anything.

If you have a large read-only map being read by multiple threads (doing random
lookups) ju.HashMap leaves both mutable.Map and immutable.Map very far behind.
Scala is great, but the Map performance lags.

I'm not the only one who has noticed. Try googling "Scala map performance vs
Java"

~~~
orp
You should take a look at scala's OpenHashMap - a mutable hashmap in the scala
standard library that is often as fast as ju.HashMap. Link to scala doc:
[http://www.scala-
lang.org/api/current/index.html#scala.colle...](http://www.scala-
lang.org/api/current/index.html#scala.collection.mutable.OpenHashMap)

~~~
trailfox
I have used OpenHashMap, but the results are mixed sometimes is much faster,
other times it's much slower. It really depends on the use case.

------
girvo
I recently installed Scala. I'm a PHP Dev, who plays around with Clojure on
the side, but wants to be converted into the static typing camp. I also wanted
to keep things functional (hence my love of Clojure, and my PHP code keeps
things as immutable as possible), but also have a language that is usable if I
were to go and get another programming job.

Scala seemed a perfect fit. Until I looked at job boards for Brisbane :(

For those that use it regularly, what sort of things do you build in.it? I
really want to replace PHP with something, but between Enterprise Language
Java and just-as-dynamic-as-PHP Ruby and Python, Scala looks like the only
language that might fit... but then Play as a framework looked very heavy for
my usage.

~~~
bad_user
Play version 2.x is not heavy, being pretty modular and elegant. Give it a
try.

On the job boards problem - the funny thing in this industry is that you're
more likely to find jobs because you use a certain language that's not as
popular as Java or PHP.

It's a supply and demand issue. Yes, there are many jobs for Java and PHP. But
there are also many PHP and Java developers. And as a general rule of thumb,
for finding good jobs smart developers focus on skill-sets that are much
narrow and harder to practice than usage of a programming language.

Focus on scalability issues, on design, on social skills, on data analysis -
people that are good at such things are worth their weight in gold.

~~~
girvo
I just had a look at Scala jobs around Australia. $200k plus is the average
salary.

Time to start learning Scala properly, it seems. :|

------
justinmk
The sbt site ( [http://www.scala-sbt.org/](http://www.scala-sbt.org/) )is
still impenetrable to anyone trying to understand wtf it does in under 15
minutes. (Why do I need this? How is it different than the scala compiler? Is
it a package management system? Is it a REPL?)

~~~
bronxbomber92
The first words of the website: "sbt is a build tool". I couldn't understand
not grasping the benefits/differences of sbt in comparison to other build
tools, especially if you're new to the JVM world, but I don't think the
website leaves any doubt to what it is.

~~~
JonnieCache
Build tool is a very broad category though. It could be improved by drawing a
comparison, such as "sbt is a build tool, like make/bundler/whatever in scala"

Part of the problem is probably that sbt is basically every build tool
combined into one.

------
neya
The new homepage gives Scala a very classy feel! Nice!!

This comes as a (personal) advise to all my fellow startups here.

Dear dudes and dudettes,

I've been a long and hard fan of the 'Get shit done' mentality and I still am.
From my past experience running Rails and Scala, I'm going to tell you what
exactly you should do for your startup:

1) If you KNOW FOR SURE your startup will face a lot of page views, requests
etc. before hand (Example - Real estate portals like Airbnb, Trulia, etc),
then you should not make the serious mistake of ignoring high performance
frameworks beforehand. This could literally be anything, but the alternative I
_personally_ recommend is something Scala based [Read section 4 for WHY].

2) As usual, use Rails (or django/similar) ALWAYS to build your v1 prototype.
I say always because you will be incredibly surprised to see how much rails
gets stuff done for you. While this is a huge advantage initially, this can
also become a nightmare, later. Hence, I suggest you use rails only initially
and not forever.

When you build your app with rails initially, you're overcoming the most
irritating pain point (or I'm just too lazy) - Building the database. Building
the database with the required fields manually can be tiresome, if not
slightly dangerous (assuming you are inexperienced). So, I suggest you install
devise:

    
    
        gem install devise
    

And implement authentication through it. Why? Because Rails+Devise will create
some useful columns for you _auto-magically_ \- created_at, updated_at,
sign_in_count, etc. (to name a few).

3) Now, you NEED to understand what's happening underneath devise as this is
one of the core portions of your app. For this I suggest this rails cast:

[http://railscasts.com/episodes/250-authentication-from-
scrat...](http://railscasts.com/episodes/250-authentication-from-scratch)

Now that you understand how the most important part of your app works, you
should start to build a clone of your v1 on your desired high-performance
framework of choice. I use Scala personally (and I would recommend you too).

4) So, Why Scala?

#Scala has a decent minimal syntax compared to Java, PHP and the rest.

    
    
        Scala:
        def test = {"hello world"}
        
        PHP:
        <?php echo "hello world; ?>
    
        Java:
        class HelloWorldApp {
        public static void main(String[] args) {
        System.out.println("Hello World!");
        }
        }
        

# Generally, on an average, 1 line of Scala = 10 lines of Java. That's less
maintainable LOC (it can be argued otherwise, but just assume it's a good
thing)

# Performance. Now this is where Scala really shines. Scala's base performance
is almost near Java's in most real world scenarios. You get the benefit of
Java without actually using it. How fast is Scala in contrast to Ruby? Well:

1 JVM = 10 thins ("Rails is meant for a toy blog engine" \- Soundcloud)

Source: [http://www.slideshare.net/pcalcado/from-a-monolithic-ruby-
on...](http://www.slideshare.net/pcalcado/from-a-monolithic-ruby-on-rails-app-
to-the-jvm)

Approximately 20-40x faster:
[http://www.techempower.com/benchmarks/#section=data-r5](http://www.techempower.com/benchmarks/#section=data-r5)

#Inter-operability with JAVA. This is a HUGE plus. While everyone loves to
bash Java, you should not forget that it's a tried and battle-tested
enterprise backed language. It's horrible (arguable), but reliable. So, this
means, you can use that high performance image-processing function written in
Java you always wanted by calling it from within your scala code NORMALLY. Now
that's why I prefer Scala over newer languages like Go (It's really good, but
the library support is still growing). Don't under-estimate this use case.
Some secure functions used for authentication are available on various
implementations on the Java land, compared to Go, etc.

\---------

5) So if you use Scala, there's a lot of alternatives for frameworks out
there. The most popular ones are Play, Lift and Scalatra.

Play - Claims to be Rails like, but not even close to it. You need to work out
everything on your own. Some stuff is still buggy and some are still scary
(implementation of security functions). Stateless.

Scalatra - Sinatra for scala. Minimal, super-fast, awesome. (I personally
recommend this). Stateless.

Lift - Tried and battle tested, used in production by so many popular guys
(Foursquare for example). HUGE learning curve and too heavy for a framework. A
hell lot of stuff is done automatically for my taste (like generating it's own
login boxes with forgot password links, for example).

Performance comparison of all three frameworks here:

[http://www.techempower.com/benchmarks/#section=data-r5](http://www.techempower.com/benchmarks/#section=data-r5)

Note: Scalatra is the fastest (for most use cases) of them all.

6) Now, write a clone of your app in your framework of choice. Use the v1
Rails prototype initially to get your investors, clients, etc. But, by v2,
ship out the code on Scala. This means,

#Reduced costs (1 app server vs 10 app servers)

#More time to focus on business activities and a LOT more time before you need
to start worry about scaling (the framework)

Pls note: The above point isn't true if your app is db constrained.

Database suggestions:

Please ignore the noSQL hype. noSQL is DAMN GOOD for prototypes (use it for
your v1) and for specific production use-cases. 99% of the use cases are
covered by SQL. And the noSQL hipsters have created a terrible image for SQL
databases that they don't scale, etc. But it simply isn't really true. Even
something as basic as MYSQL scales pretty well. As documented by Quora's
founder here:

[http://www.quora.com/Quora-Infrastructure/Why-does-Quora-
use...](http://www.quora.com/Quora-Infrastructure/Why-does-Quora-use-MySQL-as-
the-data-store-instead-of-NoSQLs-such-as-Cassandra-MongoDB-or-CouchDB)

Also, noSQL isn't a golden solution:
[http://blog.engineering.kiip.me/post/20988881092/a-year-
with...](http://blog.engineering.kiip.me/post/20988881092/a-year-with-mongodb)

Some popular questions:

1) Scala engineers are difficult to find and hire

This is partially (in)correct. If you face issues with your Scala code OR if
your scala code is the bottleneck (highly unlikely), then you can always hire
a good Java developer and have that particular function/code module re-written
in JAVA. Java developers aren't difficult to find. Also, If you made the
transition from Ruby to Scala, so can anybody else.

2) The productivity gain vs Performance gain

If you write your app in rails, you get a lot of productivity benefits, at the
cost of performance. If you write your code in Scala, you lose your
productivity at the gain of extra performance. So which one should you choose?

There is no doubt that Rails scales really well. But, out of the box, it is
slow. Imagine it this way:

There are two ways to make a sculpture - Using plastic (Rails) and using metal
(Scala/Go/etc). Sculpting a metallic structure is hard (ignore molding
techniques). Sculpting plastic is easy.

But if you stress the plastic sculpture, it simply breaks out. There are lots
of commercially available metallic coatings for your plastic sculpture that
will promise you of no breakage etc. (SOA, Scalable PaaS like Heroku, etc.)

But they are expensive, and they don't eliminate your pain points as promised.
At some point you or an engineer is going to worry about the code. Better be
it you and now than someone else, later.

It is important you understand what goes under a framework's Magic (like
authentication, database calls, etc) than just blindly believe it to be magic.
This will not only make you a better developer, it will also help you from
being taken advantage of by your outsourced companies or your engineers.

\--------

I just poured out everything from a personal stand point. Frameworks are a
matter of personal choice - You choose whatever that resonates with your
philosophy. So, at the end of the day, be sure to go with whatever makes you
happy (and confident).

All the best.

~~~
eranation
Great write up!

One small picky thing:

> Scala: def test = {"hello world"}

Can be actually

    
    
       def test = "hello world"
    

:)

p.s. you can play with Scala code live in the browser here:

[http://scalatutorials.com/tour/](http://scalatutorials.com/tour/) (work in
progress)

~~~
dxbydt
To get parity with his PHP & Java snippets, you probably want one of several
variants below -

    
    
        scala> def test1 = println ("hello world")
        scala> def test2(f: =>Unit) = println ("hello world")
        scala> def test3(f:Unit) = println ("hello world")
        scala> test1
        hello world
        scala> test2()
        hello world
        scala> test3()
        hello world
        scala> val t = test2 _
        scala> t apply Unit
        hello world
        scala> t()
        hello world
        scala> t(())
        hello world
    

I will leave it as an exercise to the reader to distinguish between these
thunks :)

~~~
eranation
:)

See also this question: [http://stackoverflow.com/questions/8303817/nine-ways-
to-defi...](http://stackoverflow.com/questions/8303817/nine-ways-to-define-a-
method-in-scala)

It can go quite crazy on function definition styles:

    
    
        val add:(Int,Int)=>Int = _ + _ 
    

(from
[http://scalatutorials.com/tour/12_tour_of_scala_anonymous_fu...](http://scalatutorials.com/tour/12_tour_of_scala_anonymous_functions_2.html))

------
z0r
The page loads quite slowly on my macbook air. I wonder how many 'reactive'
Scala web technologies went into the creation of it!

Scala is wonderful and all the hard work put into it is greatly appreciated.
However, every Typesafe product targeting the web that I've tried has given my
browser indigestion.

~~~
bru
> The page loads quite slowly on my macbook air

The 3771 DOM elements composing the front page may be the cause.

------
chaffneue
It's quite a pretty site, but the home page loads very slowly on my quad core
I5. Something about this page is hanging up the dom onload event pretty
significantly - Network tab showing about 7 seconds. Got a screenshot of the
network tab here:
[http://farm4.staticflickr.com/3769/9399721127_a63086e535_o.j...](http://farm4.staticflickr.com/3769/9399721127_a63086e535_o.jpg)

Luckily the api docs and tutorials are unaffected and load quite quickly.

------
adam_lowe
Beautiful. Glad to see another open source project with a solid site.

------
cyberroadie
The staircase in the picture down the page is mirrored compared to the Scala
logo. I've added some css to 'correct' this ;-) Pull request here:
[https://github.com/scala/scala-lang/pull/75](https://github.com/scala/scala-
lang/pull/75)

------
kushti
Play Framework is as good for v1 prototype as RoR/Django/Grails/PHP
frameworks. But it's better in the whole project development process as you
can easy go from v1 to v2 with it )

------
zoowar
Very nice, but this still sucks ass => [http://www.scala-
lang.org/api/current/#package](http://www.scala-lang.org/api/current/#package)

------
TylerE
Anyone else find this hard to read? The light blue/cyan is about 3 shades
lighter than ideal. Especially for links.

------
andyhmltn
I've always been intrigued by Scala as everyone says it's super fast but I was
put off by the fact it had 'Java' in the description. But, looking through the
new site (looks brilliant!) I think I'll take a look as it's got a nice syntax
:-)

------
seanmcdirmid
The ribbon as a brand logo is still not working for me. In its red colored
form, it has an ugly faux 3D shine applied to it. In it's flat form, it is
just a bunch of white waves, hardly recognizable or interesting.

------
gus_massa
The page is nice! But it doesn't have snippets. They are very useful to get
the feeling of the language at a glance.

------
ragatskynet
Scala took the hipster way. I hope it will catch some new peoples attention
because it is a lovely language.

------
dksidana
Summary:

Object Oriented Programming: Everything is an object

Function Programming: Everything is a function

Scala: Everything is a function and an object both

------
disputin
Very nice, except for the typesafe blue that crept in at the bottom. That site
needs an overhaul.

------
ericax
It's beautiful! The original one is good enough, this is even better.

Good job!

------
poweribo
great design but some text are hard to read. dark color or dark background and
no scrollbar on chrome.

