Editor Bytes – SOLID Foundations
Editor-in-chief Oscar Merida looks into the November 2020 issue, SOLID Foundations.
Listen
Podcast (episodes): Play in new window | Download | Subscribe
Transcript
Writing software does not follow engineering principles or formulas like we have for building bridges or designing airplane wings. That doesn’t mean anything goes! In this issue, we look at how to use type hints, writing SOLID code, handling monetary calculations, using domain events correctly, and more.
Back in high school, I worked during the summers assembling rack-mounted computer systems. At the time, these were cutting-edge PCs with megabytes of memory and loaded with giant spinning hard drives that held 2GB of data. The engineers who designed the systems knew I was thinking of studying engineering and remarked that “working on the floor” was a valuable experience. I’d gain a hands-on understanding of how parts came together, how to route cables nicely, and run into the edge cases not considered by a design or assembly instructions limited to blueprints. Each rack was not a unique, hand-crafted work. Every system we put together followed a plan, with allowances for slight variations therein. We had to capture any adjustments to the designs so that instructions, drawings, and parts lists were updated to reflect the fixes required to put things together as intended.
The applications we write and maintain are no different. We have to balance how we use design patterns and software architecture principles that apply across projects while building working systems within project budgets and deadlines. You can’t only rely on dependency injection, decorators, and interfaces along with your framework and trusted Packagist libraries to solve the problems you face. On the other hand, you shouldn’t immediately sit down and start writing a solution proud that you’re not using any framework, writing tests, or following any guiding principles to produce something your clients want. There’s a careful balance of the two, and while I wouldn’t want to spend a lot of time bike-shedding potential solutions, planning and thinking go a long way toward building something you won’t want to rewrite in one month. Most of the planning stuff should center on understanding your customer’s problems and needs. Please don’t spend any of it figuring out how you’ll incorporate the latest buzzwords or trends into your project.
In Improving Your PHP with Static Types, Karl Hughes looks at PHP’s typing system’s idiosyncrasies. He also discusses enhancements coming in PHP 8 and other static analysis tools to find where to add type hints. Vinícius Campitelli contributes Applying Best Coding Practices to PHP, Part One, and examines SOLID programming principles. He’ll share how to use them to write flexible, maintainable object-oriented code. Before you have to handle monetary calculations, read Bug-free Money Handling With MoneyPHP, by Piotr Horzycki. He goes over why computers have trouble with floating-point math and recommends libraries you can use to prevent such errors with PHP.
Sherri Wheeler has another puzzle this month in PHP Puzzles: Destination Point. She evaluates two solutions for calculating the final destination based on a list of directions. In Education Station: Locking Down Resources, Chris Tankersley follows up last month’s article about race conditions and deadlocks by looking into libraries you can use to add locks when your application works with resources quickly. Edward Barnard dives into Developing Domain Events in Sustainable PHP. He explains how you can use them to structure a solution and record how your system changes. Over in Security Corner: Self-obfuscating Value Objects—–A Design Pattern for PII, Eric Mann shares how to use a magic method to keep sensitive data from leaking when you’re debugging or logging an object. Need something PHP related to listen to? Eric Van Johnson rounds up his favorite podcasts in Community Corner: Podcast—Mic Check. And, in The Workshop: GUI Applications In WSL With X Server, Joe Ferguson wraps up his look into WSL. He shares how he runs Linux GUI applications alongside Windows ones when he’s developing. Beth Tucker Long reminds us to Put Your Best Page Forward in finally{}. Specifically, she challenges us to think about how our work environment and expectations affect our coworkers and lead to burn out.
Air date | November 17, 2020 |
---|---|
Hosted by | Oscar Merida |
Guest(s) |
Leave a comment
Use the form below to leave a comment: