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 class b.
  • a class describes logical unit. there shouldn't 2 logical units same name different functionality.

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -