Web Browser Programming Blurring the Lines of MVC
lkcl tips his in-depth article up at Advogato on the difficulties for the MVC programming model that are introduced by Javascript and AJAX, and solutions for them. He writes: "This article outlines how the MVC concept is made incredibly awkward by the gradual but necessary introduction of Javascript and AJAX. A solution is found in the form of Javascript Compiler Technology such as GWT or Pyjamas (PyPy's JS backend or Rb2Js could be used, with some additional work). The article outlines how and why the traditional MVC patterns are fragmented by Javascript and AJAX, advocating that if a site is programmed purely in a high-level language that is then compiled to Javascript for the Web Browser sections, the same high-level source code can be executed either client-side on the browser, or server-side, or even both, depending on the requirements. The implications of this approach are discussed in depth."
And it's a fucking mess.
You know, distributed computing is hardly a new thing, so why is it when the dream of all those researchers a generation ago comes to life, it's in a chaotic, difficult and barely-framework framework like AJAX? It's rather like someone a couple of hundred years ago dreaming of the automobile, but when it's finally developed, it's got two front wheels, two horses legs and the driver faces the wrong way.
The world's burning. Moped Jesus spotted on I50. Details at 11.
Call me jaded, old, and behind the times... But what ever happened to a web browser just being a web browser instead of a development platform with three heads breathing fire, half a dozen plugins, six months of combatability testing, and a kitchen sink? Is there ever a point where a web developer will concede that the web is not the Best Platform for Everything in The Universe(tm)? Or is it just that they were never schooled in the old temple and given a proper appreciation of a real language like C++? Help me out here -- this isn't intended as a flame but an honest question -- where does this attitude that everything has to be crowbar'd into a web interface to be considered modern these days? Because a lot of the problems in this article come down to programmers expanding and bloating their platform/language of choice to do something it was never designed for because That's Just What I Know(tm). :( I cry for these languages. I know after 5pm they go home and hit the frozen dairy products hard to feel better about how fat they've become.
#fuckbeta #iamslashdot #dicemustdie
I agree. If the semantic web were a parachute, we'd have a lot of dead base jumpers. Some of the idea behind a semantic web are good, but terribly difficult to implement. It's truly a tower of Babylon problem. If (big if) everyone ever agrees to how to handle/interface to web resources, we still all have to learn how to describe things. I call it 'you suck at Gimp' but you call it tutorial, and yet someone else calls it 'fun with Linux apps' and that is just for something easy. It gets worse depending on the subject and the problem can be seen in tag clouds. Definitive descriptions of web resources will hinder the semantic web until it dies.
Support NYCountryLawyer RIAA vs People
... schooled in the old temple and given a proper appreciation of a real language like C++?
You're going to have to inform us "young'uns" of what is and isn't a "real language." You see, I can't even begin to help you until you concede that if a tool gets the job done, it's a good tool. It might not be the best tool but it's a good tool. Stop making inflammatory statements.
What you misunderstand about this change of direction is that microarchitectures and new hybrids of old design patterns are arising to meet the needs of web developers.
where does this attitude that everything has to be crowbar'd into a web interface to be considered modern these days?
If you write a C++ program and compile it down to one architecture, how many users do you have? If you write a browser, OS, architecture neutral application and make it available to everyone online, your user base skyrockets dramatically.
I cry for these languages.
And these languages cry for you and your closed mindedness towards new ideas. Java was a bad idea at first and yet somehow it has found a niche--more than a niche if you ask me.
I'll meet you half way, I agree C++ is far faster than anything I've been paid to code in. Now you come the other half of the way and maybe we'll have a discussion here where useful information is exchanged.
My work here is dung.
If you do most of the stuff client side that could mean the server has to figure out what are valid _end_ states from tons of possible intermediate states. Sometimes that might not be possible.
Why? I'd think the server would just need to know "is this client permitted to view/modify that data", which really has nothing to do with any intermediate states. All it has to care about is who the client has authenticated as, and what the (entirely server-side) permission database says.
Model does not mesh with reality, please adjust reality to conform? Having been developing software since long before words like "methodology" and "design pattern" were introduced I'm somewhat skeptical when they're uttered. The Romans were adept at deploying the design pattern for a stone-built semi-circular arch but that doesn't mean that whenever you need to get water across a valley you should rebuild the Pont du Gard.
After quickly skimming the article, it seems that the "problem" isn't so much with MVC itself as it is with people not understanding what it is. Apparently, a lot of web developers have thought that "model/controller = server-side, view = client-side". This is obviously wrong, and, of couse, JS and AJAX become extremely confusing to categorize in such a system. No surprise there. Also, article makes a big deal out of the "problem" that JavaScript can be used to work around the requirement that "server generates the view" - but of course, it was never a requirement of MVC, either, and indeed, the original MVC did not imply any sort of "generation" of the views.
Of course, the something-to-JS compilers that are so popular these days won't help, either. JS-the-language is good enough, replacing it with Java (or Python, or Ruby) on the client doesn't really help much, so long as the dividing line between the client and the server remains.
Yeah I'm pretty tired of people crapping on PHP and by extension those of us who use it (by choice or necessity).
Yes it has its problems (not the ones mentioned in the article which are either out of date (magic quotes) or PEBKAC (most of the rest), but there's nothing that major.
Like anything, use it improperly and you'll come out with crap.
Also to be honest there's no problem with AJAX and MVC, your Javascript should be making requests to your server-side controller(s) in the same way your generated HTML does (the only difference is your requests and responses are async in comparison to your regular HTML initiated GETs and POSTs). Any application logic in Javascript beyond interface manipulation just means you're doing it wrong.
There's always going to be some processing going on for the view layer (whether it's during HTML generation, or at 'run time' in the browser as JS).
HTML + JS suck for making applications, but not for the reasons in the article.
Incidentally if you're after an event driven widget framework for PHP then Prado looks interesting. Seems similar to Tapestry for Java. Far less restrictive than horrors like GWT. I've not used it myself though as I don't think it's really compatible with my homegrown MVC framework, so I can't vouch for it.
Which is fine for the most part but I think peoples lack of care over things like MVC, nicely written code, etc has really ruined the web.
I disagree. I've been using the web since the Mosaic days, and I must say - it's better than ever! You can find what you're looking for more quickly, the content is richer and there is more of it.
A particular design pattern is NOT a silver bullet. I've used M$ Ajax/.NET to develop some websites and applications, and I was very pleased. Sure, it could use improvement, but what cant? Using it was way better than try to do some of the things manually. If the application works well and the code is maintainable, you have succeeded. As long as you plan out your application properly before you start writing it, things will go smoothly down the road.
I've worked on a project with C code that dates back to the 80's. It's not OO and doesn't knowingly follow any strict design patterns, but guess what? It's easy to follow, well documented, and above all, it does it's job!
I will say it again: If the application works well and the code is maintainable, you have succeeded.
php being knocked like a GOTO statement *sigh* the problem is not the language but how it's used.