Iain , I'm unaware of any good 'pattern style'
analysis of MVC. Everybody seems to agree it is a great pattern, but literature is sparse (correct me if I'm wrong). It would be interesting to compare MVC analytically to 'MVP' (from Object-Arts) and DHTML (used in browsers). I think it's important to understand the forces behind the MVC, to gain insight into how best to deploy it. (I'm not saying I necessarily do understand them). The MVC-forces as I see them are: 1) To couple the presentation from the domain objects, which increases the robustness of your software, and allows you to solve "one problem at a time". 2) To allow multiple simultaneous presentations of the same domain object, to show it from multiple 'perspectives' simultaneously, just like engineering drawings do. 3) To further encapsulate user interaction behavior into its own class hierarchy, which can be versioned separately from the model and presentation. For instance: what happens when a key on the keyboard is pressed. I've read about the Model-View-Presenter -variant from Object-Arts the producers of Dolphin Smalltalk, and actually used it a bit too. Unfortunately I'm still not able to grasp why exactly in Object-Arts viewpoint MVP is better than MVC. I'd appreciate any comments from those who better understand MVP. Is it possible to state the advantage of MVP over MVC in 2 paragraphs? Another interesting alternative to MVC is the model of Dynamic HTML: each view-element has its associated event-handlers. It seems there would be little benefit from dividing the event- handler code into a 'class' separate from the HTML -page that is the presentation. Although what is often done is to write the handler functions in a separate JavaScript -file. So I guess you could say that the .js -file is the controller, while the .htm is the presentation. The model? It would be the database from which the HTML is generated. Thanks for your comments Panu Viljamaa |
Panu Viljamaa schrieb:
> It would be interesting to compare MVC analytically > to 'MVP' (from Object-Arts) and DHTML (used in browsers). how do you want to do that? DTHML is by no means a pattern while the others are. DHTML is at best a technology, although the term "nightmare" is more like what comes to my mind. cu robert -- Robert Klemme software engineer -------------------------------------------------------------------------------- myview technologies GmbH & Co. KG Lindberghring 1 ~ 33142 Büren ~ Germany Fon: +49-2955-7433-20 Fax: +49-2955-7433-99 -------------------------------------------------------------------------------- The information transmitted is only intended for the person or entity to which it is adressed. It may contain confidential and/or privileged material. Any review, forwarding, distribution or any other action related to this information by persons or entities other than the intended addressee is prohibited. If you receive this by mistake, please contact the addresser and delete the material from any computer. |
Robert Klemme wrote:
> ... DHTML is at best a technology, although the term > "nightmare" is more like what comes to my mind. You can say that MVC is better than DHTML because DHTML is nightmarish while MVC is not. But the more interesting question is the differences in features, structure and capabilities that bring about this perceived nightmarishness. Can you elaborate a bit ? Thanks -Panu Viljamaa |
In reply to this post by Panu Viljamaa-4
Thanks for your replies.
Robert E. Newby wrote. > ...one great book that may > help you gain insight into some of your questions is "Pattern-Oriented > Software Architecture--A System of Patterns" by Frank Buschmann et al > (John Wiley, 1996). Higher level than "Design Patterns" by Gamma et al > (aka the Gang of Four, or GoF). Includes discussions of architectural > patterns including MVC. There is a long lead time from my usual supplyer on the book you suggested. It will be the third I have purchased (inc the GoF) to findout how to implement a complicated MVC architecture. I do plan to buy this book, but I want to look at it first to ensure it is exactly what I require. I am exploring how an existing diagram based development tool can be refactored to enable easier maintanince (it is currently a mess). The MVC or similar architecture seams the most worthy goal. My Domain is a graph, made up of nodes and edges. Nodes can contain tasks to execute when the node is processed and a layout if it is to be displayed. Edges can have special tasks called conditions that are executed to see if the edge can be followed. Nodes, edges, tasks and layouts are all complex objects so I would like them to generate symantic events "my label has changed" as opposed to "I have changed". I am planning to use functors to allow views and controllers to register for just the events they are intrested in. At any one time the user has a view of the graph as a flowchart and a context sensitive properties view (with other component sub views), depending what the user selects in the graph. >From what I can make out so far: If the user changes a node's label from the property view, the view should ask its contoller to change the node's model. The node's model then notifies all its observers that the label has changed. * However the graph view has to update its display of the node's label. Should the graph view (which is a flow chart) register for this event with all nodes and edges in the graph, or should these events be passed up from component model to parent model upto the graph model which would then notify the graph view? * Would this result in an explosion of events? Also there is session data based on the circumstances of the user editing the graph like: readonly & dirty flags, source contol status (which can change outside the editor) as well as cursors for the selected components. * Should these belong to a session model as other parts of the editor will require notification if these change, or do they belong to the contoller as they effect how the controllers processes their requests? There is a cursor for each component that can contains sub-components so I don't want to bundle all the cursors together. * I think I should use a proxy model for selectable components that represents the currently selected component and all its properties? This stops component views and controllers having to detach from the previous model all the events they are catching and and attach them to the new model. But I feel (not sure) that the cursor belongs in the controller. This selection/cursor problem is causing me most concern as there will have to be a lot of communication between components. This is why I was wordering if there is a pattern for this communication to reduce the coupling. I have a hunch that models pass information back to their parents (who observe them) they then re-throw these events to their observers and so on. Contollers (if they store the cursors) would pass their information down to their children (who observe them). But I have no evendence to back up this hunch. Any advice appreciated, Iain. |
In reply to this post by Panu Viljamaa-4
Panu Viljamaa schrieb:
> > Robert Klemme wrote: > > > ... DHTML is at best a technology, although the term > > "nightmare" is more like what comes to my mind. > > You can say that MVC is better than DHTML because DHTML > is nightmarish while MVC is not. But the more interesting > question is the differences in features, structure and > capabilities that bring about this perceived nightmarishness. > > Can you elaborate a bit ? i'll try although i don't know whether i'll complete the list. maybe others contribute... - there is no standard and the fact that there are two languages involved (HTML and JavaScript) doesn't make it better - HTML did not start out as a layout language, it was a language for structuring texts (you can argue about this, but this is the way i see the beginnings of HTML) - the loose connection between client (browser) and server (web server) splits up the view, which is especially akward when working with multiple frames: you have frame interactions on client side AND on server side. - the loose connection between client and server makes tracking of session state difficult. - JavaScript has it's own problems (performance, typing) - HTML pages tend to get messed up with javascript code when web applications grow - there are no good UI builder tools (at least not yet) that provide similar functionality to typical UI builder used with Java and C++ for example. ... regards robert -- Robert Klemme software engineer -------------------------------------------------------------------------------- myview technologies GmbH & Co. KG Lindberghring 1 ~ 33142 Büren ~ Germany Fon: +49-2955-7433-20 Fax: +49-2955-7433-99 -------------------------------------------------------------------------------- The information transmitted is only intended for the person or entity to which it is adressed. It may contain confidential and/or privileged material. Any review, forwarding, distribution or any other action related to this information by persons or entities other than the intended addressee is prohibited. If you receive this by mistake, please contact the addresser and delete the material from any computer. |
In reply to this post by Iain Hull
[hidden email] (Iain Hull) wrote in message news:<[hidden email]>...
> There is a long lead time from my usual supplyer on the book you > suggested. It will be the third I have purchased (inc the GoF) to > findout how to implement a complicated MVC architecture. I do plan to > buy this book, but I want to look at it first to ensure it is exactly > what I require. I would suggest a visit to a good bookstore, if there is a decent one near you. Alternately, amazon.com, bn.com & most publishers typically provide summaries, reviews, tables of contents and often a sample chapter for the more popular books (and this one is pretty popular. At http://patterndigest.com I offer a BookShelf section which collects all published pattern books in a few categories with short summaries and links to the related bn.com pages. You can browse thru the listings & click over to barnes & noble for more information. Note: the site search engine does not search the book listings properly, unfortunately (this is because I'm using JavaScript to construct the pages -- !argh!) I'm working on a solution to this problem. I also have a hand-full of additional books I need to add. DavidVanCamp.com PatternDigest.com |
Free forum by Nabble | Edit this page |