Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 268485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:42:20+00:00 2026-05-11T23:42:20+00:00

Over the last few weeks I have been studying the MVC design pattern for

  • 0

Over the last few weeks I have been studying the MVC design pattern for web applications using PHP. Taking a broad view I understand how the pattern works and why it is a very good way of implementing any sort of web application from small or large.

As I understand it we have 3 distinct layers that talk to each other via the Controller like so:

User Input —> View —> Controller —> Model

Site Output <— View <— Controller <— Model

With my planned implementation I hope to have a model for each table in my database, and each model will have all the functions/logic necessary to manage this table. In turn each of these models will have an associated view. The Model and View will of course have a Controller which allows them to be used.

Now this is easy to get my head around as each single, logical action requiring the database has been covered. However, what happens when a particular action requires the use of more than one table/model?

The Admin side of the application isn’t likely to need more than one model at a time to maintain the database. The front-end or user side of the application is a different matter! Say I have a webpage that shows a list of articles for a particular section, a list of currently logged-in users and – borrowing an example from SO – site statistics such as a tag cloud.

This one page would require at least 3 models in my planned design – Article, Users and Tags.

Obviously my single controllers aren’t going to cut it. So what do I do?

  1. Create new monolithic controllers for my web pages?

    • allow me to get the results I want
    • would require a lot of duplicate coding
    • really hard to maintain if changes required
  2. Create a “super” controller that manipulates smaller specific controllers

    • allows me to get the results I want
    • would be modular so changes to one script shouldn’t affect the others
    • minimal code duplication
  3. Create [insert brilliant solution here]

I am currently erring towards Option 2. Simply because it should in theory cut down on coding as all the necessary behaviour will exist in the smaller controllers – and everything will be easy to maintain.

Perhaps it could look like this:

articlecontroller.php

<?php
    //Article Controller Script

    if($_GET['article'] = 'foo')
    {
        //magic necessary for displaying article "foo".
    }
?>

usercontroller.php

<?php
    //User Controller Script

    if($_GET['user'] = 'display')
    {
        //magic necessary for displaying users
    }
?>

supercontroller.php

<?php
    //"Super" Controller

    //magic for setting up page

    if(isset($_GET['article']))
    {
        include('articlecontroller.php');
    }

    if(isset($_GET['user']))
    {
        include('usercontroller.php');
    }
?>

As you can see, my super controller looks at what that particular page requires and includes the necessary controllers which do the grunt work. NB: The code is just a quick and dirty example 🙂

However, I am by no means a pro so that is why I am asking you, SO. Which option is preferred? If neither what Option 3 would you suggest? Any code snippets/examples would be lovely but not required.

If you made it this far, thank you for your time.


I thought I would update this question [and accept an answer – forgot to do that :P]. I took a look at the concept of Fat Models/Skinny Controllers and I like how it is done, so I will definitely be taking that directions.

I have also taken the advice to look at some of the other frameworks and how they achieve their MVC patterns. There is rather a lot to take in! Still, I have learned quite a few new things along the way, so it was of great benefit. I may have more questions in the future, but for now I have more than enough to make a start.

Thank you all for your input.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:42:20+00:00Added an answer on May 11, 2026 at 11:42 pm

    I disagree with the direction you want to take in your model. The 1 model = 1 table design is going to hurt you in the long run.

    First of all, I think you need to drop the strict notion that model == database. While that is very often true, really the model is just data – it could come from XML files, a cache, or even a web service.

    Check out this excellent answer by Bill Karwin – it addresses these concerns very well.

    Secondly, do some reading on the topic of fat models, skinny controllers (or thin controllers)

    Lastly, just as more of an FYI, your idea of a “supercontroller” is what’s more commonly known as a “front controller”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been noticing, over the last few weeks, that my installation of VS2008
For the last few years I have been using Firefox, Firebug, and the Web
Over the last few days I have noted a few web sites that demonstrated
Over the last few weeks I've been subject to a sudden and significant performance
Over the last few months/years, I have shared a folder or two with numerous
I have been doing a little reading on Flow Based Programming over the last
I've been working with AS3 a lot over the last weeks and I've run
I am scratching my head over for this issue for last few weeks. My
've been puzzling over cronjobs for the last few hours. I've read documentation and
Over the years as I have gone through school and been working in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.