Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Does ASP.NET v2 allow you to do the "wrong" thing?

A post today from Paul Wilson got me thinking about what the "right" thing to do is in terms of how you organize code in a Web project. One of the replies in particular implied that the allowance to put code right on the page (which you could do before anyway, without Intellisense) reinforces the old script way of doing things. I don't entirely agree.

One of the goals of my book was to teach former script people (like me) that the world object-oriented programming was worth understanding and implementing. In thinking about the things that cause a mental block for developers in transition, clearly Visual Studio's codebehind model was one of the problems. Not only did we expect the developer to think of objects and classes (oh my!) in more of an abstract sense, but we also wanted them to think about a system of files (assemblies, codebehind, pages) that were also spread apart in an unfamiliar way. The truth is, if you fought against VS, you could do things "the old way" anyway, it was just a pain.

Now v2 comes along, and we can comfortably put our code right there in the page. The design of an application can still be bad, just as it was in v1.x. I should know... the first port I did of POP Forums put the crap all over the place with no true reuse of code. It was a nightmare, but familiar ground for someone coming from the ASP.old world.

PHP is huge, and it's not going away. It's easy to learn. ASP.NET, as of v2, is also a lot easier to learn. The simplicity of the physical file layout makes it easier for a beginner to get their head around what's going on. The challenge is to get them to the next level, and this is what I've been telling bloggers, authors and publishers for two years now. I feel like no one is listening. You can't start bantering about design patterns with a transitional developer before they even understand what a class is. One does not go from script person to uber-code monkey. There are interim steps. In a world where we use iterative development every day, you'd think people would get that!

I guess what I really mean is, don't jump out there and say, "You're doing it wrong, stupid!" Tell people, "This is a better way to do it, and this is why."

4 Comments

  • *cough* SqlDataSource control *cough*

  • Jeff,



    Man, I'm right there with you on this one. I too ranted about this a couple of years ago: http://blog.dannyboyd.com/archive/2004/01/08/145.aspx. I'd not encountered your book. I'm ordering a copy for review as soon as I hit submit on this comment.



    Danny

  • "don't jump out there and say, "You're doing it wrong, stupid!" Tell people, "This is a better way to do it, and this is why.""

    That only works if the people you're talking to understand they NEED a better way to do things.



    That's the real problem. Similar to data-access stuff and how to do that in your application: it can be done in a lot of different ways.



    I think I can fairly say I'm a very skilled programmer. The thing is, I recently learned that I could learn a hell of a lot of stuff still, and it made me understand that my thinking was locked into a mindset which got a life of its own. Not that that was bad, but with newer insights it got way easier to write code more conveniently, which was cleaner, easier to use and a breeze to maintain.



    Knowing that, I realize that telling others there is a 'better' way of doing X, or 'you're wrong', is subjective. There's a DIFFERENT way of doing things, which has these X pros and cons. Do the math yourself. That's the approach I've been taking towards data-access and what you should use for some time now and it really works well: people aren't feeling belittled, on the contrary, they feel they've learned something new and understandable, and with that knowledge in their bag, they can make new decisions.



    Oh, what it was what I learned recently? micro-design for OO frameworks. Delegation of responsibility, and of that the really important factor: why.



  • In regards to PHP, theres Phalanger, PHP compiling on .NET: http://www.php-compiler.net/



    "don't jump out there and say, "You're doing it wrong, stupid!" Tell people, "This is a better way to do it, and this is why.""



    Ok, but most of the time "it just works" and people don't care what the "right way" is. They see these poorly implemented examples, cut and paste them, then their codebase is basically examples that have been expanded upon.



    Which goes back to a point I made a while back about "proper example" where we dont show examples that use a chain of += for string concatenation, etc etc etc.



    Paul is right, and I agree with him, as you do

Comments have been disabled for this content.