Putting Ruby, Rails, C#, and ASP.NET in context

Share this article

I’ve noticed there’s quite a bit of misunderstanding among .NET developers as to what Ruby or Rails are, and how those compare to what they came to know and love in .NET. I know I didn’t understand it myself for a while. The following comments, drawn from my two previous posts (Switching to Ruby from .NET and Why should a .NET developer look into Ruby or Ruby on Rails) serve to illustrate my point:

“Had a look at Ruby but no thanks, .NET remains the way for me.”

“…are there demos or samples of Ruby on Rails that can compare with the web apps that I can create with ASP.NET or Silverlight, and components like DevExpress for the ASP.NET MVC? Is there something like that in Ruby?”

While the first comment compares Ruby to .NET, which is a comparison between a language and an entire development platform, the second comment mixes html-based applications with rich client applications built on Silverlight, brings 3rd part visual controls into the equation, and wonders whether such controls are available in Ruby (a language…).

Lots of confusion there, so I hope to clarify those misconceptions in this post.

What’s Ruby?

Ruby is a language. Just like C# is a language. Borrowing a quote from the Ruby language’s website:

“Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.”.

So how exactly does Ruby compare to C#? You’ll find objects in Ruby, along classes, methods, inheritance, etc. You’ll also find elements of functional programming; just like C# got some of that over time through anonymous delegates and lambdas. While C# has always been a static, strongly typed language, and eventually got a couple of dynamic features, Ruby is a fully dynamic language.

You can expect more posts covering how some of these features compare between Ruby and C#. You can start by checking out the .NET to Ruby: Classes post here on RubySource.

Who does Ruby belong to?

Ruby is an open source language, and as such, it evolves based directly off the needs of its community, whereas C# belongs to Microsoft, who has the final say as to what goes into the language.

With that being said, though, besides Microsoft’s implementation of C#, there is also an open source, cross-platform one provided by Mono.

Likewise, there is an implementation of Ruby from its creator, Yukihiro Matsumoto, or “Matz”, as well as Rubinius, JRuby (a Java implementation), and IronRuby (a .NET implementation). The fact that IronRuby exists should be an extra reason for .NET developers to look into Ruby, adding it to their bag of tricks when building .NET applications.

What’s Ruby on Rails?

