Should ASP.NET MVC developers really learn Ruby on Rails? - ruby-on-rails

Today, I came a cross a blog post for David Hayden explaining why he thinks ASP.NET MVC developers should learn Ruby on Rails.
Some of the reasons David mentioned:
ASP.NET MVC was inspired by Rails and in order for me to be a smarter ASP.NET MVC Developer I feel like I need to know Rails.
IronRuby is well on its way to being released which has got me excited about learning a new language, Ruby.
I really, really like Cucumber and RSpec and would love to use them for BDD via IronRuby on my ASP.NET MVC C# Projects.
I think it would be cool to develop ASP.NET MVC Web Application using Ruby via IronRuby.
What do you think guys? Is it really important for ASP.NET MVC developers to learn Ruby on Rails? If we are evaluating this option on a scale of 5 degrees ( Urgent-Important, Urgent-Not Important, Not Urgent-Important, Not Urgent-Not Important, A Total Waste of Time), what would your choice be guys, hopefully you will mention some benefits resulting from your experience working with both. Some articles, blog-posts on that subject are totally appreciated.
PS: There's a real use-case for this stuff, as my team leader is offering some courses on the house, and I was really considering Ruby on Rails.

I would disagree that ASP.NET was inspired by RoR.
Not Urgent-Not Important
That said I have used RoR and its great, but it will not help you become a better ASP.NET MVC programmer any more than learning other technology or tools.
It is always good to learn something new to broaden your abilities.
So my answer is yes learn Ruby on rails because you will be a better programmer for it, just not a better ASP.NET MVC programmer :)

not urgent, not important. It's never going to be a bad idea to learn RoR as it will give you a different perspective, but I think it's more important to get a deep knowledge of ASP.NET MVC and understand the full implications of using the MVC framework on top of the ASP.NET stack. Things like session and cache management as well as routing and controller actions work differently in ASP.NET MVC to RoR not to mention you're using MVC within a statically typed environment rather than the dynamic language of ruby so I think your focus should be on going deeper with ASP.NET MVC that trying to glean what you can from RoR just for the sake of it.

I would say it "Not Urgent-Important". Many features are of ASP.NET MVC is inspired by ROR. Apart from this, learning Ruby itself will be a great learning experience. It has many language features which you will find in .NET 4.0. So, it helps you to stay on curve with respect to where programming languages are heading.
Besides there are many cool things Rails provides. Understanding it opens up doors of opportunity when you work with asp.net mvc.
Apart from this ruby language already has RSpec for BDD. Learning this will broaden your understanding about BDD and will be helpful when you plan doing BDD with asp.net mvc.
Overall you will learn many good programming practices as well. So, the journey would be interesting..
Give it a shot, hope you won't regret it, as there is nothing to lose.

Related

.net mvc book for a rails developer

I am a rails developer and I am looking for a good .Net MVC book or tutorial. I don't know where to start. Do I have to learn .Net web forms and c# first, or can I go directly through .Net MVC?
You don't necessarily have to start with Web Form; being a Rails developer, it might even be easier for you to start with ASP.NET MVC. Ultimately, each offers a very different approach to web development and your choice will depend on your specific needs. Many will argue that MVC is the better choice.. realistically, each has its place. Moreover, keep in mind that not every ASP.NET MVC web application will be built from scratch; several projects will probably end up migrating from classic ASP.NET.
C# is one of many programming languages available for use in .NET....and although I strongly suggest learning C#, you could -technically speaking- use an implementation of Ruby called 'IronRuby' to get started. Should you first learn C#? Again, it's up to you... though just as it is helpful for a Rails developer to be proficient in Ruby, being comfortable with whichever language language you choose will prove helpful in learning a new framework. More importantly, the learning curve will seem much steeper if yo try to tackle both at the same time.. C#, can certainly differ from Ruby.
Anyhow, I highly recommend PluralSight & Microsoft's Virtual Academy to get started.
As user3435091 says, you don't need to learn WebForms, that is the old school way to do web applications in ASP.NET (the book detailed below explains why, but basically it has to be with actually web apps tend to be stateless and webforms goes to the opposite direction). With ASP.NET MVC, you will find a fundamental similarity to rails, you have Models, Views and Controllers as you would expect (they both follows MVC which is an architecture), so you don't have to change the way you think today about building a web applications. The template engine MVC uses is Razor which also uses the concepts of views, partial views, layouts, helpers, helpers for ajax, etc (it uses jQuery by default too).
The hardest part to learn I think would be with ORM (you have EntityFramework and NHibernate, the .NET implementation of Java Hibernate :s ) and that C# uses attributes (similar to java annotations). Also, you are not provided with the nice rails console out of the box in .NET.
The book I used to learn ASP.NET MVC 3 (and which I can recommend) is Pro ASP.NET MVC 3 by Adam Freeman and Steven Sanderson.
Hope that helps.

