3.7. Tips for Reducing Complexity

“Complexity is the enemy, and our aim is to kill it.”

Jan Baan

One of Perl's greatest strengths is its expressiveness and extreme conciseness. Complexity is the bane of software development: when a program grows beyond a certain size, it becomes much harder to test, maintain, read, or extend. Unfortunately, today's problems mean this is true for every program we need. Anything you can do to minimize the complexity of your program will pay handsome dividends.

The complexity of a program is a function of several factors:

  • The number of distinct lexical tokens

  • The number of characters

  • The number of branches in which control can pass to a different point

  • The number of distinct program objects in scope at any time

Get Perl Debugged now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.