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:
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:
Which would produce:
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.
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.
Reply
I'm following this series of article with great interest!
Reply
This series of article is superb
Reply
I really appreciate the time you are taking. It takes a special person to want to share.. Especially with your other responsibilities.
Thanks again.
Reply
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.
Reply
I want all the knowledge you can pass on. Wicked series. Definitely opens my eyes to other technologies
Reply
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.
Reply
Show the rest of this thread
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...
Reply
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? :-)
Reply
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).
Reply
Show the rest of this thread
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.
Reply
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?
Reply
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? :)
Reply
Au revoir Domino
Reply
Show the rest of this thread
+1 on please please for the articles! I haven't noticed any shoddiness.
Reply
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'.
Reply
Jake, why'd you move from rails? You look at Sinatra at all? Is there more work in the asp.net? Just curious.
Reply
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.
Reply
Show the rest of this thread
still reading and still finding it fascinating how the other 80 percent live. Sean
Reply
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.
Reply
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.
Reply