Design Patterns in ASP .NET MVC Application

Can somebody give me a link to article or name of book, where i can find something about Design Patterns in ASP .NET MVC applications? Sry if i asking for something stupid, i'm not expert in this.
I'd recommend Steven Sanderson's book for how to use MVC (probably worth waiting for the MVC 3 version which is due soon)
Otherwise I'd look at general design patterns books like Head First Design Patterns as these still apply within MVC.
Do you have a more specific question around a particular design pattern?
MVC itself is a design pattern. You can use several combinations of other design patterns in your application to suit your particular needs.
If you want a read an excellent book on ASP.NET MVC then I would recommend Steven Sanderson's book - http://www.amazon.co.uk/Pro-ASP-NET-Framework-Steven-Sanderson/dp/1430210079
Note: This book is available for MVC2 as well, but I have not read that one. This book uses several good concepts that will help you create a production ASP.NET MVC application including TDD, repository pattern etc
The official Microsoft website is actually very good for this. http://www.asp.net/mvc. I actually used Rob Conery's MVC store front video to get started (http://www.asp.net/mvc/videos/aspnet-mvc-storefront-part-1-architectural-discussion-and-overview). He goes through the repository pattern and a few other good practices for MVC, it's a little outdated now in some areas as it is written in MVC 1 but a lot of the points still hold.
Dino Esposito and Andrea Saltarello have a very good explanation and demystification of the MVC pattern on their book "Microsoft .NET: Architecting Applications for the Enterprise". I've got a review of the MVC chapter of their book in my blog

Recommendations for learning ASP.NET MVC from a desktop developer's perspective