So what is Ruby on Rails? A language? A framework? A platform? A company that transports the bright red color precious gemstone by train? Here we go:

  • Ruby on Rails (or Rails, or simply RoR) is a web application framework that follows the Model-View-Controller (MVC) architecture pattern. Therefore, it compares to the ASP.NET MVC framework;
  • Just like the ASP.NET MVC framework is built on top of ASP.NET, Rails is built on top of Rack);
  • Just like there are other web application frameworks built on top of ASP.NET (such as WebForms, or FubuMVC, there are other frameworks based on Rack (such as Sinatra);
  • Just like ASP.NET is written in C#, Rails is written in Ruby;
  • While “most” web applications built on any flavor of ASP.NET are written in C#, all applications built on any flavor of Rack are written in Ruby.

Who owns Ruby on Rails?

Rails is an open source framework, and much like Ruby, its development is driven by the community. New features are added to the framework based off real world needs faced by their users.

What kinds of application can I build with Rails?

Since people ask questions such as “can I build applications similar to Silverlight with Rails?”, I assume clarification is needed there. To just say “you can build web applications” isn’t enough anymore. Is it a web application because it’s hosted on the web? Or because it runs in the browser? Or because it is html-based? Or because it accesses data that comes from the web?

A typical Rails application has the frontend part, which is html-based. As such, it runs in the browser. The html-pages are served up by controllers in the web server. These controllers load up models populated with data, which comes from some place the web server has access to (maybe a database in the same box, maybe a web service someplace across the planet). Once the models are up, the controllers select the view template that produces the html that is to be sent down to the browser.

Another typical Rails application may have everything just mentioned in the previous paragraph, except for the html frontend. So the application provides an API (usually a RESTful one) that other applications can call over the web. For the .NET developer, this is kind of like creating ASP.NET Web Services, or WCF Services. In this case, the other applications consuming this API can be of any kind; for instance, an iPhone application, a Silverlight or WPF application, an ASP.NET application, etc.

It is not possible to create a “client-only” application with Rails, such as the ones created using WPF, Silverlight, etc. You can mix and match technologies, though. For instance, the current project I’m working on is mostly built on Rails, but it also has a part written in Silverlight, which consumes and pushes data to a RESTful API created in Rails. The Rails part of the application also consumes an API created in Java by a 3rd part vendor, and this vendor also consumes my API in order to send over some data. Another part of this project will include applications for iOS (iPad, iPhone…) and Android, and this application will also consume the API’s provided by the Rails application.

Are there reusable components?

.NET developers are used to libraries that provide all sorts of specific functionality, such as encryption, imaging, reporting, etc. Similar things are available in Ruby on Rails, and they’re often called “gems”. There are tons of them out there: lots of library that gives you a plethora of functionality that you can add to your applications (Ruby on Rails itself is a gem!)

Recently, .NET developers have also been introduced to NuGet, a library package manager, that facilitates adding external libraries to projects, bringing in also their dependencies, adjusting settings on the project, creating specific code generators, etc. Such a thing has been around in the Ruby world for a couple of years now, and it’s called RubyGems.

What about “visual” components?

.NET developers love their 3rd party visual controls! Those existed in abundance for WinForms, WebForms, WPF, and Silverlight. Far less options exist for ASP.NET MVC. I have not run into any such thing for Rails. However, as far as I’ve seen, Rails developers are quite happy with simply using CSS and jQuery in order to create awesome websites (which are things that .NET developers are using in their ASP.NET MVC applications as well).

There are always developers who want to get the “ubber 3rd part grid that can show a gazillion of rows from a database”. To tell you the truth, I used to be like that. Not anymore. If I have a situation where I need to handle a ridiculous amount of data in a grid on the client side, that means I’m doing something wrong. I talk more about that on my “You have been deleted!” post.

Is Rails cross-platform?

The short answer is yes. Here’s the long answer:

  • Any machine can access a Rails application: a Mac, a PC, a smart device…
  • Usually, Linux servers host these applications, even though they can be hosted in other operating systems;
  • These applications can be developed on any platform, even though Mac and Linux are by far the most popular environments. I’ve done Rails development on Windows for a couple of months, and even though that worked out to an extent, certain things either didn’t work as well as they do on a Mac, or were just too slow (such as when running automated tests).

Summing up

Ruby on Rails is just a web application framework, similar to the ASP.NET MVC framework, except that Rails has been around for a longer time. I hope this post helped clarifying how some of the bits and pieces of Ruby on Rails relate to the things .NET developers are used to.

Frequently Asked Questions on Ruby, Rails, C, and ASP.NET

What are the key differences between Ruby and C# in terms of syntax and readability?

Ruby and C# have different syntax and readability. Ruby is a dynamic, interpreted, high-level language that emphasizes simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. On the other hand, C# is a statically typed, compiled language that is more verbose and requires explicit type declarations, which can make it less readable for beginners. However, C# offers more control and performance optimization due to its static typing and direct access to hardware resources.

How does the performance of Ruby on Rails compare to ASP.NET?

Performance can vary greatly depending on the specific use case, but generally, ASP.NET tends to have better performance than Ruby on Rails. This is because ASP.NET is compiled and runs on the .NET framework, which is optimized for Windows servers. Ruby on Rails, however, is an interpreted language and may not perform as well under heavy loads or for high-performance computing tasks. However, for many web applications, the difference in performance may not be noticeable.

Is Ruby or C# more suitable for beginners to learn?

Both Ruby and C# have their own strengths and can be suitable for beginners depending on their goals. Ruby is often praised for its simplicity and readability, which makes it a great choice for beginners who want to quickly start building applications. C#, on the other hand, is a powerful language that is widely used in enterprise environments, making it a good choice for those who want to pursue a career in corporate software development.

What are the main use cases for Ruby on Rails and ASP.NET?

Ruby on Rails is often used for building web applications, particularly for startups and small to medium-sized businesses. It’s known for its convention over configuration philosophy, which allows developers to quickly build applications with less code. ASP.NET, on the other hand, is a popular choice for enterprise-level applications due to its scalability, robustness, and strong support from Microsoft.

How does the community support and resources compare between Ruby and C#?

Both Ruby and C# have strong community support and plenty of resources available. Ruby has a vibrant open-source community that contributes to a vast library of gems (packages) that can be used to extend the functionality of Ruby applications. C# has the backing of Microsoft and a large community of developers who contribute to its extensive library of packages and resources.

What are the job prospects for Ruby and C# developers?

Both Ruby and C# developers have good job prospects. C# is widely used in enterprise environments and has a high demand in industries like finance, healthcare, and gaming. Ruby, while not as widely used as C#, is popular among startups and tech companies, particularly for web development roles.

How does the development speed compare between Ruby on Rails and ASP.NET?

Ruby on Rails is known for its rapid development capabilities. Its convention over configuration philosophy and the availability of gems allow developers to quickly build and deploy applications. ASP.NET, while powerful and robust, may require more time for configuration and setup, which could slow down the development process.

Is it easier to deploy applications built with Ruby on Rails or ASP.NET?

Deployment can vary depending on the specific environment and requirements. However, both Ruby on Rails and ASP.NET have tools and resources available to simplify the deployment process. For example, Ruby on Rails applications can be easily deployed using platforms like Heroku, while ASP.NET applications can be deployed using Microsoft’s Azure platform.

How does the scalability of Ruby on Rails compare to ASP.NET?

ASP.NET generally has better scalability than Ruby on Rails due to its compiled nature and the robustness of the .NET framework. However, Ruby on Rails can also be scaled to handle increased loads by using techniques like database optimization, caching, and horizontal scaling.

What are the key differences in the development environments for Ruby and C#?

Ruby developers typically use text editors like Sublime Text or Atom, or integrated development environments (IDEs) like RubyMine. They also often use a Unix-based system like Linux or macOS for development. C# developers, on the other hand, typically use Microsoft’s Visual Studio IDE and develop on Windows, although cross-platform development is possible with .NET Core.

Claudio LassalaClaudio Lassala
View Author

I'm Claudio Lassala. I'm originally from the overcrowded city of Sao Paulo, Brazil, and I've been living in the hot and humid city of Houston, Texas, since late of 2002. I've been developing software for over 20 years, and I've received the Microsoft Most Valuable Professional (MVP) award for the last 10 years in a row (initially for Visual ForPro, and then for C#). I have written several articles and delivered several presentations (like I've mentioned, I have learned tons from helping others learn). I'm also the host for the Virtual Brown Bag. In order to help keep my sanity from writing code, I play lead guitar in a metal band (alright, some people might say that's not the best way for one to keep his sanity…).

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week