php application class structure guidelines -
i developing php application using mvc architecture , need suggestions following design guidelines:
according php class structure best practises, noted should minimize module dependencies, application class inheritance followed:
- some operations/methods accessible classes
- what have done have created helperclass contain these "global" methods string manipulations, integer manipulations, array manipulations , let other classes use these methods extend class.
class organization:
interface stringhelper{ ... } interface arrayhelper{ ... } class generalhelper implements stringhelper, arrayhelper{ ...... } class newclass extends generalhelper{ ... } // user factory style create object class newclassfactory{ public function create( $options ){ return new newclass( $options ); } }
the application has 15 classes.
is approach suitable scenario or end having big issues when maintaining application? appreciate help.
in cases helper classes should static , no working class should extend it. helpers global , have no role in main scope of working class. think of helpers plumbers, handymen etc . if writing family class shouldn't extend plumbers, plumbers should come in when needed , out no relation whatsoever family.
what need this:
class newclass { ... $some_string = declaration $some_string = stringhelper::sanitizestring($some_string); }
Comments
Post a Comment