If you’ve been reading my drivel as of late, you’ll know that I have moved full steam ahead with MVC, for better or for worse, ’till death do us part… or until MVC catches me shacking up with a much younger framework and sues me for everything I own. Either outcome, I going with it for a while. Why? Well I could name a couple reasons but the main thing I just like how easy it is to use jQuery with it do to how “RESTful” is it. Silly, I know.
Well I have put out some things about certain catches with MVC and it started to make me wonder about why I’m having so much trouble with certain aspects of the framework. It isn’t the modularity. I really like the controller concept. It isn’t the attributes instead of base pages to take on certain repeated checks (Say if the user is logged in), it fact I’ve embraced them. No the problem lies in the last few years of my short but uneventful programming career.
In the beginning there was ASP
I’ve admitted before, or at least I think I have, that I’ve only been doing this for about 7 years. I wasn’t the kid that started programming on an Apple II (E, C, GS, you can take your pick. Had them all growing up), I didn’t find programming those mini computers (You know the ones that basically had a strip of plastic that served as a monitor) all that much fun, and I surely didn’t sit around in my youth trying to hack into anything put in front of me. I just wasn’t that guy. In fact I didn’t start programming until around 2000 or so, the hey day of ASP. Now at that point in time, what a page could do was pretty limited. You could show tables, you could click links, you could post data to save. It wasn’t pretty but it got the job done. For the most part, web programming was just a step up from kiddie scripting and a small step down from VB Weenies. Fact was, it wasn’t very complex and site design reflected this. Sure there were a few that could push the limits, but the limits were pretty low.
You can cut a tin can with it.
ASP.Net… or at the time “.Net”. .Net was this almost mythical name that seemed to be used for everything from solving the complex page dilemma to removing that nasty “cranberry” stain from your expensive sheets that you can only buy in Sante Fe. At first people were sceptical, and why not be? Microsoft was pushing it as the universal key and at the time that seemed pretty impossible. Then people started using it. Sure it was messy at first. A lot of the people from the ASP walk of life either had forgotten how to program in forms or just never really learned. (Yours truly) Now all of a sudden there was a separation of mark up and code, and some crazy thing called post back, and wow what the hell are events? Classes? Double You Tee Eff? It was like this wave of excitement that web programming had grown up and it was the real deal. And it didn’t stop there.
Give a man an inch…
Well it didn’t take long for the over ambitious (IE Sales people) to start pushing the envelope of what could be done. Every time we reached what we thought to be a summit, someone would see if we could climb the next mountain… that happened to be twice as tall. After all it should be safe to assume that if you can make it up 10k feet, then 20k shouldn’t be that much harder right? All of a sudden “Can you do this?” had turned into “What I want is this” and for the most part it was possible. (Though ugly at first)
I want a page with data that I can edit.
-We can do that.
But I don’t want to be taken to another page
-We con do that
And I want it update when I save something without leaving the page
-We can do that
And I want it to seamlessly incorporate a bunch of different information from a million places and have it handle each part of the page differently but also have it handle all of this without leaving the page… and I want it done in two weeks.
-We can do that.
Of course this incredible feeling didn’t really allow us to think about the cost of all of this. Things like Viewstate, Session, gigantic pages with a bountiful of html, inability for smart phones to browse or at least load quickly, ect ect ect. It didn’t matter, because we were able to give the customer what the customer wanted: A Winforms program without the installation process. And over time, this has allowed pages to be so complex in structure that it you really couldn’t tell it was a web site if it weren’t for the browser.
Just because we can do a thing doesn’t mean we must… do that thing.
WebForms, as the cool kids cal them now, opened up a whole can of worms. They made it easy to create incredible complex pages with relative ease. And to do so they bent the “rules” of the web to allow for greater ease of development, at least that’s what you hear from MVC proponents (And REST people). MVC brings us back to the time when programming didn’t pervert the system, and at it’s core it isn’t pretty. Taken just as is, with the tools that the MVC framework has, the complex Web Forms we grew accustomed to are just not possible without a ridiculous amount of work. Heck a simple button press becomes much more complex in order to mimic a Web Forms post back. And that’s the problem… I’m trying to emulate something that MVC wasn’t built for and in a way could be argued that the web wasn’t built for: The post back. The Post Back is one of the key parts of Web Forms that allowed for so much and it really isn’t in MVC. I mean it could be. You could load up all the page/view functionality onto one gigantic controller but that kind of breaks one of the strengths of MVC: Modularity. Fact is, that little guy helped shape the way we think of site design and programming. (Not to mention viewstate but whatever) It allowed for so much to be done with so little effort. It gave us a bridge to winforms. For right or wrong, it gave us a solution and it also reprogrammed our future ideas.
Who has time for principal?
When conversing with other people about MVC, I had stated the whole “It’s the way the web was intended” line (Which personally I really don’t subscribe to because in a way I don’t care) and someone rebuked, “If it gets people what they want, then who’s to say what’s right for the web?” And I have to agree with him on that. I mean, it’s not like there’s life on the line here. If I move to MVC purity there will still be hunger, still be war, still be movies made by those idiots that brought you films like “Meet the Spartans” and “Disaster Movie”. (Although if Microsoft could solve that problem with MVC, I don’t think we’d have Web Forms anymore. Get on it Microsoft…) In the end, isn’t that what matters? Getting things done?
The beat marches on
So where do I go from here? If anything, I think the 800 gorilla is that I have to start designing web sites in a new way. Have to unlearn all of the things I got from WebForms and take myself back to the day when things were more simple. Even with advances with Asynchronous Calls, I still have to develop a completely different state of mind. Is this a bad thing? Time will tell. It’s possible that this is a fool’s errand but it’s also possible that use of MVC will bring forth sites with better structure and more reasonable functionality. After all it’s possible that post back derailed good site design.
Let it be noted
Before the comments about [Insert Javascript Library] start to pile in… HAHA comments on this site… Ok let’s pretend I get comments and the would be comments about [Insert Javascript Library]/Asynchronous calls(Let’s just call it JLA for short) calls, right or wrong I see JLA as a work around. It’s a way to allow for the complexity of said Web Forms without changing the MVC framework or relying postbacks. But even with those you still have a lot of unfun code that barely makes up for the loss.