One of my New Year's Resolutions is to finally learn some web development. I've decided on ASP.NET MVC as I'm a believer in TDD and IoC. I'm looking for a list of topics and perhaps an order to learn them for what I'll need to know to be a solid ASP.NET MVC developer. Perhaps this is embarassing, but the only web experience I have was html pages I made using WYSIWYG editors 5+ years ago when I was in college.
So first, congratulations on picking ASP.NET MVC. I dare say that ASP.NET MVC is easier to work with than WebForms. WebForms tends to take somewhat of a "black-box" approach to the web and treat it more like classic WinForms development. WebForms would probably be a slightly more comfortable technology for you (coming from WinForms development) but MVC will leave you with a greater understanding of how the web works, which is incredibly important.
Before you dive into ASP.NET MVC, you may want to brush up on the basics of HTTP, because it is important to understand when you starting writing action methods that respond differently based on request verbs. It's also nice to know exactly what HTTP headers are, and how they can be leveraged in your application. Anyway, here's my list for you:
Important People and Their Blogs
Phil Haack: He is the lead developer on ASP.NET MVC, and his blog has tons of neat tricks and tips for using it.
Scott Hanselman: He worked with the team on NerdDinner and from time to time his blog has some neat MVC stuff.
Rob Conery: Rob's an avid promoter of ASP.NET MVC and an active open-source contributor. He has tons of code on github for you to browse for inspiration/guidance, and he also has tons of screencasts on his blog and on his business website, TekPub. I recommend purchasing his screencasts from TekPub because he's just an amazing presenter and makes understanding ASP.NET MVC so easy.
Scott Guthrie: He wrote the first chapter with respects to NerdDinner in the Professional ASP.NET MVC 1.0 book, and he always has some cool posts about new features coming in ASP.NET MVC.
Steven Walther: It seems like every time I look at his blog he's got another cool trick or code snippet related to ASP.NET MVC. He's also written a book on ASP.NET MVC that has some pretty good reviews on Amazon.
Reading Material
WDVL: HyperText Transfer Protocol: Again, this is your HTTP tutorial. I've read through part of it and it seems pretty decent. You don't need a rock solid understanding of HTTP, but a general overview of request verbs and headers specifically will help you.
NerdDinner.com Tutorial: This is lengthy step-by-step guide written by ScottGu himself about how to create a basic ASP.NET MVC website from beginning to end.
Profesional ASP.NET MVC 1.0: This is a book by the team that wrote this ASP.NET MVC, and it really does a great job of explaining the framework.
ASP.NET MVC Framework Unleashed: This is Steven Walther's book on the framework. It has some decent reviews on Amazon, though I've never read it myself, so I couldn't really give my opinion one way or the other.
Screencasts
Rob Conery's MVC Storefront Series: These screencasts are amazingly helpful. In the beginning they were working against pre-release copies of the MVC framework, so some stuff has changed, but they're still amazing material for learning ASP.NET MVC.
Scott Guthrie's Presentations on ASP.NET MVC 2: Look at the ASP.NET MVC section of this page. There are some really neat new features coming in ASP.NET MVC 2, and Scott actually builds a good foundation from the ground up with this presentation. He takes you through beginner stuff first and then shows the neat new tricks later.
Phil Haack's MIX09 MVC Session: Great content here straight from the man himself. Phil's actually a great presenter, and there's a lot of good content here.
Phil Haack's MIX09 Advanced MVC Session: Some more advanced stuff and neat tricks from Phil.
Scott Hanselman's File -> New Company MIX09 Session: I actually attended this session while I was at MIX09, and Scott's a great presenter. Well worth a gander :)
Rob Conery and Steven Sanderson TekPub Screencasts: These aren't free, but they're worth every penny. Rob and Steven are amazing teachers, and I can't recommend TekPub screencasts enough. They are top-notch.
IoC and Dependency Injection
Since you mentioned IoC specifically in your OP, there are a few libraries and blog posts that might help you with that:
Simone Chiaretta: How to use Ninject 2 with ASP.NET MVC: I actually use Ninject in my own personal projects, so this is a great resource if you're a fan of Ninject.
Rob Conery's "Hana" Source Code: Sometimes I just love seeing some quality reference code. This is actually the source for Rob's blog. He was using StructureMap originally, but I think he changed recently to Ninject.Mvc.
MVC Storefront DI Screencast: Rob talks about setting up dependency injection in the MVC Storefront. This one uses StructureMap I believe.
TekPub Concepts video (free): Rob goes over the basics of IoC and DI in this video if you need a refresher. It's free too :)
Other Pertinent Web Technologies
Because you're looking to move to the web, there are other languages and technologies that you need to know as well. Below is a list of some brief tutorials to get you started, although each of these subjects could easily warrant a post as big (or bigger) than this one!
HTML: Seems silly that I'm mentioning this here, but I only mention it because there's a lot of push these days to write valid HTML. A majority of accessibility and browser incompatibility issues can be averted by having clean markup. I personally use XHTML in my sites, but any doctype will do :)
JavaScript: This is a neat language that can be used to make many web applications feel more like a desktop application (amongst other things). There are a lot of performance gains and design victories that can be had by properly leveraging JavaScript. Once you feel comfortable with JavaScript, you will probably want to make the move to a JavaScript library to make cross-browser compatibility very easy. My JavaScript library of choice is jQuery.
CSS: This is how you should be applying style to your websites. One of the biggest mistakes a lot of developers make is to make their HTML in charge of presentation (using tables for layouts [holy war], etc. etc.). Arguments and holy wars aside, CSS is a valid skill to have, and it really isn't as hard as some might have you believe :)
I know this seems like a lot, and I've probably inundated you with material to read, however I think it's important to build a solid foundation. Web development is a lot of fun when you are good at it, and it's definitely a great way to make a living! Good luck! ASP.NET MVC is a great framework, and you've made a great choice.
Oh yeah, and there are a few other things you might want to Google in your spare time. They tend to be pretty advanced, so I didn't include them here, but you will run into them when you get more involved in the web world:
AJAX: Makes your web applications perform more naturally and do things in the background.
Web Services: A universal way to exchange data on the web. For example, there are web services that provide weather forecasts and stock quotes. You can consume them and even create some of your own!
XML and JSON: These are used to describe data. When you serialize data on the web, XML and/or JSON are the conventional technologies most developers use. JSON is popular particularly because it can be consumed so nicely within JavaScript.
First step in starting MVC is going through Nerd Dinner Tutorial.
Its the simplest and quickest way to introduce you to the basics of MVC in my opinion.
Thanks
Sorry if this sounds a bit simplistic, but... The tutorials at http://asp.net/mvc, while basic, are good to get you comfortable with the framework. As is NerdDinner. I've found that if you have a development background then learning MVC is not that big of a stretch, so long as you can grasp the MVC pattern which is pretty straight-forward. It'll be more effort to get the web interface side of things up to speed. Your best bet would be to get comfortable with HTML, JavaScript (and AJAX), and CSS so that you can produce a good interface (view).
And the obligatory "learn jQuery" for your web UI.
Get the Nerd Dinner here :
http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf
It is one of the best resources I have used so far
I would start with the following book:
Pro ASP.NET MVC Framework
alt text http://www.apress.com/resource/bookcover/9781430210078?size=medium
It contains great information on starting MVC development from scratch. The sports store example includes much more useful information than Nerd Dinner IMO.
Check out the ASP.NET MVC in Action book and the codecampserver project that goes along with it.
I switched from Webforms to MVC for my day job I while back, and found exposing myself to Rails development, post 6pm at home :), really helpful with the transission as many of Asp.net MVC principles seem to be a direct port from Rails..... and its Rails so you will just love it anyway...;)

