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

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

Approximately 20-40x faster:
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

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

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

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.