One of my personal goals for our little ALT.NET movement is simply challenging the status quo for building .Net applications. We might end up exactly where we started from, but let's at least take a look around for other alternatives and really consider whether what we're doing is the best way. A perfect example is the reconsideration of basically everything we know about developing web applications with WebForms.
The specific argument I'm reading about today is about whether or not it's appropriate, useful, or downright evil to use inline scripting in the actual markup page. Here's what I've been reading today. More from me after the break.
It's About Being Disciplined and Open Minded (Steve Harman) - Actually the title pretty well sums up what I think anyway, but that'd be a pretty short post now wouldn't it? Crazy Talk: Inline Scripting and Code-Behind (Rob Conery) More Crazy Talk: Inline Scripting and Slinging Text (Rob Conery) Have We ASP.NET Geeks Lost Something? (Rob Conery)
To be honest, I'm mostly a spectator in this argument because I've barely done any web development since 2002. I've done two WebForms projects but most of the heavy lifting was in the backend and middle tier, so my opinion needs to be taken with a grain of salt. If nothing changes between now and then, I'll be on a MonoRail project in January and I'll spend parts of December remembering how to do HTML and JavaScript.
Like many other people, I use ASP classic circa 1998 as a byword for sloppy spaghetti code. The code could get absolutely heinous as everything but the kitchen sink would be poured into a single ASP page. I learned ASP classic largely by reverse engineering the ASP pages that MS Access 97 produced from its wizard functionality. Looking back, I know that my early code was atrocious. Later on we started to experiment with pushing more and more functionality out of the ASP markup and into nonvisual VB6 COM components, but that never felt smooth and wasn't widely accepted because of the deployment irritations of COM components. Putting more logic and control in stored procedures was another choice that many of us fell into out of frustration with COM or ASP, but I refuse to open up that can of worms again.
When the early plans for ASP.NET and WebForms were announced I was ecstatic. Treating the elements on the page as stateful objects in an OOP fashion? Brilliant!
I had to jump jobs to get out of my noncoding architect role to do it, but ASP.NET was finally in my grubby little hands. One of the first screens I built was some sort of grid with a requirement to activate some sort of server side function or navigation when a cell was clicked. I don't remember the details, but it was the kind of task I could do in my sleep with a little bit of client side JavaScript in the old world order. In the new world order I had to know about all these new events off of the DataGrid control and learned that WebForms played hell with client side scripting by screwing up the element id's. I was thoroughly irritated and it never got better over the next couple years. I thought then, and still do, that WebForms makes many things harder instead of easier. The cool design time stuff doesn't make up for how much more complex WebForms is compared to classic ASP. ASP classic suffered because we didn't pay enough attention to separation of concerns. Maybe the better answer would have been to conquer the Separation of Concerns problems with ASP classic instead of trying to so drastically changing the development model. We need to continue to question WebForms just in case it's not really the right answer for web development.
Other Questions (with very loaded phrasing )
- WebForms out of the box doesn't do much to promote separation of concerns either, so what did we really improve?
- If we'd beaten the spaghetti code problem in ASP classic instead of drastically changing the UI model, would we be better off today?
- Might we actually be better off working directly with HTML elements and JavaScript than trying to use a very complicated set of abstractions on top of HTML?
- Is Visual Programming really the fastest way to build software? Because if it's not, we need to rethink most of the .Net tooling.
- Is Visual Programming really the most approachable way to build software?
- Every other platform uses inline scripting, and most other platforms also use some sort of MVC framework or another. Wouldn't it be advantageous to work like that? Wouldn't moving .Net web development closer to the more common model make it easier for us to switch platforms and to onboard folks from other platforms onto .Net?