Maybe I don't understand MVC, but isn't the point to keep the M V and C separate and interchangeable?
Basically, yes.
The User object doesn't know or care about HTML or text or whatever. There's view gunk that handles that.
So, maybe you'd have a User object, and a User::MySQL object and a User::HTML object.
I think you and possibly the OP are confused by the naming of the classes. What you call User object is probably what is called the Model::User class in the OP. The Model class (whatever name it has) should be independent of the programs UI. The model is provides everything your program "does". The view and the controller provide the user interface. The view provides feedback to the programs user, and the controller translates user actions to model actions.
Database independence of the model (if you're using a database for persistence) is mostly done independent of the model classes directly. For instance, if you're using Class::DBI to implement your model classes, you're probably using a shared base class for all your model classes which determines the type of database (excepting maybe some handwritten non-portable SQL for specific model actions).
-
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.
|