Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming

Web Browser Programming Blurring the Lines of MVC 303

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."
This discussion has been archived. No new comments can be posted.

Web Browser Programming Blurring the Lines of MVC

Comments Filter:
  • More Importantly (Score:5, Interesting)

    by Alt_Cognito ( 462081 ) on Friday November 28, 2008 @01:40PM (#25917139)

    The lines between what is an application are blurring. We have disparate data sources which are being combined in ways which the original sources never necessarily intended. The user application may or may not even be one written by the service provider.

    The semantic web, despite all the nay saying, is here.

  • by erroneus ( 253617 ) on Friday November 28, 2008 @02:23PM (#25917399) Homepage

    It can almost never happen that a project could ever adhere 100% to idealistic notions such as MVC, which in a nutshell is the separation or containment of business logic from the user interface. The communication can almost never been isolated into a one-way path of communication for any given type of communications. So the fact that the server doing the business logic might also need to change the javascript code on the client side in order to refine or adjust behavior is simply to be expected.

    These sorts of compromises are necessary unless we change the minds of users everywhere to appreciate and be willing to work within the limitations of the MVC model. So yeah, we already know that users, especially executive users, management users and especially consumer users, are not prepared to sacrifice their preconceived notions about the way things are expected to look, feel and behave... the systems need to deliver to expectations and that quite often requires numerous compromises to programming idealism.

    I have "soap boxed" on this topic especially where Microsoft's backward compatibility "bloat" is concerned. With each new release of Windows, Microsoft misses an opportunity to shed itself of backward compatibility bloat through a variety of means many of which would be completely invisible to the end user... especially solutions that have to do with virtualization and emulation. But instead, they keep supporting old bugs and behaviors and the bloat simply builds leading to the results we see in XP and Vista. While I can state that I completely understand why Microsoft does it, I cannot agree with their perpetuation of this model since thing are coming to a head and the public disapproval of Vista [and Mojave?] is testament to the fact that people are no longer just going to swallow whatever Microsoft serves up and that the power of common, off-the-shelf PCs are not generally sufficient to conceal the bloat and poor performance of Vista.

    Okay, I somehow made this about Microsoft. Apologies to those offended. They are simply a very convenient example of a compromise of programming idealism to enable a project to fulfil user expectations... the user expectation of backward compatibility is a large part of why Windows is so bloated and unreliable and I will be the first to admit that Microsoft has done a pretty amazing job of managing the situation as much as they have... think about the enormity and scale Microsoft's maintaining of backward compatibility and you will have to agree.

  • by girlintraining ( 1395911 ) on Friday November 28, 2008 @03:31PM (#25917963)

    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.

    So you don't mind if I use a butter knife instead of a screwdriver? That's a relief. I haven't found a man yet who doesn't cringe at the prospect.

    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.

    Perhaps in the same way that poor solutions arise to placate poor decisions. Some people have advocated mass-execution of cows to help halt global warming.

    If you write a C++ program and compile it down to one architecture, how many users do you have?

    About the same as the number of people who find that application useful.

    If you write a browser, OS, architecture neutral application and make it available to everyone online, your user base skyrockets dramatically.

    Okay, you can go play Kings of Chaos, while I go play World of Warcraft, since World of Warcraft has fewer players and I like the "small town" feel of it.

  • Not even MVC (Score:4, Interesting)

    by GrouchoMarx ( 153170 ) on Friday November 28, 2008 @04:11PM (#25918213) Homepage

    I have long argued [garfieldtech.com] that MVC doesn't even make sense on the web to begin with. MVC is a great architectural model for live interactive systems, but a web site or web app is not a live interactive system. It's an asynchronous challenge/response system.

    I blame Sun for completely abusing the term in their Java stacks (I think they called it "model 2"?), and Ruby on Rails for popularizing the wrong impression. MVC by definition requires a direct observer connection from View to Model. All web-MVC frameworks I've seen start with the initial statement that the Controller, not the View, is responsible for handling user interaction and communicating with the Model. Sorry, that's not MVC. It's not a bad model for the web, but it's not MVC. If anything it's closer to PAC.

    See the link above for a lengthier analysis and links to Wikipedia. :-)

    Really, the whole point of design patterns is to have a common vocabulary. How is that useful if you're going to bastardize your terminology due to stubborn ignorance?

  • by Anonymous Coward on Friday November 28, 2008 @04:26PM (#25918337)

    But Javascript or ECMAScript isn't a 'real' language, or at least not in practice, and that's the issue. Code written in it needs to run on multiple different implementations with no properly accepted standards.

    You're confusing DOM implementations with Javascript. Javascript is a language with a well-defined standard, and no implementation deviates significantly.

    Browser DOM implementations vary wildly and cause the problem that you're talking about.

    I used to think that Javascript was a crap language, for mostly the reasons you outlined. Then I actually looked into the language and found that, despite a few shortcomings, it's a perfectly find functional language. People misuse it due to its similar syntax to Java and C, and crappy, incompatible DOM implementations further give it a bad name (but that's not its fault.)

  • Re:Not even MVC (Score:4, Interesting)

    by Shados ( 741919 ) on Friday November 28, 2008 @04:53PM (#25918547)

    (I think they called it "model 2"?),

    Lets make things clear first: MVC model 2 has nothing to do with the original MVC, as you already pointed out. The original MVC isn't used much, not even in live interactive system anymore, so they reused the term, and clearly documented it (it made sense at the time: there is a model, a view and a controller, and its a strict design pattern, and the original MVC is rarely seen outside of legacy system and 4G tools that die faster than they pop up).

    Otherwise, you end up with a lot of terms that eventually all mean the same thing but not, and it is even more confusing. The main issue came with people thinking that MVC is ANYTHING with a model, a view, and a controller. That put aside, there's no abuse of language here. There's MVC, and MVC Type 2, and if you're talking about the web, aside in extremely rare scenarios, you're always talking about Type 2, so its redundant.

    Still, that doesn't change much... MVC, because of frameworks like Struts and Rails is seen by the unwashed mass of developers as the "end all be all: if its not MVC, its not a well architecture application", totally ignoring all of the alternatives. Now THAT is a problem. MVC Type 2 is only good for a subset (large, but still just a subset) of web apps.

  • by lysergic.acid ( 845423 ) on Friday November 28, 2008 @10:14PM (#25921139) Homepage

    while you may be right about some aspects of the Middle English creole hypothesis [wikipedia.org], the Norman conquest of England certainly had a profound effect on the evolution of the English language. language is a social/cultural construct. subsequently, its evolution is inextricably tied to the social & cultural development of a region. after all, a diachronic analysis is meaningless without historic context.

    the fact of the matter is, the Norman conquest was a vital chapter in the historic narrative of the British isles. i would be very surprised if 300-odd-years of Norman rule had no effect whatsoever on the development of modern English. i mean, the Normans basically supplanted the English ruling class, replacing the entire English nobility with new Anglo-Norman-speaking Norman nobility.

    it's true that the (disproportionately large number of) French and Norman loanwords used in the English language were largely borrowed after 1400, by which time English had returned to use in government and in the king's court. and the grammatical changes in English followed a pattern shared by many other Germanic languages. but the Great Vowel Shift was almost certainly influenced by Norman occupation in some way or another.

    it should be noted that this (1200-1600) was the time when the language of the aristocracy was gradually shifting from French to English. this likely changed the prestige accent of English by making it sound more French in style. another possibility is that due to England being at war with France throughout much of this period, the French-speaking nobility may have been more susceptible to hypercorrection [wikipedia.org] in an attempt to change pronounciation to something sounding "more English."

    in fact, the shift from French to English as the language of the aristocracy/ruling-class may have contributed more to the rapid changes undergone by the English language to form modern English than the period of Norman rule immediately after William's conquest of England. firstly, William and his successors up to, and including, the early Plantagenets, such as Angevin kings, were all absentee rulers for the most part. the administrative system William set up allowed he and his successors to rule from France by writ. similarly, the early Anglo-Norman barons were also largely absentee landowners, who consider France their true home, and spent the majority of their time in France.

    so it would make sense that it wasn't until much later, after the Anglo-Norman nobility had begun assimilating and interacting directly with the native English population, that these transformations in the English language began to take place. this was also the time of the Great Plague, which drove mass migrations to the South East of England causing different dialects and accents to intermingle and modify each other in order to standardize pronounciation. the rise of the middle class in London and upward social mobility caused by the pandemic hitting the aristocracy could also have driven (or accelerated) social interactions between the Anglo-Norman aristocracy and the English masses.

One man's constant is another man's variable. -- A.J. Perlis

Working...