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 4251280
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:38:26+00:00 2026-05-21T04:38:26+00:00

i have a conceptual question about Front controller implementation in php. Most of the

  • 0

i have a “conceptual” question about Front controller implementation in php.

Most of the Front Controllers i have seen around are implemented with Singleton, i am not a big fan of singleton pattern and i created a Container which has a static property that will store a unic instance of Front Controller.

With singleton, i had to put initialization code inside the constructor (or a method called by the constructor):

$fc = FrontController::getInstance();

With the container i could put configuration outside the FrontController, that was my goal and i still have a simple way to retrieve the FrontController.

$fc = Container->getFrontController();

This code looks much cleaner to me and i can get clean subclassing without caring about parent constructors.

That’s quite the same thing at ‘bootstrap’ time, but in practice the difference from my previous implementation is that now i can create FrontControllers anywhere in the application (inside a DAO or inside a Action), because the constructor is no longer private/protected.

My question is:
Is it a ‘bad practice’ to give to the user of my classes the possibility to create FrontController instances anywhere in the app? I would write documentation and deliver the container with other classes, but i still wonder if i should prevent strange uses.

  • 1 1 Answer
  • 0 Views
  • 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-21T04:38:26+00:00Added an answer on May 21, 2026 at 4:38 am

    Is there any real reason to create FrontController instances inside the app? If there is then go ahead. Otherwise I am a bit skeptical about this as it may complicate things later on. What I’m afraid of is someone using new FrontController instances when there is a much simpler way, either out of laziness or because they don’t know any better. Once they find something that works, some people tend to keep doing it even if there’s a better way. Never forget that you may have to work with people that are not as good as you.

    Personally I would hide this or not allow it altogether. However I would keep it in mind for later releases. If you ever stumble on a case where it’s the best option by all means add it to your “official” interface.

    Don’t forget that once you release a function into the wild, it’s excruciatingly difficult to kill it off.

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

Sidebar

Related Questions

I have a high-level/conceptual question about Shibboleth. I'm working on the front-end (running Drupal)
I have a conceptual question about photo galleries like this: http://www.nikesh.me/demo/image-hover.html If you open
this is more a conceptual question. Consider you have a php framework that runs
I have a conceptual question. I am wondering how companies such as Alexa Internet
More of a design/conceptual question. At work the decision was made to have our
This is more of a conceptual question than anything. I have a base class
I have a more conceptual question in Rails... or Ruby for that matter: Is
I have a conceptual problem to do with PHP classes and error handling.. Below
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Question title might be meaningless, but I tried. :) Here's my situation: I have

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.