Rails and ASP.NET MVC when to use each? - ruby-on-rails

we have a mixed development environment using ASP.NET MVC and Ruby on Rails. We have come from a purely C# / ASP.NET background, but now have some rails experience and we love both. Problem is deciding at the beginning of a project which one to use can sometimes be tricky.
Any tips for how to explain to the non technical members of our company and our clients why we would chose one over the other for various projects?
Thanks in advance.

Deployment? Rails is interpreted, ASP.NET MVC requires compiling.
Speed? One's bound to be faster than the other, I'm assuming (although I cannot be certain) that ASP.NET MVC would be slightly faster as its compiled.
Platform? ASP.NET MVC obviously has to run in a Windows environment, whereas Rails could run on *nix/Windows/Mac
Development time? You're all going to be more familiar with the constructs of one system over another meaning one will take you longer to develop in. If speed of development is required, one will be preferable.

To be honest if they are non-technical, why would it matter to them? It's pretty rare for a customer to come and ask for a specific technology, and it sounds like you would be picking for them. Then presumably they would trust you to pick the appropriate technology.
If you have to justify to management, I can see that mattering, though. I have developed mostly with Rails and a little with ASP.Net and I do have a favorite, in Rails. That said, I would just fall back on my default and then just tell them the requirement that requires me to jump to the other technology. They can probably understand most reasons, like the ones illustrated by Kezzer.

Any tips for how to explain to the non
technical members of our company and
our clients why we would chose one
over the other for various projects?
If they're non-technical, I don't see why they would care.
However, you could just tell them Microsoft made ASP.NET MVC while Ruby on Rails was not made by Microsoft.
Or, for which ever one you choose, just tell them it gets the job done the fastest/easiest.
Giving them a good response would require them to be technical (performance, compiling, etc..).

Related

Are there any multi-database multi-tenant ASP.Net MVC reference applications

I'm currently building a multi-tenant, single code-base MVC app hosted on Windows Azure and have come up with my own application framework work to support it.
Although it works I'm still not a 100% happy with it and I was wondering if anyone knew of a good example of multi-database,single code base out there ?
I'm not sure about the multitenancy, but KiGG is really nice example of domain driven design and application supporting multiple databases. It doesn't use multiple databases at the same time, but they way the layers are designed allows very nice extensibility, for example for caching or logging.
I think the design approach of KiGG is very good for multitenancy too, and even if it doesn't answer your question completely, I think it is worth of reading the code anyway.

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.

Worth using ASP.Net MVC for hobby project?

I'm quite a proficient ASP.Net Web Forms developer, but I would like to get some exposure to MVC to see what it's like and if there are benefits to using it.
Is it worth using MVC for a hobby project, my main concerns are:
It may hinder development times of the website
I may not appreciate any rewards for using MVC (i.e. testability)
Are my concerns reasonable?
Thanks
A hobby project may in fact be a perfect introduction to MVC if you want to learn it. I thoroughly recommend having a play. If you haven't used MVC before I wouldn't attempt it for a large scale project, smaller projects like you may be undertaking are great stepping stones for learning the new framework.
Of course, you've got to weigh up hindrance against progress. The time taken may hinder this project, but in the long term, getting an introductory exposure now has got to out weigh that?
I started a hobby-project earlier this year in ASP.NET MVC (later upgraded to MVC2), and it's the single best learning experience I've had the last few years.
So my answer is a definite 'YES'
Do it, and try to exploit as much of the features in MVC2 as possible. Strive to do things as simple and reusable as humanly (or maybe technically) possible, and you'll be a master in MVC2 in no time :D
Why not?
You say it's a pet project, so time is not really an issue. Given a good book, or based on the examples on the ASP.NET site, you should be able to get up to speed fairly quickly.
Testability is one of the strong points for ASP.NET MVC, so maybe you should try writing tests and decoupling your views from business logic? Who knows, you may like it. Either way, doing so will allow you to claim personal experience of using a new technology on your CV, plus learning something new is always fun.
You'll learn from it and can then take it into a work situation. And besides that, it's nicer to work with than web forms...
I certainly wouldn't want my first venture into a new technology to be a live project so I'd certainly recommend starting a hobby project.
Throughout your first development in ASP.NET MVC you will probably make architectural mistakes whilst you get used to the MVC pattern. You will also find yourself without much of the WebForms functionality and will need to think about how best to apply your design to the technology.
Essentially, you'll learn whether it is worth using it or not throughout the project. A decent rule-of-thumb is that any project that will take you more than a couple of months development time will probably be better developed with MVC.
Just to add to the above, I too would recommend you play with MVC. I've found that I'm actually more productive in MVC than in Web Forms.
In case you have not found this tutorial, highly recommended as a beginners guide and written by Scott Guthrie:
Html Version
PDF Version

