Rails or node.js for Restful API - mysql

I have an existing website written in ASP.net, I have recently switched to Mac full time (With Windows in Boot Camp), and need to write a public API for accessing my website's MySQL data. I primarily want to use the API to allow building an iOS application.
I am interested in learning either Ruby on Rails or Node.js, I haven't used either of them yet.
Which language would be better for me to learn?

Rails is a relatively mature web framework based in Ruby and is designed for handling object-mapped data persistence in a relational database backend.
Node.js is much newer on the scene, and unlike Rails, is a more bare-bones package that allows for server-side Javascript applications thanks to a pretty tight HTTP(S) API. Node applications are by nature event-driven, which may or may not be ideal for your application.
Since it seems that you'll need data-persistence (you mentioned accessing MySQL data...), Rails might be easier to get started with, as it comes packaged with all the things you need in this respect and is designed to facilitate this sort of application.
If you you don't really need relational data persistence, Node is probably a better bet as it stays out of your way and lets you decide how to handle things. It's important to note that Node is a much more bare-bones "framework" than Rails -- if you want something slightly higher-level but still lighter than Rails that runs on Node, express is good place to start.
Still, if you want to try Node (I will confess: it's a lot of fun!), it's totally possible to access MySQL in a nice, event-driven (non-blocking) way. Here are two modules that will be helpful:
node-dbslayer
node-mysql

Neither is a language; they're frameworks. There is no "better", there may be a "more suitable" (probably not in this case).
Which would you prefer to develop in, Ruby (Rails), or JavaScript (node.js)?
Would you like to transfer that knowledge to a different job without rampup time (Rails)?
Would you like to learn something a bit more esoteric, event-driven (node.js)? (Ruby has Event Machine, but IMO node.js takes it a bit further.)

So this new application is just a middle man between your ASP.NET thing and your other clients.
In that case, totally use node. Node is great at being networking glue. Node scales great with IO bound applications (i.e. being a network middleman).
If you're going to use node then you probably want to look at express to make it easier.

Related

application design: Scala + HTML5

I'd like to implement an application with Scala and HTML5. My idea was to create a "local" client-server architecture: Scala handles the calculations and generates HTML5 as a GUI.
To my mind there are two possibilities
Use a Java/Scala framework that allows embedded HTML5. SWT for example has a browser widget. JavaFX seems good, too.
Distribute the program with a server and run it in a browser on localhost.
It would probably be most convenient to require an internet connection and forget about the localhost. Unfortunately an offline mode is necessary.
Now I would like to know how to get this right:
The first option seems easier to implement but I wonder: How can I communicate with Javascript without the HTTP protocol ?
The second approach was just an idea. Have you ever done something like this ?
If you've got advice or know a good framework please go ahead.
UPDATE :
I've just had an interesting idea: Could I use nodejs to create something like a server-server architecture ?
Right now the communication between Scala and Coffescript seems like the most problematic part. I still wonder how I could initiate an update from the Scala side of the application. A HTTP Request is a nice way to exchange data. Sadly to my knowledge in "standard" Coffeescript there would be no event hook to listen to server-side HTTP messages.
I've thought about using nodejs to listen to the server-sent data. Is this a good idea ?
With regards to the second option, you may wish to investigate the Play! Framework or Lift. They automate a lot of the work required to make a web application in Scala, including handling AJAX requests.
Although I haven't tried packaging either for local use, there was an earlier Stack Exchange question about packaging Lift which might be relevant. It should be possible with Play! as well.

So I am looking for a good framework for my next web project

I don't like django. The forms, the url schemes, the way they assume everyone use models on schemaful db (I prefer to use mongodb because it's so clean and easy).
I am pretty much fluent in all the major languages. I do prefer python because it's very clean but also strict (aka function signatures requires you to pass in only X variables etc).
I want something developed and mature - this means that stuff like authentication, registration etc should all be developed and ready to use.
Any suggestions?
TLDR: Need new web dev framework. Requirement: Nothing. Preference: Mongodb, python.
By the way forgot to mention that I might be looking for employment in the web dev industry. So if you can recommend something that is common among big companies that would also be a bonus. like scala's lift for foursquare (if I am not wrong) and php for facebook.
Rails. It works with MongoDB via Mongoid and has many authentication solutions. You'll find Ruby very comfortable if you have Python experience.
I'm using Flask for Python, and I love it. I'm using SQLAlchemy for Postgre, but it's super minimalistic, so you can use it with whatever you'd like. I've also heard really good things about Pylons, but don't have any experience with it myself.
Spring Framework. (Java)
For authentication you can use Spring Security
It seems like you aren't very keen on using Java, but if you don't mind a different language on the JVM I'd suggest taking a look at Compojure, a web framework for Clojure. It isn't a scripting language but can offer close to the same development speeds once you get used to 'the-lisp-way' of doing things.
I'm unaware of a fully featured MongoDB interface specifically for Clojure, but CongoMongo and Adia (I can't include more than the one link currently so you'll need to google them yourself, sorry!) might have (atleast part of) what you're looking for. If nothing else, you could probably just use an existing Java library to access MongoDB or use a different database. Give Compojure a try though, its definitely productive!
Also on a completely unrelated note, this happens to be my first answer on SO, so please be gentle with the downvotes :)
Pylons.
It will be very fitting for you
Im a big believer in grails. Built on best of breed technologies like Spring and Hibernate, you can fall back to java if you have too. Takes all the pain out of more traditional Java EE development. Has all the important functionality as plugins, you have access to Spring Security, JMS, everything you need. Is very convenient as the back end to a RIA, easily render you models as json, easily handle xml. Its great.
EDIT -- to address the comment, Grails uses the Groovy language, which is scriptable and has some very groovy features. And it is easy to learn if you are familiar with java. Has closures, lots of syntactic sugar.
The scripting part is actually quite invaluable -- you write groovy scripts and import your grails classes to whip up functionality to augment your app (like quick queries into your db)

