Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing abstract classes and static members to better manage functionality
    primarykey
    data
    text
    <p>In order to better organize my code in a PHP project (a <em>simple</em> 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.</p> <p>Rules are made to be broken when necessary, but I want to solidify my understanding of better (read <em>best</em>) patterns and practices.</p> <p>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'.</p> <p>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 <code>getAllPermissions()</code>, <code>getGroupPermissions()</code>, <code>addGroupPermissions()</code>, etc., are floating around. Should these be encapsulated within a <code>PermissionsManager</code> 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?</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload