Tech Off Thread

39 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Ruby on Rails vs. ASP.NET Deathmatch!!!

Back to Forum: Tech Off
  • User profile image
    mrichman

    I knew that subject would get your attention Smiley

    I've never programmed in Ruby before, but I just watched these impressive presentations on Ruby on Rails, and I would love to see the ASP.NET community counter with demos of their own:

    http://rubyonrails.org/screencasts

    While Ruby on Rails may seem to allow one to get a simple app up and running quickly, ASP.NET has a whole lot less *total* code, even if it may take a bit longer. For example, I bet that blog demo can be done in ASP.NET with one .aspx file with little or no code-behind and a web.config, plus an .mdf.

    Symfony looked cool too: http://downloads.symfony-project.com/demo/cart/cart.mov

    Thoughts?

  • User profile image
    unix?

    I am a .NET Developer (in my job). I have tested RoR and I think it is fantastic. Programming makes fun and is very nice not to code so much code.

    Very good AJAX integration. Unit, functional testing, integration testing integrated (and very easy/fast to use). I think the complete framework is focused on agile development.

    Very productive framework - the best I have ever seen (until now). Caching, MVC ... integrated too.
    An OR/Mapper is integrated too Smiley

    And the programming language Ruby is very modern. It is much mode dynamic and not strongly typed like C#, Java,... it has mixins, ... and you can extend a foreign class without modify the source class.
    I think the future in programming are not strongly typed languages - see F# of Microsoft research.
    With scaffolding you can reduce the code you have to write or the drag and drop actions you need.

    Deployment is managed with Switchtower, ... very cool.

    I think RoR can have a big potential for the future. The community is very active and RoR 1.1 will be released soon. The people are very friendly and have nice podcasts and videos.

    Since I know about RoR I have fun in programming again and I am much faster and more productive. I hope that RoR will have such a success like PHP. Java and .NET are in my point of view old technology (about 10 years) and have a syntax like C/C++ (much older).

    Take a look of the quotes: http://www.rubyonrails.org/quotes
    Rails seems to fascinate others too.

    Have fun!

  • User profile image
    balupton

    unix? wrote:

    Since I know about RoR I have fun in programming again and I am much faster and more productive. I hope that RoR will have such a success like PHP. Java and .NET are in my point of view old technology (about 10 years) and have a syntax like C/C++ (much older).


    I may be mistaken but Wasn't the first release of .NET in Visual Studio .NET 2002? Which makes it only 3-4 Years old (depends how you want to count Tongue Out )

    And about your C Syntax remark, C is a very useable syntax and if not the most popular syntax.
    It's easy to code and understand and it's soo widespread that it become a 'standard'.


    But I just watched the flikr demo, and I must say wow.

    I'm in love with PHP and javascript, and really dislike ASPs way of doing things as what I type in my source isn't what is actually displayed for the user.

    But I don't think it will catch on anytime soon, around 2-5 years if all goes well.

    But yer, i'll stick with my javascript and php Wink

  • User profile image
    Harlequin

    Just don't like the Ruby syntax, not very friendly to the eye Smiley

    def bfs(e)
        q = []
        e.mark
        yield e
        q.push e
        while not q.empty?
            u = q.shift
            u.edge_iterator do |v|
            if not v.marked?
                v.mark
                yield v
                q.push v
            end   
        end
    end
    bfs(e) {|v| puts v}

  • User profile image
    balupton

    Harlequin wrote:

    Just don't like the Ruby syntax, not very friendly to the eye Smiley

    def bfs(e)
        q = []
        e.mark
        yield e
        q.push e
        while not q.empty?
            u = q.shift
            u.edge_iterator do |v|
            if not v.marked?
                v.mark
                yield v
                q.push v
            end   
        end
    end
    bfs(e) {|v| puts v}



    Yer it does look quite horrible now that i've seen that.
    Looks like a basic and C mix...

    And for 'bfs' anyone else thinkin the same thing im thinkin for what that is meant to stand for.... Tongue Out

  • User profile image
    Eirik

    My big, wet dream right now is to have the Ruby language on .NET - that would make me extremely productive!

    While C# is a lot better in that respect than Java, it still is a lot of typing in at least two senses of the word. Ruby is simply elegant - as the exception in the post above proves Wink.

    While the shorthand is fine, the code may be written like this:

    def bfs(e)
        q = Array.new()
        e.mark()
        yield( e )
        q.push( e )
        while not q.empty?()
            u = q.shift()
            u.edge_iterator do |v|
            if not v.marked?()
                v.mark()
                yield( v )
                q.push( v )
            end   
        end
    end

    bfs(e) { |v| puts( v ) }



    ...which makes it a little easier to distinguish methods and arguments - but its really just a sprinkle of sugar. If methods and variables had been given meaningful names it would be even easier.

  • User profile image
    wkempf

    The C# equivalent is pretty close, making both arguments for/against (at least for this specific example) a little off the base.

    IEnumberable<MyType> bfs(MyType e)
    {
       List<MyType> q = new ArrayList();
       e.Mark();
       yield return e;
       while (q.Count > 0)
       {
          object u = q[0];
          q.RemoveAt(0);
          foreach (MyType v in u.EdgeIterator())
          {
             if (!v.Marked)
             {
                v.Mark();
                yield return v;
                q.Add(v);
             }
          }
       }
    }

    foreach(MyType v in bfs(e))
    {
       Console.WriteLine(v);
    }

    Note: This was typed free form and may contain numerous errors, but it should illustrate the point.

  • User profile image
    rhm

    I'll have a look at some of those demos later. I read some basic RoR tutorials a while back and wasn't overly impressed. To impress me I need to see something complex and then judge the comprehensibility of the code, rather than see how few lines some trivial problem can be solved in.

    And without turning this into a Ruby discussion - I like strongly typed languages because I like to find type errors at compile time. And I'm very sceptical of "productivity improvement" claims regardless of where they come from.  I had enough of using dynamic/weak typed languages at university where we'd get the program written and then spend hours hunting down the stupidest little errors that only became apparent at runtime. Oh, and there's nothing particularly modern about Ruby except that it's a johnny-come-lately. The ideas have been around for decades - dynamic typing is as old as strong typing. If you missed out on having to code in LISP, consider yourself lucky.

  • User profile image
    Harlequin

    Ruby isn't compiled like .NET/Java is it?

    If not, then it should be up against classic ASP/ColdFusion/PHP...

  • User profile image
    W3bbo

    balupton wrote:
    I may be mistaken but Wasn't the first release of .NET in Visual Studio .NET 2002? Which makes it only 3-4 Years old (depends how you want to count Tongue Out )


    ASP.NET was available to "work with" around 2001, it wasn't until 2002 that developers got an IDE for it. Thus making ASP.NET 5 years old.

    Java is much older, but a better comparison would be J2EE Vs. .NET.

    I don't think you can compare RoR with ASP.NET given that the whole .NET framework (and almost every Managed API) is available to you. To my knowledge, RoR doesn't have anything like CreateObject/GetObject.

  • User profile image
    unix?

    .NET is no new technology compared to Java and Java is 10 years old! That was my message.

    I think RoR is nice - I have found my favorite for web application development. I know .NET very well and working with this at work every day. RoR is my favorite!

    For the future I think there are 2 possible directions:
    1. strong typed languages like Java, .NET with AOP
    2. dynamic languages like Ruby.

    I personally prefer the 2nd choice.

    Perhaps Microsoft can learn from projects like RoR, Spring, Hibernate, and so on. They can be very useful.

  • User profile image
    Eirik

    W3bbo wrote:

    I don't think you can compare RoR with ASP.NET given that the whole .NET framework (and almost every Managed API) is available to you. To my knowledge, RoR doesn't have anything like CreateObject/GetObject.


    In RoR you have the whole Ruby framework and all standard and third-party libraries available to you...

    I'm not actually sure which CreateObject/GetObject you are referring to as I don't do ASP.NET (so I am not arguing in any direction, just offering a Ruby / Rails perspective), but if it has something to do with OLE objects you could do this in your Rails app:

    require 'win32ole'
    excel = WIN32OLE.new('excel.application')
    workbook = excel.Workbooks.Add()
    excel.Range("a1")['Value'] = 42
    excel.
    ActiveWorkbook.Save(filename)
    excel.Quit()

    ...and then serve the fantastic budget spreadsheet back to the user.

    Note that I made a wild guess about what CreateObject and GetObject actually is - so please feel free to enlighten me Wink.

  • User profile image
    cravikiran

    Its going to have opinion and bias mixed in (plus its been a few months since I touched RoR) but heres my take :

    As I learned about RoR and started doing the basic stuff thats in the Shock and Awe demos, I was like wow - this is really cool.  I have to say the MVC implementation is good.

    But when I decided to try a real application, I got really frustrated by how little control I had over key areas like the SQL statements being issued.  I know I know... David says performance shouldnt be a concern, etc (I may be putting words in his mouth but thats how it stuck as to his opinion on it).  In real world apps, effective SQL and being able to cache, etc. is important.

    After my run with RoR, I played around with ASP.NET 2.0.  My thought the whole time was similar ... where are the blog in 2 min (or 5 or 10 or w/e the RoR demo was) demos on this?  Cause really, its a whole lot easier with ASP.NET 2.0 than in RoR.  Its practically no code - all the controls are drag and droppable.  Now, the biggest thing is that when you want to come back and do a real app in ASP.NET 2.0 after the initial wowing, you still can!  You are the ones writing the SQL statements for the data sources (with tools to make it quick) and caching is very easy to implement.  A lot of the plumbing is there for logins, user management, site navigation, etc, etc.  And with all of it, if you need to, the provider model is easy to customize as you like.

    That definitely sounds biased but thats how I honestly feel about it:  They've done good with RoR's marketing (the "demos") but beyond basics, it really disappoints.  Not so with ASP.NET 2.0 - only thing is maybe someone should do the 2-5 min "demo" for ASP.NET 2.0.

  • User profile image
    niswilsonni​ssen

    Could someone please explain me where the .NET equivalent of ActiveRecord (in RoR) is located in the framework? I would rather not spend time building a O/R mapping layer.

    Cheers,
    Nis

  • User profile image
    Eirik

    Some good points there cravikiran. Rails shines if the ActiveRecord model fits your purpose, but with ASP and Visual Studio a lot of the "straying from the Rails path" becomes much simpler - especially if you are used to the Visual approach to development. Coming from a unix background I still feel a little more comfortable with the pure text-editing approach to GUI or markup layout as well as the coding.

    If you don't like the ActiveRecord handling the database you may write your own SQL in the model files - and imho it's not exactly hard. Rails doesn't force its methodology on you - it just offers a nice set of classes and methods - and a default filesystem layout which eases you into the MVC-way of developing. Everything is still overridable and extendable - but you don't have the comfort of drag-and-drop controls and the code-generation facilities (scaffolding) may feel a little limited for ASP.NET developers...

    Also, much of the productivity value of ASP.NET and Visual Studio is "limited" to Microsoft products and platforms (I didn't say that there is something wrong with this [A]) which cost quite a few $'s while Rails can be deployed... almost anywhere.

    I am however a little inclined towards thinking that Rails is better for smaller projects while ASP.NET might be better suited for larger scale (and especially) business applications. Right now I am doing a medium sized (but extremely mission critical) application in Rails - and so far I feel quite confident that Rails has enough degrees of freedom to let me finish in style. Personally I would love to do a thick-client winforms complement in .NET - but unfortunately my boss is a little too anti-MS for that to happen anytime soon.

    I guess my point is... Ruby is fun, Rails is fun, .NET is fun and whatever best fits my take on the task at hand is what will be most appropriate for me to use. Of course this may be limited by factors such as customers requirements or qualifications of my coworkers - but you get my point.

  • User profile image
    unix?

    Validation in RoR is very simple. ActiveRecord is very nice and a capable O/R-Mapper.

    But the testing features are the best. You can easily make unit-tests with fixtures (defined in YAML or CSV files) which will be written into your test database.
    You can test your controllers very easily - because it is well integrated. In the coming 1.1 release you get easy integration testing features too.

    AJAX support is integrated with ruby code.

    MVC is very clear and easy to use - and you get a good design of your web application.

    Caching functionality is easy to use.

    It´s a collection of best practices for OO agile development. The point is that a normal developer does not care about complex persistence, caching, testing, ... topics. The developer can have the focus on the domain of the application.


  • User profile image
    W3bbo

    Eirik wrote:
    I'm not actually sure which CreateObject/GetObject you are referring to as I don't do ASP.NET (so I am not arguing in any direction, just offering a Ruby / Rails perspective), but if it has something to do with OLE objects you could do this in your Rails app


    CreateObject/GetObject are left-overs from VB Sripting days, (I meant to type "To my knowledge, RoR doesn't support COM/DCOM" but I was half-asleep at the time).

  • User profile image
    mrichman

    cravikiran wrote:

    After my run with RoR, I played around with ASP.NET 2.0.  My thought the whole time was similar ... where are the blog in 2 min (or 5 or 10 or w/e the RoR demo was) demos on this?  Cause really, its a whole lot easier with ASP.NET 2.0 than in RoR.  Its practically no code - all the controls are drag and droppable.  Now, the biggest thing is that when you want to come back and do a real app in ASP.NET 2.0 after the initial wowing, you still can!  You are the ones writing the SQL statements for the data sources (with tools to make it quick) and caching is very easy to implement.  A lot of the plumbing is there for logins, user management, site navigation, etc, etc.  And with all of it, if you need to, the provider model is easy to customize as you like...maybe someone should do the 2-5 min "demo" for ASP.NET 2.0.


    This captures the essence of the point I was trying to make! Will someone on the ASP.NET team (ScottGu) please post a "Blog from scratch in 5 minutes with ASP.NET 2.0" video (and others!)

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.