Which technologies are commonly used by developers to quickly build websites?

I'm an experienced C/C++/C#/Objective-C desktop,web, and mobile programmer and I've become accustomed to building most of my software from scratch. I've built all my websites from the ground up using ASP.NET. I have quite a few ideas for websites that I'd like to test and I'd like to increase the rate at which I can actually build a website. I'm sure I'm unaware of many of the technologies that are commonly used for building out ideas quickly. About a year back, I looked into using the popular CMS called Drupal to see if it would help me speed up development. After two weeks of trying to decipher the structure of the Drupal CMS, along with trying to learn PHP, I found the learning curve to be steep enough to convince me that it would just be faster if I built my website yet again from scratch using ASP.NET MVC. I'm wondering if anyone could suggest any other technologies that are designed for programmers to build websites quicker than my current method of building them from scratch using ASP.NET MVC.
Secondly, I've been hearing many entrepreneurs mention Ruby on Rails is what they use to speed up the development of their ideas, so I'm planning to investigate it. Why do I hear more about Ruby on Rails than any other technology? Would you suggest using it to speed up development?
Thanks in advance for all your wisdom!
I've tried out Ruby on Rails, Django (the Python equivalent of Ruby on Rails) and Drupal. Drupal is nice if you're just acting as a sysadmin: install the modules you want and use it as-is. But PHP as a programming language is so annoying that I'd hate to use it for something serious.
Django has some odd quirks but seems to work well. From an MVC perspective, Django calls views "templates" and calls controllers "views", which is ugly. Also, instead of generating default URL -> controller/action mappings for you the way that Rails does, Django set up routing files by hand before things work. You also have to set up some DJANGO environment variables if you want to run other helper Python code with access to your model objects. Rails also creates and configures a sqlite database by default so that you can start right away, but with Django you have to set it up yourself.
Rails seems to "just work" in so many ways that I highly recommend it. Ruby is also a pleasant language to work in. Try the simple startup to see what I mean:
rails foo # Create the foo webapp
cd foo
script/server
Then browse to http://localhost:3000 to try things out. That page will give you some info about your webapp and point you to the next steps.
Use an ORM for the data layer. That will increase the speed.
Also reuse common code elements from your previous projects.
And still, for any more or less different site you would need to do some work. Cannot avoid that. ASP.NET MVC is quite powerful tool, especially because it's backed up by the rich .NET class library. At least this framework doesn't build you obstacles at any step along the way, which is quite an accomplishment.
Django is a framework for database-driven web pages in Python.
I agree with your assessment. I was rather proficient in C/C++/C# and never built a website before. I looked at a couple of things, but when I started working with ASP.NET MVC2, I loved it. Another method/architecture I like but haven't messed too much with is WPF. If you download Microsoft Expression Blend 4 there's a 60 day trial and it's really nice. A lot of clicking and less typing. :) Hope this helps.
I toyed with the Zend PHP Framework a bit, and found it to be pretty good. You mentioned that the learning curve for Drupal/PHP didn't make it worthwhile to pursue, but if you retained any of the PHP you learned from that, this might go a bit quicker. To read more you can check out "10 Compelling Reasons to Use Zend Framework". Zend might not exactly be "configure and you're done," but since I usually work with Enterprise Java, I found it pretty reasonable in the speed-to-set-up department.

