Using Rails as a Framework for a Large Website

Using Rails as a framework for a large website

Not the speed and scaling discussion again?

In webdevelopment the things that are the slowest is the network communication (receiving the request, getting al your data back), the database (getting all your data from the database), and most of the times it is not about the computation time at all.

While it is true that Ruby and Ruby on Rails seem more focused on programmer happiness, I think that every decent web-application built in .NET or Java has as many levels of abstraction.

The complexity of the environment? I think you mean deploying? There are a lot of options, but the most used options are Passenger (very easy deployment on top of an apache or nginx), or Torquebox.
Torquebox for the moment is the fastest, best scaling solution (based on JBoss Application server), and several big names in the Ruby community are calling Jruby the implementation of choise to deploy your applications. While AFAIK the commonest deploy still is using REE (Ruby Enterprise Edition) and Passenger.

Unless you know you are going to have to do serious mathematical, cpu-intensive operations, I think the question you should ask yourself is: which framework/language will give me the quickest result?

If you are very proficient in Java/Spring, that might be the answer for you. But if your only worry is performance in general, I would say: do not hesitate and go for Ruby on Rails. It is a pure joy to develop in. The ruby community is really awesome if you would encounter any issues: support is just a post away.

And to conclude, I want to add a few very big sites using Rails: LinkedIn is using rails (and jruby), and Twitter still is using Rails for their frontend.

Are frameworks (e.g., rails) overkill for more simple websites?

Certainly this is a matter of preference, but there are pros and cons to every language.

I can say that the two are not interchangeable. PHP is almost a catch all language that has tried to implement every concept under the sun. It can be fun to use if you know what you are doing, and are clear about your style and approach to programming, but PHP gives you so much latitude, it can be easy to hang yourself on community examples.

Ruby on Rails is something of a framework in itself, and would be an excellent choice for creating a dynamic site. It is certainly not too bulky, and if your server can run it, the only thing that should stop you from using it, is your comfort level.

The advantage of PHP is that it can be everything to everyone, but ruby presupposes a great deal of experience in programming, and a good understanding of the pitfalls and problems inherent in working with a dynamic language. This is a wonderful thing for experienced programmers, but can be a painful thing for less experienced ones.

If you want to go the PHP route, there are a number a frameworks that can speed up the process, (which is one of ROR's claim to fame). Smarty, Zend and Cake are just a couple examples.

But again, if you are using these frameworks for the first time, the barrier to entry can actually extend your initial development time.

Honestly, a preexisting CMS might be your best choice... though you could go crazy finding a good one, and then figuring out how to bend it to your will. Joomla, Wordpress, ModX, Radiant and Refinery are some examples. (Wordpress being probably the most popular)

Is Ruby on Rails good for large scale projects?

I'm certain you can find a lot of this on the 'net, but I'm happy to oblige.

  1. Maintainability: Ruby and Rails are all about creating more maintainable code at the expense of a little performance. That's why Ruby is a dynamic language in the first place. As far as developers/teams are concerned, Rails is great for creating and maintaining code that is easy to understand and maintain.
  2. Dynamic vs Static: From the perspective of a development team, static languages have a the unique advantage of being very explicit. There isn't magic to confuse new developers, and there should be little work in terms of chasing down ghosts (in theory, anyways). That advantage is quickly outweighed by the ability of a dynamic language to really take advantage of OOP and get started developing quickly.
  3. Suitability: I can't think of any good reasons. It's test-driven, proven, and extremely well designed. It was made to do the job, so it doesn't surprise me that this is the case. :)

ruby on rails for static websites

One of the most important aspects of web design is the ability to expand/update/read the code. If you're most comfortable in RoR, use RoR. It's not overkill, especially because you can get extremely good test coverage with such a small website. If you or any person that inherits the website ever wants to add model code, it would be extremely easy.

BTW, I would highly suggest checking out the high voltage gem from thoughtbot. Very good for hosting static pages.

Ruby on Rails or a PHP framework

Answering your questions in order:

  1. You could certainly learn Rails in that time. It's enough time to build a Web site too, but whether it's enough time for you to build your Web site is a different question. I would personally not want to try such a thing on a tight deadline.
  2. You can write your own SQL queries, but there's little point to using Rails if you are going to work around all of its features.
  3. Joins are normally done as part of the database queries generated by ActiveRecord.
  4. Using ROR is pretty much orthogonal to having images, videos, etc. on a page.
  5. I haven't used it, but CakePHP aims to be quite Railsy. Zend and CodeIgniter are more popular and I'm told better by people who have used all three, though.

Should I be using Rails or Ruby for this website application? How?

Sounds like Rails might be a bit heavyweight for your situation. Perhaps Sinatra might be a better fit? It's an ultra-lightweight framework: a hello world app might look something like:

require 'sinatra'
get '/' do
"Hello World!"
end

Django or Ruby on Rails

I kind of like the Python language
better and it seems to be more
full-featured than Ruby for
statistical, scientific and networking
(let me know if you think this is
wrong).

If you think you'll need libraries like NumPy or SciPy, probably best to stick with python/django. I've struggled to find ruby equivalents.

However, the RoR community seems to be
much bigger

Bigger is of course not going to be better. I've had great experiences with the django community in terms of support, and the pluggable app ecosystem is maturing quite quickly.

I would also add that I find the django documentation to be very easy to follow.

Web development for a Computer Scientist

If it's as much a learning exercise as anything then take an iterative approach. Build revise. Build revise. My (very) rough guideline below:

Client

  1. Start with the structure of a website and concentrate on the client.
  2. Use notepad and build a bunch of static pages for your band. i.e. Hand code initially. Try to build all your pages with CSS. No table markup. Then play around with some Javascript to bring things to life. (Navigational menu\ Calendar selections\etc). Learn about how to import and link to Javascript and CSS files.... and how these files are treated re:caching etc.
  3. Try to learn up to the limits of what you can do on the client (generally). Factor in the nuances of 3-4 browsers (Firefox/IE6/IE8/Chrome) re:DOM and client side eventing.

Server


  1. Then start looking for what you might want to change across pages/sessions. i.e. what needs to be manipulated server side. And pick a server side technology.
  2. Start with basic post-back processing. Forget databases at this point. Learn how your framework of choice maintains state..... not just the name of the technology but the real nuts and bolts of it. One of your single greatest assets as a web developer is understanding the state model(s) of the technology you're using.
  3. Then go for a deep dive on the web server technology of choice (and in general). Understand the full request pipeline from client to server and back. This will teach you forms, http and its verbs, web server, filters and modules, server to framework hand off, page and control life cycles, back to the client.
  4. Now start working on dynamic content injection and the like. How to make and use reusable components in your web pages.
  5. Databases, caching, performance and diagnostics.
  6. Then get into into all the fun stuff like ajax, etc. Replace your javascript with jQuery, etc.
  7. Then you got the whole Webservices\XML\JSON\etc side of things to discover.

Resources

Well the web obviously. For client side stuff, going to the sites of companies who make third party web controls can be quite interesting. Asking how the hell they did that? Viewsource is your friend. Look at how they structure and build their pages. Pick a couple of good web designer sites, and you find a plethora of rants about browser wars etc that will give you good (under the hood) info.

Once you hit server side, I'd go for white paper type learning from your vendor of choice for your technologies.i.e. webservers/frameworks/etc. Again find a 3rd party howto/evangelist site (I used to use a lot of "4 guys from Rolla" for example) that will demonstrate how to do various things. Language learning is ongoing. Basically just do the best you can till you find a better way.... and always be on the lookout for a better way.



Related Topics



Leave a reply



Submit