Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

While there are plenty of web articles on the theory of the model-view-controller design pattern, there is precious little advice available on how to implement it, in terms of structuring one's classes and objects.

So let me ask a simple question. Suppose I'm writing an application that looks up user information in a database, performs some calculations, and then outputs that information. Suppose also that for the sake of code encapsulation, I want to use object-orientation, and wrap up my code in a "user" object.

So, the practical question is this. Does it follow from the MVC design pattern that I ought to have both a Model::User object and a View::User object, and perhaps a Controller::User object, too? In short, won't I need a separate "User" object for the model, the view, and maybe the controller?

If that's so, then true, it means I can update any member of the MVC triad separately. But it also means that I must update each member separately, even if I want to make the same update to each. And mightn't that be more hassle than it's worth?

Perhaps I just lack a good idea of how to implement MVC. If anyone has any links to articles on the implementation (as opposed to merely the theory) of MVC I'd be really grateful for them.

GHF

In reply to Implementing Model-View-Controller by ghferrari

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-19 16:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found