Perl Weekly
Issue #738 - 2025-09-15 - Design Patterns
latest | archive | edited by Mohammad Sajid Anwar
|
Hi there,
Say "Design Patterns" and "Perl" in the same sentence and you may receive puzzled looks. To a large audience of the software world, Perl is still pigeon holed as a "write-only" script; a wild west where structure goes to die. In comparison, there is the Gang of Four's text, with its formalized object-oriented design diagrams, which seems to exist in its own universe.
That perception isn't just stale, but wrong. Perl is compatible with Design Patterns. As a matter of fact, patterns and perl are quite complementary.
Perl has always embraced the principles that patterns are trying to get at: flexibility, maintainability, and clarity. The well-known principle of "There's more than one way to do it" (TIMTOWTDI) isn't meant to be a negation of structure, but more of an encouragement for intentional design. Perl doesn't just allow patterns, it often can express design patterns more nimbly than rigid patterns in rule-bound languages.
In Perl there really is no decision to go with patterns or not, but rather how to apply patterns. Patterns as they relate to Perl will intricately exist as idioms based and not frameworks as in many other languages, even when additional libraries are implemented there are patterns that are idiomatic to the language and its ecosystem.
Perl's best design pattern is, simply, the pattern of well-thought out and effective problem-solving. And that, I think, is as timeless as software engineering gets.
I've published the first post, Factory Method, part of a long series.
Enjoy rest of the newsletter.
Mohammad Sajid Anwar
|
|
|
Announcements
|
The release notes are in draft form only and need to be edited before being uploaded to the website. In particular, DBD::MySql is not part of the release.
|
|
Articles
|
by Mohammad Sajid Anwar (MANWAR)
Here is piece of work that demonstrates the power of Perl's modern ecosystem by taking a common, real-world problem (caching) and showcasing a robust, modular solution (the CHI module).
|
|
|
by Mohammad Sajid Anwar (MANWAR)
An educational article, it successfully demystifies the Factory Pattern by grounding it in a concrete, relatable example. The post is exceptionally well-structured moving from a real-world problem to a suboptimal solution and finally to an elegant implementation of the pattern.
|
|
|
by Eugen Konkov
This is a highly technical, niche and opinionated post aimed at a very specific audience: system administrators or developers maintaining legacy Perl code that interacts with databases.
|
|
by Nikos Vaggalis
The article is valuable as a news brief. It informs readers that Perl is still active and may be experiencing a renewal of interest. It introduces valid, positive points about the language. It identifies a relevant trend, accurately describes Perl's strengths, positive and readable.
|
|
Grants
|
|
|
|
The Weekly Challenge
The Weekly Challenge by Mohammad Sajid Anwar will help you step out of your comfort-zone. You can even win prize money of $50 by participating in the weekly challenge. We pick one champion at the end of the month from among all of the contributors during the month, thanks to the sponsor Lance Wicks.
|
by Mohammad Sajid Anwar (MANWAR)
Welcome to a new week with a couple of fun tasks "Max Diff" and "Peak Point". If you are new to the weekly challenge then why not join us and have fun every week. For more information, please read the FAQ.
|
|
|
by Mohammad Sajid Anwar (MANWAR)
Enjoy a quick recap of last week's contributions by Team PWC dealing with the "Highest Row" and "Max Distance" tasks in Perl and Raku. You will find plenty of solutions to keep you busy.
|
|
|
by Ali Moradi
The solutions are concise, correct and effectively leverage the power of the List::Util module. They demonstrate a strong functional programming style within Perl, using map to transform data and higher-order functions like max to find solutions. The code is clean, readable and gets the job done with minimal overhead.
|
|
by Arne Sommer
This is a well-written, high-quality post that perfectly embodies the spirit of Raku programming. It demonstrates a clear progression from a straightforward, imperative solution to a more elegant, functional and idiomatic Raku solution.
|
|
by Bob Lied
It is a well-written, clear and practical walkthrough of solving the weekly challenge. It successfully achieves its goal of explaining the thought process and implementation for the first task. The post is technically sound, easy to follow and demonstrates good coding practices.
|
|
by Jaldhar H. Vyas
This is a classic example of a "code golfer" or "one-liner" approach to solving coding challenges. The solutions are exceptionally concise and leverage the high-level features of Raku and Perl to their fullest. The focus is on brevity and clever use of built-in operators rather than on readability, educational value or software engineering best practices.
|
|
by Jorg Sommrey
This post is a fantastic deep dive into problem-solving. It stands out for its exceptional quality, showcasing not just solutions but a true computer scientist's approach: rigorous analysis, systematic exploration of multiple algorithms with clear complexity analysis and empirical performance testing.
|
|
by W Luis Mochan
These solutions leverage the powerful Perl Data Language (PDL) to solve the challenges with extreme brevity and computational efficiency. PDL is designed for numerical computing and these examples perfectly demonstrate its strength in vectorizing operations that would require explicit loops in standard Perl. The solutions are concise, efficient and elegant for those familiar with the PDL paradigm.
|
|
by Matthias Muth
This is a masterclass in writing concise, idiomatic and efficient Perl. Matthias demonstrates a deep understanding of the language's functional programming capabilities and standard libraries. The solutions are not just correct; they are elegant and demonstrate a clear preference for clarity and performance over brute force.
|
|
by Packy Anderson (PACKY)
A solid, correct and engaging post. The solutions are technically sound and nicely idiomatic in each language.
|
|
by Peter Campbell Smith
Peter's solutions are exemplary models of clarity, robustness and efficiency. He deliberately chooses transparent, verbose code over clever one-liners, making his solutions easy to understand and maintain. Furthermore, he demonstrates deep insight by identifying and implementing highly efficient algorithms, especially for the second task.
|
|
by Robbie Hatley
This is an exemplary model of how to write clean, professional and well-documented solutions to coding challenges. The code prioritizes readability, robustness and maintainability over cleverness or brevity.
|
|
by Roger Bell West (FIREDRAKE)
This is a concise, efficient and highly practical blog post. It quickly identifies the core of the problem and implement the most efficient solution with clean, idiomatic code and avoids unnecessary fluff and focuses on the key insights and implementations.
|
|
by Simon Green
This is a well-structured, beginner-friendly and practical walkthrough of solving the weekly challenge. It takes a tutorial-style approach, explaining thought process step-by-step in a clear and accessible manner. The post is light on deep algorithmic analysis but heavy on clarity and implementation.
|
|
Rakudo
|
by Elizabeth Mattijsen (ELIZABETH)
The reboot of raku.org is a masterclass in modern open-source pragmatism. It successfully transforms a stagnant, manually-curated webpage into a vibrant, automated showcase of the language it represents.
|
|
|
Weekly collections
|
|
Events
|
|
|
|
|
You know, you could get the Perl Weekly right in your mailbox. Every Week. Free of charge!
|