Feature differentiation: Rails / Django - ruby-on-rails

Are there any important features in Rails or Django which do not exist in the other framework?
Is there anything important missing - for an enterprise web app - in either one?
This question is not intended to be argumentative - I am trying to make an informed technology decison for an upcoming project. Two of the concerns I have, with regard to choosing one of these frameworks, are:
Integration with external systems (Java, .Net, SAP, etc)
Reporting - would there be any difficulties producing sophisticated reports/charts (financial) using either framework. This would require multi-table joins, custom sorting, pagination (w/ajax) and printing for different devices.

Django on Jython is running nicely so Java integration shouldn't be a problem.
In terms of integration in general don't forget that Django is also Python so you have the massive support of the standard library plus all the other mature well supported Python projects out there. Integrating 3rd party Python code into Django projects is usually trivial.
At the risk of getting evangelical I would list the following Django killer features:
The admin
The documentation
Python ;-)

Django also has GeoDjango. The NY Times chose Django over Ruby for their Represent project for easy mapping support:
"We built Represent with Django, the Python web framework. Although we do most of our work with Ruby on Rails, we chose Django for this project so we could use GeoDjango, an add-on that supports geometry fields and extends the ORM to allow spatial queries."

My experience/opinion is that Rails is much more flexible and has a more diverse ecosystem and is developing faster while Django is more stable, slower changing, better documented.
Rails has a huge advantage for integration with other systems via JRuby. You can give rails access to the entire Java ecosystem and run it on the JVM.
Django might be able to take advantage of .Net via IronPython (I don't know anything about this other than that IronPython exists - while IronRuby is only on the way but not here yet)

Related

Node.js as Rails replacement? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Could node.js replace Ruby on Rails completely in the future?
I'm doing bad in understanding the sense of node.js. I understand what it does regarding IO etc., but is it for example a Ruby on Rails replacement? Can I do the same database operations etc.? What about authentication?
what kind of web or other applications get build on basis of node.js?
is it for example a ruby on rails replacement?
IMHO RoR has much longer history/experience/functionality for website development. Node.js itself is a lightweight (low level) framework from which you can take off to build various types of server-side applications (not just web oriented). One of its main advantages is in wide spectrum of modules provided by community of open source developers.
Can i do the same database operations etc.?
Yes, just find the right module for your type of database.
What about authentication?
Modules like connect offers built-in authentication functionality.
Node.js is a totally separate technology to Ruby on Rails, built on a different technology stack. In its current state it's not a replacement for Rails, and certainly not a drop-in replacement
AIUI Node.js is a bit more low-level than that, in particular it has no support for typical high level web development (MVC model, db integration, etc). Look at it as a javascripty basis to write networking software on (including web frameworks).
There are some web frameworks out there built on Node.js. The only one I know is geddy.
Node.JS is to Javascript as EventMachine is to Ruby (and Twisted to Python). It's something completely different from Rails.
To illustrate: the Thin webserver that is often used to serve Rails application was built using EventMachine. So you would need a complete web framework on top of Node.JS to make it a Rails replacement.
You are comparing apples and pears.
Ruby on Rails is a MVC Framework to build websites.
Nodejs is a framework to build evented I/O operations.
You can build a port of RoR on top of nodejs if you want.

mono or RoR for new application run on linux?

I have little experience with ruby itself. I am going to hire somebody to write a web based application and I wanted it to be written in RoR but I was recommend mono. I guess because they like mono and because they think the RoR is slow.
The whole application would be some kind of social media meta management tool. There will be front end web based part and then back end doing the 'real stuff'.
I have no experience with mono at all and I am not experienced enough to comfortably say that RoR is the best choice.
I understood that if RoR is configured properly it could be pretty fast. I read that RoR has some troubles with scalability. I will start the application small and if it's successful I need to scale it up.
What would you recommend?
in the light of
performance
scalability
easiness to test
easiness to maintain, develop code/project
( I like ruby but I am not going to be the developer myself. I prefer to choose the 'better' option if there is such answer to that question)
please feel free to suggest anything else ...
If you are not going to write it yourself, you may want to go with what the person who will write it is most comfortable with.
Full disclosure: I have developed several sites now using Mono and I love it. I have used Ruby-on-Rails but not for anything nearly as big as what I have done in Mono. Keep that in mind.
Quick answer: In the greater scheme of things, Ruby-on-Rails and ASP.NET MVC have more in common than not. My choice would be ASP.NET MVC on Mono but I doubt you would regret choosing either.
Architecture: If you want one way of doing it out of the box, choose Ruby-on-Rails. If you want to be able to choose what you feel are the best-of-the-best technologies from a range of choices, choose .NET (Mono).
Ruby-on-Rails is more of a turn-key solution in that it provides a standard way of doing pretty much everything you need out of the box. .NET (Mono) offers a lot more power (my opinion let's say) but there are a lot of different pieces to choose from and you have to choose a technology stack yourself. As an example, RoR has a standard way of accessing databases while .NET Mono let/force you to choose from a dozen different ways to do that.
Mono and .NET generally have a little better separation of concerns so the purist in you might like that. If not, you actually find the roll-up-your sleeves and get it done attitude of Ruby more to your liking.
Performance and Scalability: This should clearly go to .NET and Mono. In fact, I believe the fastest way to run Ruby-on-Rails is to use IronRuby to run it on .NET. StackOverflow is written in ASP.NET MVC and, given the amount of traffic, it obviously performs great. Proof is in the pudding. That said, the performance bottleneck will probably not be your choice of framework.
Testing: Old style ASP.NET (now called WebForms) is considered pretty hard to test. The newer ASP.NET MVC was designed to be easy to test and is similar to RoR. One major factor is that in Mono you will probably be using a statically typed language (like C#) while Ruby is of course a dynamically typed language. You have to write more tests in a dynamic language (because the compiler/interpreter will not catch type problems) but it can also be easier to write tests if you are not fighting the compiler. I think it is a matter of taste and style (I like static) but this is a major factor in answering this question.
Of course, since .NET/Mono is a multi-language platform, you could always write your ASP.NET MVC tests in a dynamic language. You could even do it in Ruby (IronRuby). Perhaps that would be the best of both worlds (static checking on your real code and flexible dynamism in your tests). I have considered doing this myself using IronPython for tests.
Maintenance and development: This is a tough one. It depends what you are writing, what third-party libraries you might need, and what tools you are going to use. I would say that RoR is probably the more advanced MVC framework. My own thoughts are that Ruby-on-Rails is probably a shade easier to write but a little bit harder to maintain.
Community: I like the Ruby community more than the .NET one but I think I like the Mono one the best. That makes it a little confusing. The core Mono guys (like Michael Hutchinson that answered here) are simply awesome. I really like MonoDevelop as a tool (IDE) as well. It just keeps getting better and better. Michael, thank you for Git support if you had anything to do with that. :-)
Tools: If you are writing for Mono you can use the whole universe of .NET tools (VisualStudio, ReSharper, Reflector, etc) so that is pretty hard to beat. That is assuming you develop on Windows of course. On Linux or Mac the tool of choice for Mono would be MonoDevelop. It supports version control, a software debugger, and NUnit tests right in the IDE and is completely cross-platform.
It seems like a lot of Ruby folks just use a simple text editor. This may just be because an IDE just does not have as much to offer a dynamic language as it does a static one. Here is a SO question on what people like for Ruby:
What Ruby IDE do you prefer?
EDIT: Just to make things confusing...there is another MVC framework for .NET/Mono that is even more like Ruby-on-Rails; MonoRail even has an implementation of ActiveRecord. MonoRail has actually been around longer than ASP.NET MVC but I would stick with ASP.NET MVC these days as that is where the future lies. ASP.NET MVC is open source by the way and ships with Mono out of the box (the actual Microsoft code).
I can speak more to Rails than Mono. RoR is pretty scalable these days with all of the cloud hosting services available. Web applications query data and render web pages using that data, which really isn't that big of a deal. Most performance issues are caused by database and schema design issues, not the web framework. Typically, database response times dwarf other portions of server processing. RoR is also very easy to test. Testing is a more natural part of development than in other languages that I use. When I started RoR programming I was used to the much more structured world of Java, and the more dynamic Rails won me over for web development.
Firstly, I work on MonoDevelop, a crossplatform IDE for Mono (including ASP.NET & ASP.NET MVC), so feel free to consider my answer biased, but hopefully it will be helpful anyway.
Performance: a decent JIT compiler (Mono) should be much faster than an interpreter (Ruby). But it depends on the programmer's skill too - well-written Ruby could be faster than really badly written C#. The libraries and database and caching mechanisms you use will be a big factor too, but these aren't fundamental to the languages/frameworks.
Scalability: AFAIK there is no magic bullet for web app scalability, and although I don't have practical experience in this field, here's some info I've picked up. It really depends on your database usage, how your session state is stored, and how caching is implemented. This isn't really fundamental to either framework - once you start scaling to multiple machines, you'll probably have many machines/processes for database servers, cache servers, message queues, frontends, servers for static content, etc. Likely only the frontends will be ASP.NET or ROR, and if they're stateless, you can simply clone them and handle the scalability problems on the backend.
Testing: I can't speak for Ruby, but ASP.NET MVC (but not vanilla ASP.NET) was designed to be easily testable using .NET testing tools such as NUnit (Mono's own unit tests use NUnit).
Maintenance and development: Again, I can't really speak for Ruby, but it's pretty much a given that it will be easiest to develop (at least initially) in the language & framework that the developer already has experience with. Also, .NET has some amazing development tools on Windows - Visual Studio, ReSharper, etc. - and there's a huge pool of experienced C# and ASP.NET developers you can hire, though few of them will know Linux/Mono.
Also, StackOverflow uses ASP.NET MVC :)
To introduce a little levity...
How about DOS on Dope: the last MVC web framework you will ever need?
There are of course a dizzying array of choices but another nice alternative is Django.
It is basically Ruby-on-Rails for Python so most of the comparisons of RoR vs. ASP.NET MVC would apply. Depending on what kind of site you are building, the really interesting feature of Django is the automatic admin interface.
If you need to be up and running quickly, I would go for RoR. Scaling rails is becoming easier with time and you have a big range of ruby runtime environments to choose from MRI 1.8, 1.9, REE 1.8, JRuby (run on java VM), Rubinius.
ASP.NET MVC is nice, but I still think it has some way to go before it offers the same speed of development as RoR.

