Perl Best Practices [Electronic resources]

Damian Conway

نسخه متنی -صفحه : 317/ 304
نمايش فراداده

B.15. Chapter 16, Class Hierarchies
  • Don't manipulate the list of base classes directly. [Inheritance ]

  • Use distributed encapsulated objects. [Objects ]

  • Never use the one-argument form of bless. [Blessing Objects ]

  • Pass constructor arguments as labeled values, using a hash reference. [Constructor Arguments ]

  • Distinguish arguments for base classes by class name as well. [Base Class Initialization ]

  • Separate your construction, initialization, and destruction processes. [Construction and Destruction ]

  • Build the standard class infrastructure automatically. [Automating Class Hierarchies ]

  • Use Class::Std to automate the deallocation of attribute data. [Attribute Demolition ]

  • Have attributes initialized and verified automatically. [Attribute Building ]

  • Specify coercions as :STRINGIFY, :NUMERIFY, and :BOOLIFY methods. [Coercions ]

  • Use :CUMULATIVE methods instead of SUPER:: calls. [Cumulative Methods ]

  • Don't use AUTOLOAD( ). [Autoloading ]