Best Practices fo OO Perl (OSCON2005 Tutorial)


Damian Conway is giving a tutorial on Best Practices in Object Oriented Perl based on his new book: Perl Best Practices. What is a "best practice?"

  • Same as the rest of Perl
  • Seek code that
    • minimizes chances of "enbugging"
    • makes it easy to detect failed edge cases
    • scales to larger datasets
  • Robust (create techniques that extend and incorporates new functionality)
  • Efficient (play to Perl's strengths and avoids its weakness while minimizing resource usage)
  • Maintainable (optimize for comprehension)

Make OO a choice, not a default - Choose OO when

  • When the system to be built will be large
  • Data can be aggregated into obvious structures and there's lots of data in each aggregate
  • The various types of data form a natural hierarchy that facilitates inheritance and polymorphism
  • The implementation of high-level operations on data varies according to data type (polymorphism is a big benefit here)
  • Its likely you'll have to add new data types later
  • Interaction between data are best represented by operators
  • You have a piece of data on which many different operations are applied
  • And, those operations have standard names, regardless of the type of data they're applied to
  • Implementation of individual components is likely to change, especially in the same program
  • The system design is already object-oriented
  • Large numbers of clients will use your code

Please leave comments using the Hypothes.is sidebar.

Last modified: Thu Oct 10 12:47:19 2019.