php - Multiple inheriting class names versus single and selective include -
at moment have:
a.php: class { ... } a1.php: class a1 extends { a1 stuff... } a2.php: class a2 extends { a2 stuff... } ... factory.php: create($obj) {return new $obj;}
i'm thinking of changing to:
a.php: class { ... } a1.php: class b extends { a1 stuff... } a2.php: class b extends { a2 stuff... } ... factory.php: create($obj) { require ($obj.".php"); return new b; }
any comments, or dangers lie ahead? 1 class ever instantiated per php session.
my first impressions:
- you can never load both classes memory @ once. if don't usually this, it'll make, example, unit testing hard.
- debugging made harder if debugger tells there's problem class
b
, not which classb
. - a class describes logical unit. there shouldn't 2 logical units same name different functionality.
Comments
Post a Comment