Is Rapid Development a moot point in ASP.NET MVC?

Since asp.net mvc did away with many controls that were in webforms, does this make rapid application development equal with other environments now? For example, if I have an mvc framework in php, j2ee, etc., and I have asp.net mvc, and the coder knows the given platform, isn't the development advantage gone in visual studio?
If I am wrong about controls being missing please let me know, it was my impression they were (and I couldn't use them when I tried it last.)
I ask because where I work some like Microsoft - a lot, some can live with it, but the ones that like it point to Visual Studio for rapid development. I thought much of that was gone with asp.net mvc 1.0.
EDIT: I guess I am thinking that dragging and dropping controls means Rapid Application Development (again, assuming the coder knows what they are doing everywhere else.)
Rapid application development is just a buzzword. It exists if you develop an application rapidly, not due to any particular tool or technology.
ASP.NET MVC is just a different approach. Some people can work faster when they are closer to the HTML. For me, this means I don't have to deal with the (IMHO) touchy databinding model of WebForms. Instead, I pass my Model directly to my View for rendering. That lets me develop rapidly. You can still develop your own UserControls (or download many of the ones that are available through open source projects), but you can't use anything that has events or ViewState intrinsic to it.
EDIT: RAD is also a subjective term. Is it rapid application development if you can churn out the first iteration in two weeks, but have to push the schedule back two months for the second iteration because the code was not maintainable?
If you are talking about the ability to drag controls onto a page, click them, set some properties, and have a code generated for you, and a working application by basically dragging controls and tools around, yes, MVC removes the ability to do RAD.
MVC exists to solve a different problem. It is for people that want separation of concerns to support unit testing and extensibility. Things that were nearly impossible to get with classically developed asp.net applications.
Web forms was an attempt to be more RAD if you will. However, the emergence of things like MVC, and Dynamic Data and things like Linq and Linq2SQL are pretty darn good evidence that Web Forms alone were not the panacea RAD platform.
From a personal standpoint, one may be faster at Web forms just by experience. That doesn't mean the platform or it's competitors are better or worse at RAD.
A lot of people found that Web Forms took so much control away and had such large event models that it ended up being less RAD than hoped.
I'd say that Rapid Development and ASP.NET MVC are not mutually exclusive per se. however since MVC has the intent of segregation of responsibility to (amongst others) allow testability, it might not be the best choice for Rapid Development-
On the otherside are ASP.NET Webforms where you can do ALOT "visually"/using drag-n-drop (i.e. no code), which to some extent does a very good job of for example preventing testability. But developing is a "no-brainer" - meant in the most positive way :)
Well, I've never considered Visual Studio as a RAD platform. Faster than PHP, sure. Comparable to Netbeans/Eclipse. Not even close to a true RAD platform though (oh Delphi, how I miss thee!).

Do you believe that ASP.Net MVC is ready for production?

I really like the fact that Microsoft has taken a commitment to bring MVC to the Web. To this end, I have become excited about converting one of my existing ASP.NET apps to MVC and wanted to know if I may be jumping the gun. While this site is using MVC, it's still technically in beta...what are your thoughts?
From Preview 5 to RTM, there will be less and less breaking changes. So if the concern is how much churn your project will face, it shouldn't be as bad as it was with earlier releases.
If the concern is support, we do ship the source code and you're allowed to modify (but not redistribute) the source for your own needs. In most cases, we've heard from customers that they didn't have to change the source to work around bugs, instead opting to use our extensibility hooks.
Since Stack Overflow is written in asp.net mvc and it's in production, it looks like it's production ready :)
Yes, it is built on the foundation of ASP.NET (caching, authentication, etc) so it isn't having to deal with rewriting/stabilizing all those lower level pieces.
I have it in production and it has been very solid from a runtime perspective.
I re-coded my site using the Preview 5 of ASP.NET MVC and I completely fell in love with it. I would not, however, convert any existing applications to it until it's in Go-Live. Too much could possibly change...

Resources