Posted By: mrichman | Mar 9th, 2006 @ 4:43 AM
page 2 of 2
Comments: 38 | Views: 39504
W3bbo
W3bbo
The Master of Baiters
TrevorD wrote:
Right.  Another thing that I know is true:  There are absolutely no absolutes.


...And 76.4 percent of all statistics are made-up, oh and all generalisations are wrong
It is nice to see that the yield keyword in C# 2.0 is coming from such modern languages like Ruby.

I have seen drafts of the C# 3.0 future and want to say that more and more is coming from languages like Ruby. e.g. Extensions in C# 3.0 are like mixins in Ruby. And you do not need to specify the type all the time. I think that will be the right direction.
Balupton and W3bbo, ASP.NET is really nearly 9 (nine!) years old by now!  It is not because we only got it in 2001 that Microsoft didn't use it internally long before that date.

From an interview with Scott Guthrie: "We started the development of ASP.NET in 1997->1998"
The first version already ran that new year's weekend 1997-1998...
W3bbo
W3bbo
The Master of Baiters
dotnetjunkie wrote:
From an interview with Scott Guthrie: "We started the development of ASP.NET in 1997->1998"
The first version already ran that new year's weekend 1997-1998...


I suspect that would have been a compiled version or ASP-like functionality available ("Controls"), perhaps via a "proper" API available to any language, certainly nothing like the ASP.NET we have today that is fully managed and OOP.
I'm a fan of .net, but I recently got into RoR and here is the experience I had:

It was somewhat confusing until I read the Agile Web Development with Ruby on Rails book.  It is one of the best programming books I've ever read.  It's clear and concise and explains things in a way that is suitable for all levels (if you're a guru you'll skim some chapters but you'll still be glad you read them)...

Rails is a highly productive system just like asp.net, but here are the differences:

With asp.net if you're writing a serious app that you want to be simple, conceptually clear, etc., you write data acccess classes with methods to handle the IO with the database.  You then write your business logic classes that call upon the data access methods when necessary, and finally you write your user interface, which interacts with the business objects.

In asp.net doing all this requires a fair bit of thought and a lot of coding of very similar methods, particularly in the data access classes.  I used to find this quite boring and often resorted to cutting and pasting code and doing search and replace when something changed.

In Rails you get ActiveRecord which creates all of those data access methods automatically.  You can tell these "model" classes what fields are required, which are read only, etc.  If you've seen the blogging application in the demo video, you've seen the has_many and belongs_to relationships.  With Rails, rather than writing SQL joins you simply define these relationships once.  Then, you can use object oriented syntax such as user.posts to grab a collection of all of a user's posts.   If you have a users table you have a User data access class automatically.  If posts have a user_id, then you can call user.posts to find a list of posts.

With rails 1.1 (coming out in a few days) the power of this functionality has been increased DRASTICALLY to handle a lot more obscure kinds of joins automatically.

Rails gives you all this for free so you can focus on writing good business logic and maybe a few test cases too.  Business logic in Rails is known as your "Controller" classes.   Look up MVC to see how they got that terminology.

On the "view" side you get a simple templating language very similar to asp and asp.net's, which is nice so there's virtually no learning curve. 

As your app changes and you add more complexity and features, the standard layout of a Rails application makes this ultra easy to manage.  You'll find (as I did in a HUGE way) that you'll be able to tackle projects that are bigger than those you'd have felt comfortable tackling using other platforms.  Why?  Because you'll know that you'll be able to think about designing the app rather than managing a bunch of files and data access methods.

The Ruby language example above is highly misleading.  It's extremely easy to learn, and you can hold off on learning some of its more guru-oriented features, because it's unlikely that you'll need them for most web applications.  Simple stuff like doing business logic, creating dynamic web pages, etc, is so easy that the Ruby syntax doesn't really even need to be taught.  There are a handful of conventions that the book I recommended above dedicates a few pages to and that's all you need to worry about until you get to the point where you're bored some evening and want to learn about closures and duck typing, etc. 

I've recently been looking into Scaling rails apps, and all it requires is a shared folder for storing session data and a standard stateless clustering system.  You can even separate out different app servers if you want to and let your web server avoid that workload.   Setting this up is not plug and play, but it will be easy for anyone reading this forum.

The Ajax integration is also top notch and makes writing slick Ajax stuff absolutely cake.  I'll let you discover this for yourself though, because I don't want to ruin the fun you'll have.

So my advice to you if you're curious about Rails is quite simple:  Buy the Agile book.  I got it for like $23 on Amazon.    If you're a guru you don't need this book, but I think it will save anyone time, since the tutorials that are on the web aren't really all that great, although this is changing.  Also, download RadRails and check out the ctrl-shift-v feature.

One other note, rails gives you a real time development log that shows the exact queries that it's generating w/ ActiveRecord and their overall performance impact.  If you see something that you want to change, you can simply write a method that uses hand-tuned SQL, or even just use SQL in one of the find methods that you get as part of ActiveRecord:

User.find_by_sql("SELECT blah blah outer join blah IN (SELECT blah)")

Oh and if you put the word breakpoint in your code there's a slick utility that lets you get full access to the running web app, this is every bit as slick as Visual Studio's debugging of web apps.

Now here is my fluff comment about Rails:

I think one of the best things about Rails is its aesthetics.  The code looks great, is free of extra syntactic garbage, and you feel like you do when you use an iPod, like you're using something built with top-notch craftsmanship.  

Also, the #rubyonrails channel on IRC has been a lot of help to me.  If you're patient there is usually a guru in there who can help with most any question, though I recommend reading the Agile book first so that you'll have a bit more of a clue and avoid wasting too much time with the rather cryptic documentation at api.rubyonrails.com


unix? wrote:
It is nice to see that the yield keyword in C# 2.0 is coming from such modern languages like Ruby.


Not to be pedantic, but ruby got the yield thing from a language called CLU (I learned that while reading the PickAxe book (Ruby bible). Although still possible that C# got yield from Ruby, it seems more likely that it stemmed from the school of thought that subscribes to super high-level languages like CLU.

Rails piqued my interest last summer when the Agile book was still in PDF form, so I bought it. I didn't really get into Rails until the last few months, but I've completely switched from .NET and am never going back. I just got a job doing Rails development and I'm stoked about it.

I don't have any problem putting .NET and Java in the same category, they're found in most corp IT departments, running side-by-side. Their syntax is loosely similar and equally verbose. Their budgets are always bloated and development time is never short.

Ruby is simple and elegant. ActiveRecord kicks butt over all (who else can claim anything remotely similar, out of the box?).

There are other equally kickass frameworks, django is one (python MVC framework). They all have the same common goal: less code, shorter development, less bugs, happy coding. That's what drew my attention in the first place and after trying it out I couldn't go back.

I'm not a rails snob, just a "less development, less code, less bugs" person. Choose your MVC and have fun (C#/Java/PHP are _not_ fun).
From 2002 untill now C#/ASP.NET 1.1 and 2.0; windows application, compact .NET, web-services, SQL server and before 2002 VC++/MFC and ... I'v done.
So I know "microsoft" enough to speak about it.
Day by day something was comming close to me and at last I realized it. I am not programming; I am microsofting. I am doing stupid things just because microsoft does not want loose titely coupling between it's products.
I am a part of microsoft machine.
In less than 1 year I will no longer have anything microsoftish on my computer. I have strongly started that.
.NET seems good? Still to me? Yes! but my experiences with MS says to me that's just a new, huge, well managed kind of faking things.
If anyone wants going microsoftish - and there are enough - I do not care anymore.
No one likes to be used! Me too!
Another_Darren
Another_Darren
... than you can shake a stick at
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}



And you if typed out the same code in C# with not clear var names, no comments and no structure to the control or flow, it too would look horrible.  Also remember it's not strongly typed so doesn't need all the extra code defining each var.
Another_Darren
Another_Darren
... than you can shake a stick at
Harlequin wrote:
Ruby isn't compiled like .NET/Java is it?

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


Why? It can achieve the same as ASP.NET? 
Meh, Ruby is a nice language but RoR really doesn't excite me as much as LINQ and C# 3.0 does (ASP.NET Orcas has an OR mapper I believe also?).

Anyways, my question is what editor is he using on Mac OSX for that first tutorial?  I *love* the color scheme & fonts it uses, and would like to configure VS to look like that Smiley

It's longer than 5 to 10 minutes, but check out this video about a Dynamic Data Website in ASP.net:

 

http://www.asp.net/learn/3.5-SP1/video-433.aspx

 

For more videos on the subject, go here: http://www.asp.net/learn/3.5-SP1/ and scroll down to the section titled "ASP.net Dynamic Data".

page 2 of 2
Comments: 38 | Views: 39504
Microsoft Communities