Justification for MVC?

I was wondering if someone could provide me with some answers. I've been asking to swap our internal apps to an MVC architecture for quite a while now. Rails was absolutely shot-down as a toy, Struts is just too huge for the apps we do, Django's name makes these old folks nervous (oil & gas industry) but finally, finally Microsoft has come out with MVC 1.0.
Since the Powers that Be are dead-set on using Microsoft technologies, I think I may be able to convince them to move our applications to an MVC pattern. Unfortunately, I can't come up with a good reason to swap to our forms-based structure to an MVC style.
Can anyone think of justification good enough to feed to my bosses? :-)
Do you have a good reason to switch? It sounds like you don't so I am wondering if you are switching for the sake of MVC itself which I would discourage you from doing.
ASP.NET MVC is helpful when you wish to have more control over the output and lifecyle of your application. Keep in mind that in many cases this means more work for you as the developer. MVC frameworks are good for sites that are not data-entry intensive - in other words if you handle a lot of form POSTs and process data out of those forms then ASP.NET MVC will actually create more work for you.
I don't mean to sound harsh but it seem strange to me that you want to switch to ASP.NET MVC but don't really know why.
There are a number of questions that address this in different ways:
Should I pursue ASP.NET WebForms or ASP.NET MVC
How to decide which is right, WebForms or MVC when doing ASP.NET
Traditional ASP .NET vs MVC
Biggest advantage to using ASP.Net MVC vs web forms
MVC Versus Web Forms
ASP.NET vs ASP.NET MVC
I think it's not a matter of "selling" MVC, but rather of understanding it's advantages.
also, you should seriously evaluate whether migrating an existing system to MVC will be cost effective.
however, MVC has many advantages - here are some from the top of my head:
separating control, data and presentation makes your application more maintainable
easier to make changes
after a relatively short learning curve, easier for other programmers to comprehend
better design means introducing new features is easier. try adding caching, form validation, etc when everything is mixed up...
an MVC system may be more testable (and therefor can be more reliable) - it's much easier to test your controllers than to test a spaghetti of data, control and presentation code.
I think that in this case the OP is looking for a pragmatic (profitable) reason to switch over to MVC, since most companies think that way.
The biggest advantage is that it is much easier to create unit tests for ASP.NET MVC applications. A good suite of unit tests can then serve as the foundation of a Continuous Integration process.
The bottomline for the powers to be is that you can create a build in a single step, simplifying deployment, creating installers, patches etc.
Rails and Django both follow the Model View Controller (MVC) pattern so sounds like you will just be creating a load of work for yourself. Why do YOU want to switch to ASP.NET MVC?
"Struts is just too huge for the apps we do"
In what way? Struts made even simple internal applications a breeze to develop in our company, once we had learned how it worked (which was quite quick). A few JSPs, a few Actions, backend database access done in JDBC via some simple DAOs, bundle it all up in a war with ant/maven and deploy. Done.
Also, fyi, keep Joel's advice in mind (Things You Should Never Do, Part I): avoid rewrite the code from scratch.

