logo

Stop Press: ASP.NET MVC Rocks

Is anybody following along with the ASP.NET articles? I won't hold it against you if you say no. It must be obvious my heart's not in it? I'd forgotten just how much time you need in order to write a decent, well-thought-out technical article.

Instead of taking my time (which I don't have enough of) I've been rushing the articles. Still, there should be something to take away from them. I just don't feel very proud of them as it stands.

I'll continue with the articles, assuming you want me to though?

Since starting the articles Ferdy Christant convinced me to take a look at ASP.NET, which I did, and I now have that horrible feeling I've been doing it all "wrong".

I've not touched any flavour of MVC since I fell for Ruby on Rails five years ago. I came away from Rails amazed, but with an idea of what it was best suited to. I then assumed that's all MVC could do, whereas, obviously, there's no reason MVC can't be used for any site.

Within minutes of creating a new ASP.NET MVC 3 project in Visual Studio I got that same feeling I remember getting 5 years ago with Rails. The "Wow, wow, wow!" feeling. I've not really had the feeling since then. It's the feeling that makes you want to stop what you're doing and spend the next week just playing with what it is you've discovered.

One of the things that caught my attention was the Razor "view engine". It lets you code like this:

image

Nothing clever about the code. But. The best thing about what you see above is that I just made it up. In a kind of "I wonder if this would work" kind of way.

In reality you'd pass the View a Model of data, like so:

image

Which would produce:

image

Either way, I love it when things just work how you'd expect them to. Couple the simplicity of what you see above with the power of VS's autocomplete and it makes for an amazing coding experience you can only do justice to by using for yourself.

There's much more to MVC than an easy way to create HTML. It also makes lots of other aspects of web programming much less painful. Trust me.

The other thing Ferdy convinced me to look at was LINQ-To-SQL which seems like it will take a lot of the misery out of what I've been describing this week in using TableAdapters.

It's a shame I made this discovery so late in the day. Although I can seek solace in the fact that everything I've learnt with the WebForms approach acts as a good grounding in the base .NET approach to things. No regrets, but I do wish I'd taken a look at this a few months ago.

For now, I'll assume there's interest in me continuing with the ASP.NET stuff? If you're new to it I'd still suggest at least getting in to it this way before looking at MVC and stuff.

Comments

    • avatar
    • Nick
    • Fri 4 Feb 2011 07:33 AM

    I would keep doing what you are doing...

    A majority of your readers, we inherit other code. We also have to build new stuff, in the 'familiar' way. None of which are using MVC or Linq. Any new people coming in, will deal with all of this existing stuff.

    Stick with showing the ground work, you worked on, and then 'graduate' onto the new advanced topics. Just a previous Domino to ASP.NET develops opinion. I would like to see how this goes along.

    • avatar
    • Pascal
    • Fri 4 Feb 2011 07:47 AM

    I'm following this series of article with great interest!

    • avatar
    • SK
    • Fri 4 Feb 2011 08:06 AM

    This series of article is superb

  1. I really appreciate the time you are taking. It takes a special person to want to share.. Especially with your other responsibilities.

    Thanks again.

    • avatar
    • Ferdy
    • Fri 4 Feb 2011 08:17 AM

    Jake, sorry to mess things up :) I know you secretly are happy I did.

    I think that for the sake of your readers, it is good to finish the original series, although I can imagine you have less passion in it now.

    It depends on what you want to achieve, really. If you are looking to introduce Domino people to the ASP.NET field, definitely continue yet make more comparisons with Domino terminology in the articles. If you want to produce unique, timely content concerning ASP.NET development for the whole world, this series based on the classic methodology is less relevant, as most can be found elsewhere (forgive me for being blunt).

    Best thing would be to do 2 series, may sound like a lot of work and it is. Yet, it is a fact of life that web development in ASP.NET is rapidly progressing, sometimes almost too fast to keep up.

    1. I want all the knowledge you can pass on. Wicked series. Definitely opens my eyes to other technologies

      • avatar
      • Jake Howlett
      • Fri 4 Feb 2011 09:46 AM

      My happiness is no secret. I could kiss you Ferdy!

      You're right. There's a mass of great content out there for learning ASP.NET, which would make what I'm doing pointless if it weren't for the idea that lots of people who read here won't go off and read it elsewhere. By putting it here (regardless of quality) people will at least take notice who might not have done before.

      Show the rest of this thread

    • avatar
    • Carl Abrahamson
    • Fri 4 Feb 2011 08:50 AM

    I'll take a "rushed" article on codestore.net over 90% of the other articles out there. You are quite skilled at writing, Jake, and have a knack at getting separating the wheat from the chaff. Keep it up... please...

  2. Echoing above, it's all good. Good to see how to do it both ways, good to have the walk through to come back and reference when I need it.

    All I want is a link on the codestore home page that goes to a list of series' so it's easy to hop in and start reading. Or a side bar or something. I did the side bar approach on one website where "the basics" were critically important for people to read through before reading other items on the site. (plug: http://fiducate.blogspot.com)

    As it was, we were snowed and iced in Wednesday and I used a few computers to start working through your series (long story) and had to keep scrolling all the way down to 1 (last Friday) to get started. I don't ask much, do I? :-)

      • avatar
      • Jake Howlett
      • Fri 4 Feb 2011 09:23 AM

      I've always meant to (over the last 10 years) to add a "part 2 of 10" links for articles in series. Maybe I will.

      What I hope to do when I'm done is put it all in a PDF file for download. Maybe even an epub file (I'm in to reading on the ipad at the moment).

      Show the rest of this thread

  3. MVC.NET is very slick, but be careful of the path it can lead you down. It is a wonderful platform when you own the datasource, but if you have to use data models that you do not own things get sticky.

    1. That's why a good abstracted DAO is so important! Built as a middle tier service, it makes for a nice addition to MVC, though I suppose strictly speaking, it breaks it into M - VC, which I have no idea as to the ability to do so with .NET. For Java you have SpringDAO at your disposal. Something similar somewhere in ASP.NET?

    • avatar
    • S.
    • Fri 4 Feb 2011 09:31 AM

    It's nice knowing you have liked it ^^

    After following your blog for many years (and learning a lot about Lotus thanks to it). I hoped you'll also follow the way of the MVC. Not just because I would have an extra excuse to keep following your blog, but because you always looked as a great web programmer, and hopefully with MVC you will be able to make much more interesting things.

    As I've been following your blog for so long, I would bet at sometime you'll want to use Ext/Sencha or jQuery, or JSON with any other JS library. This little code might not look like much, but it made me incredibly happy when I discovered C# anonymous classes (sorry for the formatting):

    public ActionResult animals() {

    try {

    var animals = ctx.Animals.Select(an=> new { name = an.Description; type = an.Family.Description }).ToList();

    return Json( new { success = true; data = animals } );

    catch(Exception ex) {

    return Json( new { success = false; errorMsg = ex.Message });

    }

    }

    I've written it just like that, so there might be errors (ctx should be the datacontext). You will be able to call the action and get json object in the browser that contains an array (called data) with the names and families of each animal. Creating an anonymous object also allows us to return wether there have been any errors, and if there was, the error message.

    Did I say I love MVC + Linq? :)

      • avatar
      • Jake Howlett
      • Fri 4 Feb 2011 09:38 AM

      Au revoir Domino

      Hide the rest of this thread

        • avatar
        • Nick
        • Fri 4 Feb 2011 09:51 AM

        I see a blogger of the year award for you in the future (MS that is)....of being the pied piper of Domino Web Developers moving over to .NET.

        Showing the things you are discovering, is enlightening Domino developers itself, and is a bridge to .NET and how easy you make the switch seem to be. So in that regards, you are an invaluable asset to the dwindling Domino Developers wondering what to do next.

          • avatar
          • Jake Howlett
          • Fri 4 Feb 2011 09:57 AM

          As probably the only person blogging about moving from Domino to ASP.NET I don't think there'd be much competition.

          There's no chance I'd win anything in the MS blogging area. Have you seen ScottGu's blog? Or Scott Hanselman's?Both MS employees who (I guess) are paid to produce quality content (you listening IBM?). And that's only naming 2 of them. There's loads and loads out there.

            • avatar
            • Ferdy
            • Fri 4 Feb 2011 10:02 AM

            I think Scott is actually the product manager of Visual Studio and a few more products, so no surprise that he is paid. He does seem to have one of the best .NET blogs out there.

              • avatar
              • Nick
              • Fri 4 Feb 2011 11:16 AM

              Yeah, he is employeed by Microsoft. You should see his presentations at the DevConnections conference. He is like a rock star there. It is definately a great conference to go to. To see all the things they are promoting, that are new, etc. I can't reccomend this any higher.

              When I went to a domino conference that was run by the View (not the tv show, the magazine). Microsoft sent people to give presentations for integration and other tasks.

              Some of the people there were previous IBMers. One being the project manager of the Domino Designer 6.5. Microsoft even employs Ray Ozzie now too don't they?

              Microsoft picks them up, they learn the tools, and then show domino folks how easy it is to convert to this different. How easy it is to set up the servers, etc. While on the domino side, basically said, hey, learn JAVA.

              IBM has gone about things all wrong.

                • avatar
                • Jake Howlett
                • Fri 4 Feb 2011 01:51 PM

                Which Scott are we talking about? I watched this video of Scott Hanselman presenting in Holland and cringed most of the way through it:

                http://channel9.msdn.com/blogs/matthijs/aspnet-mvc-2-basics-introduction-by-scott-hanselman

                Reminds me why I don't like watching presentations. I just want the information. And fast. If I wanted to watch a (bad!) comedian then that's a different event entirely.

                Search the comments on that link for "comedy" and you'll see I'm not alone.

                Having said that, the video (well, the part I managed to stick through) is worth watching as an intro to MVC.

                  • avatar
                  • Nick
                  • Fri 4 Feb 2011 02:22 PM

                  Scott Guthrie.

                  This reply is already 8 levels deep and so replying at this level is disabled.

                • avatar
                • Luke
                • Fri 4 Feb 2011 02:17 PM

                Yes, the same Microsoft that Ray Ozzie left with an impressive letter showing no possible future. But I agree with your Ibm views.

                Anyway, if the path to be chosen is MVC, I strongly believe the reference platform for web dev is Ruby on Rails. Much stronger than asp .net with this framework built on top.

                Btw: great articles Jake, as usual.

                  • avatar
                  • Nick
                  • Fri 4 Feb 2011 02:24 PM

                  Did not hear that he left, and did not hear about that letter. I would like to hear more about it.

                  This reply is already 8 levels deep and so replying at this level is disabled.

                  • avatar
                  • Jake Howlett
                  • Fri 4 Feb 2011 02:25 PM

                  This reply is already 8 levels deep and so replying at this level is disabled.

                  • avatar
                  • Nick
                  • Fri 4 Feb 2011 02:34 PM

                  I did. I read it.... I can see his frustration. I read in an article that said Lotus Notes, designed by geniuses, implemented by idiots.

                  This reply is already 8 levels deep and so replying at this level is disabled.

  4. +1 on please please for the articles! I haven't noticed any shoddiness.

  5. I'm not sure they are shoddy. They are covering some basic subjects but that's fine. You have to start somehwere.

    I think it might be not so much they are shoddy, but that when you were writing about Domino you were almost a lone light in a sea of darkness. How to practically do Domino web development well was like an arcane art.

    .Net, on the other hand, has a vast amount of information. This doesn't mean your unique set of experiences and writing ability don't add something new.

    But, the feeling of shoddy may be to do with the natural comparison with 'what else is out there'.

  6. Jake, why'd you move from rails? You look at Sinatra at all? Is there more work in the asp.net? Just curious.

      • avatar
      • Jake Howlett
      • Fri 4 Feb 2011 02:21 PM

      I never really used Rails that much. I just tinkered. I was *really* impressed though. Enough to make me buy a couple of books on it. This was when it was very young though and when I still had enough Domino work coming in not to need to seriously consider moving to it.

      More work in ASP.NET? I don't know. I just think ASP.NET is a good tool to have in my line of work where I'm increasingly being asked to just "build and host us a website to do XXX". I'm sure Rails is brilliant but ASP.NET hosting is widely available, coding in Visual Studio has made my work a tru joy and the amount of help and information out there is overwhelming. The only downside is that it's "M$". That doesn't bother me at all. I'm not in to that whole who's cool and who isn't. I'm a PC AND a Mac.

      Show the rest of this thread

  7. still reading and still finding it fascinating how the other 80 percent live. Sean

  8. Jake, I am following your series with great interest because you know how to write things down properly.

    While the .NET basics are a good starting point I would really be interested in a series about the fantastic Enterprise Library 5. Things like Dependency Injection with Unity are really interesting. You can build robust applications very fast with it (at least you could with Version 3 some years ago) but it is heavy stuff with a steep learning curve. So that would be the point where you could step in...

    Regarding the 'wow, wow feeling', I am a bit surprised that you are fallen in love to Visual Studio so much. I had the same feeling when I used JBoss Seam for the first time. While VS really is great I think that you can have all the features also for free with Eclipse and Java development.

    • avatar
    • Ian
    • Sat 5 Feb 2011 07:02 AM

    Have you considered using the Entity Framework for data access instead of Linq to SQL ? It first appeared in the .NET Framework 3.5 and had a mixed reception. There's a new version of it in the latest .NET Framework 4.0 which I hear is much improved.

    I've just created a very shoddy blog article about paging and sorting a GridView/ListView in which I used the Entity Framework to connect to the data (Microsoft's AdventureWorks sample database). You need to create an ADO.NET Entity Data Model project item which is under the Data category, give it a go.

    I'm looking forward to seeing the next MVC blog article.

    Ian.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Fri 4 Feb 2011

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content