ASP MVC vs Ruby on Rails

Which are the similar features and differences between ASP MVC and RubyonRails?
They are similar not only in that they follow the MVC pattern but also in how they do it. There are many points very similar, but there are a lot of differences too.
From a purely subjective way I can say that Ruby on Rails is much more mature and there are lot's of things to easy the task of building a web site. I moved from ASP.NET MVC to Ruby on Rails and this is the list of advantages I've seen (some of them really subjective):
Due to running on Linux servers:
Servers are cheaper.
Configuration is re-usable, we can re-build a server in 30 minutes. Puppet.
There are more than 10000 libraries, called gems, all installable and updatable in the same simple way. http://rubygems.org/
Several re-usable authentication systems, including the one I've wrote; ubiquitous_user + rails_openid.
Migrations. This is very important!
Unit testing of models with a real live database. It works beautiful.
Functional testing of controllers with very powerful assertion systems.
Platform independence. You use Windows, I use Mac.
ActiveRecord (better than EF or any other ORM out there I've seen). Degrades gracefully allowing you to add more pieces of SQL until you write all in SQL. You'll love it.
Command line tools are easier to install and maintain updated (think ssh, sftp/scp to copy and synchronize files, lame, sox, etc).
Passing data from the controllers to the views is not a pain in the ass because Ruby is dynamic and C#/ASP.NET MVC isn't.
Nice libraries for geolocation.
Nice integration with Sphinx.
Community #ruby and #rubyonrails in FreeNode (bigger than ##csharp y ##asp.net).
Concatenate all stylesheets and javascripts in two files.
Timestamp all files, by default.
Environments: different settings for development, testing and production (no more web.config madness). More environment possible.
Deployment with capistriano. Deploy with one command, everything; very repeatable and can be rolled back easily; takes care of database migrations; can deal with deploying to various servers or set of servers at once (if you have more than one front-end or you have production and staging respectively).
MySQL natively. Has clustering capabilities which might come handy (I already used them, to have read-only mirrors)
Routing is more powerful, RESTful built in, trivial to use. Namespaces, sub-resources and many other features.
No need to compile, very nice when deploying to the server.
Various implementations: JRuby in Java, it might be faster, work on Java servers like tomcat. Rubinious, Ruby with JIT compiler.
Heroku: an app server, like google apps, but for Ruby on Rails. Might be a good resource or not. They escale quite well.
Very nice tools to analyze source code and find potential problems. A small example: http://getcaliper.com/caliper/project?repo=git://github.com/pupeno/ubiquitous_user.git
TDD is not only possible, it's easy. Mix of dynamic language with amazing testing framework.
Much better linking methods
Very nice form generator: formtastic. Can generate a form in one line.
Scaffolding.
Admin tools.
A sane translation system, gettext.
Similarities are primarily related to design decisions (the decision to use MVC patterns, etc.). Differences include the languages (Ruby vs. C# / VB), the development environments (Windows vs Multi-Platform), and the tools. Ultimately the similarities and differences are too numerous to list. Can you be more specific?

How do Rails and Jruby relate?

Background: I have a java library that is accessed by many developers - usually via java. However, a few devs hope to access this via a Ruby API. I am gravitating in the direction of Jruby in order to implement a Java-Ruby API.
Questions:
My main concern is that these developers will not be able to utilize the API in their current, Ruby on Rails development framework; but instead will have to operate within Jruby's rails environment. Is this going to be the case?
Perhaps I'm missing a connection between Jruby and Ruby on Rails. But it seems that you can either work in Rails, or work in Jruby's rails - are these technically two different development environments?
I would really appreciate any light someone could shed on this..
Edit: Forcing developers (actually clients to be more specific) to make large changes to their projects in order to accomodate for this API is not really an option. So, if their Rails apps would have to be converted to Jruby on Rails apps, then perhaps someone could offer yet another alternative for me (other than Jruby)?
First, I should mention that Ruby on Rails is simply Ruby code, and the same code can run in the JRuby environment (on the JVM) or the MRI (written in C) runtime.
However, only JRuby can load Java classes and use a Java API. Asking your clients to switch their deployment environment to JRuby may not be feasible, but if you can set up a service in Java that speaks XML or JSON then they will be able to easily use it from Rails.
You might find the answers to a similar question helpful. Depending on your application it may be possible to seamlessly port your RoR app to run on JRuby subject to the caveats noted in that answer. But you'd want to be sure that the benefits of doing so balanced the effort and potential risks.
Alternatively you might consider making these Java library facilities available to your MRI Rails app as an internal web service (which could be Rails or Sinatra or similar) built on JRuby. That's way you would decouple the elements and de-risk the project. If you subsequently were comfortable with that working you might then consider collapsing them back together, all under JRuby-on-Rails if that made sense.
UPDATE: Adding more detail at questioners request
As I'm not familiar with what your application or Java libraries do this will be somewhat abstract but I trust you can fill in the blanks to suit your needs.
It seems that full porting of your Rails apps to run on Jruby is not feasible. Fine. So one idea would be to expose your Java library as a web service (e.g. RESTful) to your RoR application. Let's call this thing JLS. In this case it would run as a Java or Jruby network service, listening for requests, call into the library and send back responses (general waving of hands here but you get the idea).
Depending on what your developers are more comfortable with you can create JLS in Java running a Servlet container maybe. Or you could develop JLS in Ruby, running on Jruby (binding to your Java library) and use a framework like Rails or Sinatra to implement it.
On the RoR side, assuming you've made JLS RESTful (and I don't know if that's even appropriate in your case), you can use the ActiveResource facility for communicating with JLS.
In summary the RoR app and JLS run in separate memory spaces (maybe even different hosts). Each can be developed somewhat independently (with RESTful interface agreement of course) and your RoR app does not need to be disrupted or put at risk.
This suggested option comes with tons of small print but I hope you get the general idea.

Ruby on Rails for web applications, Django for webpages?

Days ago I read something like "Ruby on Rails is for web applications, Django is for standard webpages". Is that true?
I have to decide in the next weeks if I go with Ruby on Rails or Django for an university project. It will be an email marketing software.
What do you advise me to use?
This is mainly because of their heritage - Rails was originally used for web applications like Basecamp, while Django was used to build newspaper/magazine sites.
I would say both have long since outgrown their original purposes however.
No that is not true, but however, Django has the built-in Admin back-end making it a great starting point for a CMS or something similar. Django is still very capable for creating complete web applications!
I presume this is:
Ruby on Rails (i.e. the Rails framework, using Ruby as the programming language)
vs
Django (i.e. the Django web framework, using Python as the programming language)
Both of these frameworks are Model View Controller (MVC) frameworks, so they are both capable of web applications and web pages.
Therefore, your decision is really "Python or Ruby".
Both Ruby and Python are object-oriented languages and are easy to get into... they both have quick-start guides here:
http://www.ruby-lang.org/en/documentation/quickstart/
http://wiki.python.org/moin/BeginnersGuide
I think Ruby has the edge in terms of simple documentation and ease of use - as long as you are happy to abide by the rules that the language enforces (which aren't necessarily a bad thing by the way).
Both frameworks are great for what you're trying to do and Ruby and Python are similar in a lot of ways. My suggestion would be to skim through the online documentation for each and go with what feels best for you.
First, you need to answer 2 questions:
Do you prefer Python or Ruby?
Do you need a minimalistic framework, or a more complete one?
As a minimalistic framework in Python, take a look at web.py.
Both are great frameworks.
The question is.. Do you prefer (or feel more comfortable, or know better) 'Python' or 'Ruby'?
Once you have the answer to this question you also have the answer to the original one.
You can use either framework to create almost any web application imaginable.
If you have no language preference, and you don't have a preference for their different design patterns (Django is nearly not as strict MVC as Rails), then think about the different Python and Ruby libraries/apis out there that could be useful for your project.
Go with whichever language supports those libraries/apis that help you the most.
In my experience, Rails developers are more likely to work in small, funded startups. Django seems to be the preferred environment for independent consultants building websites for small businesses. If you're picking a language to gain experience, you might keep this in mind.
You'll be spending most of your time configuring, learning the tools, frameworks, and environments. The language itself (Ruby or Python) will not be a big hurdle for you.
Also - Rails is really nice to develop with on a Mac. I don't know about Django tools.

Resources