Traditional ASP .NET Web Forms vs MVC

As someone with some winforms and client applications experience - is it worth going back and learning the way traditional ASP .NET pages work, or is it okay with moving straight into ASP .NET MVC?
I'm kind of looking for pitfalls or traps in my knowledge of general C#, that I won't know from the screencast series and things on the ASP .NET site.
Here is the great thing about MVC. It works closer to the base of the framework than normal ASP.NET Web Forms. So by using MVC and understanding it, you will have a better understanding of how WebForms work. The problem with WebForms is there is a lot of magic and about 6 years of trying to make the Web work like Windows Forms, so you have the control tree hierarchy and everything translated to the Web. With MVC you get the core with out the WinForm influence.
So start with MVC, and you will easily be able to move in to WebForms if needed.
I agree with Nick: MVC is much closer to the real web paradigm and by using it you'll be confronted with how your website really works. WebForms astracts most of these things away from you and, coming from a PHP background, I found it really anti-intuitive.
I suggest you directly jump to MVC and skip WebForms. As said, you'll be able to get back to it if needed.
ASP.Net Webforms is a completely different abstraction over the base framework than ASP.NET MVC. With MVC you've got more control over what happens under the covers than with ASP.NET Webforms.
In my opinion learning different ways to do things will usually make you a better programmer but in this case there might be better things to learn.
ASP.NET MVC is for developers who desire to decouple the client code from the server code. I have wanted to write JavaScript, XHTML, CSS clients that can move from server to server (without regard to server technology). Clients are time-consuming to fit and finish so you would want to use them (and sub-components) for as many servers as possible. Also this decoupling allows your server to support any client technology that supports HTTP and angle-brackets (and/or JSON) like WPF/Silverlight. Without ASP.NET MVC you were forced into a hostile relationship with the entire ASP.NET team---but Scott Guthrie is a cool dude and brings MVC to the table after years of his predecessors (and perhaps Scott himself) almost totally focused on getting Windows Forms programmers to write web applications.
Before ASP.NET MVC, I built ASP.NET applications largely based on ASHX files---HTTP handlers. I can assure you that no "real" Microsoft shop would encourage this behavior. It is easier from a (wise) management perspective to dictate that all your developers use the vendor-recommended way of using the vendor's tools. So IT shops that are one or two years behind will require you to know the pre-MVC way of doing things. This also comes in handy when you have a "legacy" system to maintain.
But, for the green field, it's MVC all the way!
It depends on your motivations. If you're going to sell yourself as an ASP.NET developer, you will need both.
If this is just for your own pleasure, then go to MVC.
My personal feeling is that webforms will be around for quite a few years more. So many people have time and energy invested in them. However, I think people will slowly (or maybe not so slowly!) migrate. Webforms was always just a way to get drag-and-drop VB4 morts to think about web development. It kindof worked but it does take away alot of control.
IMO, there are more pitfalls in normal web forms scenarios than with just MVC. Viewstate and databinding can be tricky at times.
But for MVC, it's just plain simple form post/render things old-school way. Not that it is bad, it is just different, and cleaner too.
I can't really speak technically about MVC vs "traditional" as I have only used the traditional model so far. From what I have read though, I don't think one is vastly superior to the other. I think once you "get it", you can be very productive in both.
Practically though, I would take into consideration that most books, code samples and existing applications out there are written for the "traditional" way. You have more help available and your skills will be more useful for employers with existing applications written in the "traditional" way.
If you don't know how or haven't has experience with raw level web request / response and raw html/css rendering then MVC will would be good place to start.
You will then better understand the pros and cons of both webforms and mvc. They will both be around in the future as the both address different needs.
Though I will say webforms is a highly misused and abused platform.
So much of the "look no code" rubbish gives all who use it a bad name.
Put in the time to understand it and use it properly you'll find its a very extensible and robust platform.

Resources