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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:14:23+00:00 2026-05-18T22:14:23+00:00

In order to better organize my code in a PHP project (a simple CMS)

  • 0

In order to better organize my code in a PHP project (a simple CMS) I’m considering moving most of my System functions to an abstract class as static members. Aside from the organizational and syntactical benefit from it, the only other reason would be to store references to datasource objects, etc., as static members also.

Rules are made to be broken when necessary, but I want to solidify my understanding of better (read best) patterns and practices.

I suppose this question is open ended, but I was wondering if anyone had suggestions, or could perhaps suggest some reading material, so I could explore my options and what would be considered ‘best practices’.

An example of this in my code would be functions for managing permissions. For any given request, permission checks may be necessary to ensure the requesting user has sufficient privileges for the operation. So functions such as getAllPermissions(), getGroupPermissions(), addGroupPermissions(), etc., are floating around. Should these be encapsulated within a PermissionsManager class, necessary to instantiate, and if so, where do I stop? Am I on the right track moving them to a pseudo-global space within an abstract class as static methods? Should I just leave the declarations in global scope? Where do appropriate class responsibilities end and ‘god-class’ takeovers begin? What color socks should I wear?

I just can’t seem to wrap my head around this, and it’s slowing my productivity. I don’t want to idle any longer on modeling, because despite it’s obvious benefits, I’ve certainly destroyed a few trees sketching out object-interaction diagrams. And my wastebasket is full.

  • 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-18T22:14:23+00:00Added an answer on May 18, 2026 at 10:14 pm

    suggest some reading material

    Have a look at SOLID and GRASP and this answer of mine: Php design patterns

    Should these be encapsulated within a PermissionsManager class

    Yes. If these functions are related, group them. Also have a look at this Wikipedia Article about Role-Based Access Control Lists and have a look at the various questions about ACLs in PHP on StackOverflow.

    Am I on the right track moving them to a pseudo-global space within an abstract class as static methods?

    No, you should avoid static if possible. Statics lead to tight coupling and introduce dependencies on the global scope leading to less maintainable applications which leads to a longer time to deliver (e.g. bugfixes and new features) which leads to higher overall cost and less return of investment.

    Should I just leave the declarations in global scope?

    If you do changes to your application, you should be able to explain the benefit. If you think your application can benefit from refactoring this code, then refactor it. You should stop when there is no return of investment.

    Where do appropriate class responsibilities end and ‘god-class’ takeovers begin?

    Since you should stick to the single responsibility principle, any responsibility beyond one is a code smell (though sometimes it may make sense to have more than one). I found this description of a GodClass easy to comprehend.

    What color socks should I wear?

    That depends on the shoes you intend to wear with them. In general, I find dark socks to be the best choice for most occasions and shoes, while white socks are a No-Go most of time.

    I don’t want to idle any longer on modeling

    Some thinking before you start is good. Understanding the problem and the domain you want to solve, is necessary to make decisions. But you should start with solving the problem eventually. Only working code (even poorly designed one) yields business value. Pristine up-front designs wont survive the reality of a project anyway.

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

Sidebar

Related Questions

which is better ??? public class Order { private double _price; private double _quantity;
I'been doing some inheritance in js in order to understand it better, and I
I am wondering if there is away (possibly a better way) to order by
In order to improve my open source project, I need testers. I have created
In order to fully use LinqToSql in an ASP.net 3.5 application, it is necessary
In order to perform a case-sensitive search/replace on a table in a SQL Server
In order to know how many times a pattern exists in current buffer, I
In order to debug an asp.net web app I have to have IE Script
In order to create an arbitrary precision floating point / drop in replacement for
In order to create the proper queries I need to be able to run

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.