Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am coming from a php background with some python as well. I want to start working on a different language for both web and mobile development. I am also interested in real time apps dealing with games.

I am looking at node.js because I can use tools like titanium and/or phone gap to have my apps ported and compiled to native java code, or in a way that makes it runnable on mobile (web views). I like this path because I can use existing JS knowledge to build apps.

I am also looking at scala. I have done some C# as well as tinkered with Java about 5 years ago. And I do like that I can use scala to make native android apps. But unlike node/js which can be made to also work on other mobile os's, this only works on android. In a way, that doesn't really bother me. But scala seems like it would have much better performance for gaming that JS compiled to android. But I do not know how well.

Ine the end I want to focus on socket and REST based web apps for API's that users can have access to, as well as some mobile development. I want to get towards games and interactive apps.

The question is, what features of Scala would benefit me over the node/js side of things for making real time applications on web or mobile? I was looking at using frameworks like lift or play for web.

Node also makes real time easy with socket.io and node handles much of that in the background. This is why I think node could be a great choice. So I was hoping someone could give some insight on features in Node, that would have some benefit over scala. I don't really want to hear 'this is better cause its webscale or related things. I was hoping for more facts about features that would benefit what I want to do. I already understand why node is good. I just dont know much of anything about scala. Or how they may compare for what I want to accomplish.

share|improve this question
2  
Scala has plenty of issues on Android. It's not Java. –  Florian Margaine Apr 8 '13 at 16:55
1  
I don't understand the question. Is it "Should I develop a web application backed by nodeJs over a native scala application?"? –  Jean-Philippe Leclerc Apr 8 '13 at 19:42
    
im more curious about which one I would use over the other for a mobile real time app that also has web components. I am wondering why I would use scala over node. Example. I know node does very well for async programming, so then what features in scala would make that a better fit. Are scalas actors a better fit than the way node handles async communication? I dont know enough about scala. –  skift Apr 8 '13 at 19:57
1  
Node.js is single threaded, Scala isn't. –  Marco Apr 9 '13 at 21:09
    
very true, but node already has a history of performing very well for real time applications and when using sockets for browser to server communication. –  skift Apr 10 '13 at 1:29
show 2 more comments

2 Answers

I am looking at node.js because I can use tools like titanium and/or phone gap to have my apps ported and compiled to native java code, or in a way that makes it runnable on mobile (web views). I like this path because I can use existing JS knowledge to build apps.

Node is a server-side technology. You shouldn't let your app-language decide your server-side language. Yes, there are some "synergies" to having your front-end and back-end in the same language. But it's no silver bullet, and can cause more headaches than it solves. In fact, the majority of application writers explicitly choose not to do this.

So I was hoping someone could give some insight on features in Node, that would have some benefit over scala.

One reason NOT to use Node is that JavaScript has a lot of warts. (Search for "JavaScript WTF".). If you want JS on the server, prepared to become a JavaScript expert (especially the warts). Also consider CoffeeScript which is helps shave off a few of the warts, but is easily turned into JS. JavaScript is also a scripting language, so tends to be less efficient than Scala.

Scala uses the JVM, and the server-side JVM story is much more mature than Node. But Scala is probably harder to get started in. I don't know anything about writing apps in Scala, but I'd imagine that's very immature.

Don't think of the question as either-or. You'll be a better developer if you try implementing in both languages. The more languages you know, the better you will program in your favorite language.

share|improve this answer
    
At this point, I ended up staying with javascript. Although I did spend some time learning erlang for fun as well. Even though javascript does have it's warts, for what I want to do it also has many benefits. I am not choosing it because I can do js on front and back end, i understand the pros and cons of that. I am using JS because for what I want to do it fits well. One of which is JSON api's. Also reusing code for things like titanium with mobile development is a good plus as well. Even though I know some things can do a task better, JS is a great all arount platform at the moment. –  skift Sep 22 '13 at 21:30
    
If you go JS/node, you should look at meteor.com, my favorite framework on top of node. It's a bit immature, but it's the future of web frameworks. –  BraveNewCurrency Sep 23 '13 at 13:47
    
"You shouldn't let your app-language decide". –  Sean McSomething Sep 23 '13 at 16:07
    
@BraveNewCurrency Yea meteor is a great system, but I need to have consumable json REST api's, which meteor cant do last I looked. I am currently using sails.js –  skift Sep 23 '13 at 17:06
    
@SeanMcSomething i agree. I have decided to use javascript/node because I know javascript well. Since I originally asked this question I have had to use it extensively at work. And for me, there are a lot of great tools available. –  skift Sep 23 '13 at 17:06
add comment

I agree with all that @BraveNewCurrency said. I'd like to add some comments.

Personally, I'd use Scala in the server and CoffeeScript in the client, AFAIK Play allows to integrate them in the development (placement of the folders, etc.), CoffeeScript has the same interoperability of Javascript and a nicer syntax and Scala has the same maturity and library availability of Java, with a nicer syntax (and semantics?).

On the other hand, if you don't need the maturity and availability of libraries of Java then Node.js provides a uniform language for the development and you may be more confident with Javascript than Scala (and its ecosystem, like SBT or Maven, etc. when compared with npm, etc). It's not a silver bullet for the system, but it may be comfortable for the developer. That really depends on the person. Personally I prefer to have types in the server, they help to use code written by other people that may not be the most disciplined or best programmers in the world, which statistically should happen quite often.

To wrap it up, for the client it's either Javascript or Coffeescript. Scala wouldn't make much sense there, it's a no brainer.

In the server there are Node.js gurus doing impressive stuff, and it may be better suited for something quick (and "dirty") if your kung fu is strong enough. On the other hand Scala is going to allow better integration into something big (and "enterprisey") specially if you would like to collaborate with more people at some point. So that is more a matter of suitability for (a not yet specified) purpose and personal tastes.

share|improve this answer
    
I was never a big fan of coffee script. I would rather use the natrual language syntax and know what it is doing under the hood. I totally see why people like it though, So I cant knock it too much. I think its a great tool for many people. as for scala/java, I came to the conclusion that it would take me far longer to learn java well enough to do something than what it would take me to do in javascript now (or even php/python). I like strong typing too, but I like some of the benefits of weak typing as well. –  skift Sep 23 '13 at 17:11
    
Node is great for working with a lot of people, even if they are in enterprisey areas. But that also doesnt mean that node cant do enterprise level tasks. I know of one company locally that is starting to use node for all of their internal reporting, statistics, and customer/employee analytics and is working quite well for them. They use primarily Java for their applications. I doubt they will change that any time soon though. –  skift Sep 23 '13 at 17:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.