fastest public web app framework for quick DB apps?

I'd like to pick up a new tech for my toolbox - something for rapid prototyping of web apps. Brief requirements:
public access (not hosted on my machine) - like Google's appengine, etc
no tricky configuration necessary to build a simple web app host
DB access (small storage provided) including some kind of SQLish query language
easy front end HTML templating
ability to access as a JSON service
C# or Java,PHP or Python - or a fun new language to learn is OK
free!
An example app, very simple: render an AJAXy editable (add/delete/edit/drag) list of rich-data list items via some template language, so I can quickly mock up a UI for a client. ie. I can do most of the work client-side, but need convenient back end to handle the permanent storage. (In fact I suppose it doesn't even need HTML templating if I can directly access a DB via AJAX calls.)
I realize this is a bit vague but am wondering if anyone has recommendations. A Rails host might be best for this (but probably not free) or maybe App Engine, or some other choice I'm not aware of? I've been doing everything with heavyweight servers (ASP.NET etc) for so long that I'm just not up on the latest...
Thanks - I'll follow up on comments if this isn't clear enough :)
C# or Java,PHP or Python - or a fun new language to learn is OK
How 'bout Javascript? This place hosts server-side Javascript ticking most of your other boxes. So you can use the same language for client- and server-side stuff (which I find very handy). [Caveat: I only played with their service; seemed cool though. I use Javascript on the server-side on IIS and on Tomcat (via Rhino).]
For something bleeding edge - A new version of spring roo was released recently. With it you can create a great web app in 10 minutes. Supports GAE and GWT...
http://www.springsource.org/roo
xataface is a quick way to make a front end for a MySQL database.
It makes it easy to start an app quickly with dynamically created views and then you can change it to something very customized to your needs.
It simply needs a server service with MySQL and PHP.

What platform should you use to build your first web application?

I'm deciding between LAMP and Google App Engine with Python. Mainly this is an educational experience so I'm weighing the potential ease/quickness of developing on App Engine against the value in learning LAMP from the get go (and not being locked into the App Engine way of doing things
It depends on where you come from. If you're already familiar with either PHP or Python, I'd let my choice depend on that.
If you're starting from scratch, there's a few things to consider :
PHP (if you consider the P in LAMP to be that) has the advantage that there is a huge amount of web applications/sites out there that use it. If you're aim is to be able to modify or contribute to lots of other webapps, I think you should go with PHP. On the other hand PHP is easy to mess up and it is hard to cleanly seperate webdesign and code. PHP has no real application outside of web development that I am aware of (I may be wrong).
Python is a real sweet language with a clean syntax and a lot of (third party) libraries. Python has lots of applications outside of web development.
Google App Engine allows for a clean MVC approach in conjunction with Django (among others). A MVC approach allows to cleanly seperate HTML/CSS/Javascript layout stuff and Python Code.
If you master GAE/Python, it's a small step to go to Django, running on (Linux|Windows)/(Apache|Ningx)/(MySQL|several OtherDB's).