Is this an appropriate occasion to use ruby on rails? - mysql

I want to create a RESTful API for a website which will collect/insert/delete data from a MySQL db. Would Ruby on Rails (RoR) be an appropriate place to do this?
I haven't used it before, and this is why I wanted to check to see if this is an appropriate occasion or not.

Is it just the API?
I would use Sinatra for that. It will give you more flexibility and speed than a RoR app.
http://www.sinatrarb.com/
You can read the book Service-Oriented Design with Ruby and Rails, by Paul Dix. It gives you good overview about this topic.

If your API will have only one or two resources and a few CRUD actions, it will be faster implemented in Sinatra, but if your API will have more than two different resources, I would definitely use Rails, because of its strict MVC model and because you can split your code into different controllers/models and so on.
Sinatra can do the same, but it's more work and Rails does already a lot of work for you. In Rails 3 for example it's one line, and your app will already respond to json or xml.

Related

Which technologies are advised to use for developing the following project?

Two years ago I developed an admin panel using winFroms that is used to configure different settings for specific users, create/remove users etc. This information is retrieved and saved to a SQL Database server.
I want to make this panel accessible through web browsers. I already have a REST API that will communicate with the database.
My question is: which technologies are the best to make this panel?
I've come across WebForms, MVC, HTML with Angular, jQuery etc., or with SPA.
I would appreciate it if someone can enlighten me with this matter. I know its not really a specific programmatic question, but there are so many different approaches that is difficult to find the right or best way.
I guess you already know a lot of .NET so if I was you I would just use a WebForms or MVC project and then call some jQuery on the api to handle the CRUD operations. But if you wanna try something completely new then use Angular.

Server Side Rendering/Templating

We are going to create some applications that will access the same api. We decided that the backed part will be developed in node.js and the database will be MySQL and maybe some parts mongoDB.
I have problem deciding about the front end of the web application that will be a website. Taking a look on this question: Separate REST JSON API server and client? we decided that fits better to us server side templating/rendering.
Do you think that using a PHP framework (like symfony, laravel etc) only for templating is good solution, or is it stupid to use a complete framework that offers a lot of features that we are not going to use only for templating? I was thinking to use twig that is only a template engine and try to fit backbone on it just to structure better the ajax calls to the RESTful API.
Do you have something different to suggest for server side rendering?
I have no experience at all, thats why i am writing to prevent taking bad decisions.
There are a bunch of awesome templating options for Node.JS! Here's a small list of some that I've used:
hogan (by twitter, feels like mustache)
jade (by tjholowaychuk, same code-machine behind express and a bunch of other awesome node projects)
ginger (by yours truly!)
swig (my personal favourite right now)
ejs (simple javascript-in-html thing, feels like php)
I like swig right now. It's basically what I wanted to build when I was working on ginger. It looks and feels a lot like django's templating system, which many popular template languages (twig, for example) have been inspired by.

Rails or node.js for Restful API

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.

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.