Edward Barnard

Headshot of Edward Barnard

Ed Barnard had a front-row seat when the Morris Worm took down the Internet, November 1988. He was teaching CRAY-1 supercomputer operating system internals to analysts as they were being directly hit by the Worm. It was a busy week! Ed continues to indulge his interests in computer security and teaching software concepts to others.

twitter: @ewbarnard

Articles

Job Queue

By Edward Barnard

The Back Office building blocks (Command, Job, Model, table) use Laravel Jobs, which, in turn, use queue request tables. Here, we are setting up a minimal configuration with Liquibase table management, queue request table, Laravel job, and Laravel Command to dispatch that job. We explicitly use a “boilerplate” approach that allows you to quickly focus on what’s specific to the job/process in question. Finally, we show the “dispatch self” technique, allowing the job to iterate through extended input. by Edward Barnard

Published in The Symfony of PHP, October 2024

It’s Magical

By Edward Barnard

Our Back Office methodology simplifies complex tasks by breaking them into single-purpose activities. Using a Business Process Diagram (BPD), we address known and unknown project elements iteratively. Our case study, integrating Stripe with Sage Intacct, shows how we automate processes while ensuring stakeholder buy-in. Though a local environment setup with tools like Laravel Queues is challenging, it prepares you for a streamlined coding phase that takes advantage of early planning and discussions. by Edward Barnard

Published in PHP Is Listening, September 2024

A Non-Obvious Separation of Concerns

By Edward Barnard

by Edward Barnard

Published in HaPHPy Developers, August 2024

Hedy Lamarr’s Advice

By Edward Barnard

Vienna-born actress Hedy Lamarr, as the teenage wife of arms dealer Fritz Mandl, entertained such heads of state as Adolf Hitler and Benito Mussolini. Thirty years later, her autobiography carried two introductions: one by her medical doctor and one by her psychiatrist. How did she cope? This month, we’re taking a close look at her doctor’s advice–because it applies to us as well. by Edward Barnard

Published in HaPHPy Developers, August 2024

A Non-Obvious Separation of Concerns

By Edward Barnard

by Edward Barnard

Published in Search For Good Code, July 2024

User Workflow Improvement with Hedy Lamarr

By Edward Barnard

The programming language, Hedy, is named after actress Hedy Lamarr. I will first explain Lamarr’s accomplishments in an attempt to find the connection. Next, I’ll examine Hedy, which addresses the need for more computer programming literacy. Finally, I have suggestions for more reading about programmers’ brains. by Edward Barnard

Published in Search For Good Code, July 2024

Catch the Imagination

By Edward Barnard

Cray Research, the computer company, was literally built on stories. That’s the power of catching someone’s imagination. We’ll first learn about “Seymour stories” within Cray Research. Then we’ll learn an early Glenn Martin story, which catches the imagination, and contrast that story to the background and context that wasn’t so great. We’re not focusing on the art of storytelling as such. Rather, we’re seeing examples of what does catch the imagination and what does not. It’s an interesting and useful lesson. by Edward Barnard

Published in AI Llamas, June 2024

Pivot and Protect

By Edward Barnard

What should you do when your side project receives corporate interest? Might a no-compete contract prevent you from ever doing a similar project again? Could “overreach” impact your other side projects? Here’s my thought process as I worked through these issues. by Edward Barnard

Published in PHP Reflections, May 2024

Making the Difficult Choice

By Edward Barnard

> “How we got here” can be an interesting and difficult question. Once again, I’m using Minnesota’s “Miss Mitchell” as an example. We’ll trace the link from aviation pioneer Glenn L. Martin to North American Aviation’s B-25 Mitchell aircraft. > > We’ll be observing human nature by focusing on a specific person, Glenn Martin. We’ll see difficult choices made, for better or for worse. by Edward Barnard

Published in Deep Diving PHP Security, April 2024

Transitional Implementation, Part 2

By Edward Barnard

Our transitional PHP code looks odd. It’s counterintuitive. But it makes highly efficient use of developer effort. This code walkthrough explains the reasons behind our methods. Part 1 presents the basic architecture. Part 2 explains why we’re doing it this way. by Edward Barnard

Published in World Community, March 2024

Transitional Implementation, Part 1

By Edward Barnard

Our transitional PHP code looks odd. It’s counterintuitive. But it makes highly efficient use of developer effort. This code walkthrough explains the reasons behind our methods. Part 1 presents the basic architecture. Part 2 explains why we’re doing it this way. by Edward Barnard

Published in The PHP Gambit: Winning Strategies in Code, February 2024

Deeper Insight

By Edward Barnard

When modeling a business process in software, it’s important to understand how that system works. Find the subject-matter experts. by Edward Barnard

Published in Bad Bug Bounties, January 2024

A View From 2500 Feet

By Edward Barnard

My new column begins with a mental exercise. It only takes 24 seconds, and I hope you do play along. With “A View From 2500 Feet”, I expect every month will include airplanes, algorithms, and abstract thinking. Airplanes? Yes! Airplanes solved my problem in software development. This month, I’m sharing that story with you. by Edward Barnard

Published in Generating Efficient PHP, December 2023

Bounded Fix

By Edward Barnard

For the past four years at the USA Clay Target League, we’ve been working toward updating our PHP software. Domain-Driven Design appeared to be a good direction for us. We’re not there yet. But there is one particular pattern that I’ve been using over and over, which I’ll be sharing below. by Edward Barnard

Published in Command Line Picasso, November 2023

Create Observability, Part 5: Offline Processes

By Edward Barnard

This month completes our “Create Observability” series. We will design, in flowchart form, each of the queue workers. We will describe each event to be emitted by each worker. We’ll see a webpage useful for observing queues and events, thus providing observability. As we saw last month, the flowcharts document the business process so that it does not become unknown “tribal knowledge”. Finally, we’ll discover that the final queue contains precisely what our stakeholders need for customer service resolution. by Edward Barnard

Published in Software Archeology, October 2023

Create Observability, Part 4: Simple Queue System

By Edward Barnard

> This month, we are identifying a business process that needs to move offline for asynchronous processing. To support the move, we’ll design a simple queue system based on MySQL database tables. Next month, we’ll design observability into our business process as we move it offline.
by Edward Barnard

Published in The Spectrum of PHP, September 2023

Create Observability, Part 3: Rewrite Business Process

By Edward Barnard

Last month we looked at flowcharting as a way of capturing and communicating “tribal knowledge”. This month, as we rewrite a business process, we’ll use a flowchart to document the new business process. We needed to fix the business process before we could fix the code.
by Edward Barnard

Published in Packing Up PHP, August 2023

DDD Alley: Create Observability, Part 2: Capture “Tribal Knowledge”

By Edward Barnard

“Tribal knowledge” is information that should be written down but
isn’t. If it were easy to write down, it probably already would be!
Another common problem is with documentation quickly becoming obsolete.
This month we’ll see a specific technique for helping a specific area of
“tribal knowledge”. Our business processes run in phases according to
the calendar. We’ll use the fact that we have a spring season followed
by tournaments as our example. Our tournament software assumes the
regular season has finished. That makes sense for the production
software but can be a problem when developing a feature during the
off-season. The software configuration may not be correct for that
feature to work in that developer’s environment. What setup is needed to
make feature development possible? That’s something we don’t have
written down! Here’s a solution. by Edward Barnard

Published in Be Barrier Free, July 2023

DDD Alley: DDD Alley: Create Observability, Part 1: Local Timing

By Edward Barnard

“Keep it simple” often does pay off. Here’s a method of creating
observability, just for yourself, that’s intentionally simplistic and
rapid to implement. by Edward Barnard

Published in Evolving PHP, June 2023

DDD Alley: First, Make it Easy

By Edward Barnard

Like any software, PHP code can become rigid to the point that it’s
difficult to change. When the change is needed by tomorrow, for example,
it’s clear that a proper (multi-day) rewrite is not an option. With few
automated tests in place, and none covering the area in question, adding
tests to protect the modifications is probably not an option either.
by Edward Barnard

Published in HTTP Burritos, May 2023

DDD Alley: DDD Alley: Impedance Mismatch

By Edward Barnard

When I drew out our PHP application on the whiteboard, it looked like
a Big Ball of Mud. We changed the drawing slightly, and something
interesting appeared. by Edward Barnard

Published in Getting TEKnical, April 2023

My Journey into Domain-Driven Design

By Edward Barnard

Domain-Driven Design is a team sport. Here’s my story of what can and
cannot be accomplished with a team size of one. by Edward
Barnard

Published in Getting TEKnical, April 2023

DDD Alley: “Depend” toward Stability

By Edward Barnard

Something was wrong in the sense that we missed our project deadlines repeatedly. What was wrong? This one took a while to figure out. We’ll look to Seymour Cray for part of the answer, and to James Grenning, one of the original signers of The Agile Manifesto, for the rest of that answer. by Edward Barnard

Published in Box of PHP, March 2023

Problem in a Box

By Edward Barnard

Here’s an approach to software problem analysis and debugging that’s based on intuition. Come up with theories about what might have gone wrong, then set out to prove or disprove each theory. This path, taken step by step, can lead us to the solution. > > How do we know when we have arrived at the solution? That’s the technique I call “fitting the problem into a box.” When the problem fits, with no loose ends hanging out, we have almost certainly arrived at the right answer. by Edward Barnard

Published in Box of PHP, March 2023

DDD Alley: Observability Lab

By Edward Barnard

I realized that I need to experiment with various off-the-shelf products, such as Elasticsearch. Here is how and why I set up a Raspberry Pi as a safe testbed. We’ll repartition a USB hard drive to be suitable as the boot device while reaching past the boot device limitations. by Edward Barnard

Published in Knowledge Crunching, February 2023

What Can the NSA Teach Us About Debugging?

By Edward Barnard

William F. Friedman wrote training materials teaching would-be cryptographers how to break encrypted messages. Much of his advice applies equally well to modern software problem-solving and analysis. by Edward Barnard

Published in Knowledge Crunching, February 2023

DDD Alley: Try, or Try Not; There is no Do

By Edward Barnard

The past two months focused on transactional-consistency boundaries. This month we’re extending the concept to RESTful API requests and responses. We’ll ensure that responses are internally consistent, whether success response, or error response. We’ll carefully draw and enforce the consistency boundary using the ancient wisdom of Yoda. by Edward Barnard

Published in PHP is Standing Tall, January 2023

DDD Alley: Exception Report

By Edward Barnard

Planning for failure is difficult because it’s usually not practical to predict every possible thing that could go wrong. This month we’re creating a mechanism for capturing those “rare and random” failures. As we do so we’ll gain important insight regarding implementing invariants with a transactional boundary. by Edward Barnard

Published in Owning The Web, December 2022

DDD Alley: Transactional-Boundary

By Edward Barnard

Domain-Driven Design’s Aggregate pattern is perhaps the most powerful of DDD’s tactical patterns. However, strangely enough, the pattern’s power doesn’t come from the Aggregate itself. The power comes from the Aggregate’s underlying concept–the transactional boundary. by Edward Barnard

Published in The Value of the AST, November 2022

DDD Alley: Application Event Walkthrough

By Edward Barnard

This month presents a relatively quick code walkthrough even though this feature is more complex than the previous chapter. We’ll see the structure is similar to the Domain Event feature. We’ll focus on those points important to developing your instinct with Strategic Domain-Driven Design. by Edward Barnard

Published in The State of PHP, October 2022

DDD Alley: Domain Event Walkthrough

By Edward Barnard

The July 2022 article “Structure by Use Case” introduced the Bounded Context pattern, which we’ll be using over and over as we structure our software by use case. This month we’ll continue exploring these concepts as we implement the global Domain Event store. by Edward Barnard

Published in Making Code, September 2022

DDD Alley: Exploring Boundaries

By Edward Barnard

Last month “Structure by Use Case” introduced the Bounded Context pattern we’ll be using over and over as we structure our software by use case. This month we’re diving more deeply into the boundaries, the crossing points, and the software layers created by this pattern. by Edward Barnard

Published in PHP Blueprint, August 2022

DDD Alley: Structure by Use Case

By Edward Barnard

This month we’re introducing the Strategic Domain-Driven Design pattern that we’ll be repeating over and over as we build out our project. by Edward Barnard

Published in Database Freedom, July 2022

DDD Alley: Random and Rare Failures

By Edward Barnard

Designing for failure is difficult because it’s usually not practical to predict every possible thing that could go wrong. Last month we got the preliminary “spadework” out of the way. This month we begin our first feature. This feature creates a mechanism for capturing those “random and rare” failures.

Published in Another Bright Idea, June 2022

DDD Alley: Get Organized and Get Started

By Edward Barnard

This month we begin the preliminary “spadework” to set up our project. We’ll be taking a hands-on “code first” approach to implementing Strategic Domain-Driven Design. by Edward Barnard

Published in One Last Slice, May 2022

DDD Alley: When the New Requirement Arrives

By Edward Barnard

When the new requirement arrives, does this mean we cram it in the best place, making our software more difficult to work with, or might we have ways to make the result cleaner than before we started? We’ll take advantage of Martin Fowler’s concept of Preparatory Refactoring.

Published in Testing The Core, April 2022

DDD Alley: Better Late Than Never

By Edward Barnard

Last month, we created “role-based lookups” with “When You Know the Pattern.” Database-related code can be difficult to unit test, and once unit tests are written, they can be difficult and time-consuming to maintain. This month we’ll carefully look at this problem and possible solutions. We’ll walk through the test suite after extensive refactoring to keep it clear and expressive.

Published in World Backup Day, March 2022

DDD Alley: When You Know the Pattern

By Edward Barnard

Software design patterns provide a “voice of experience” that can help solve the problem you’re trying to solve. However, it’s often not obvious how to implement any such design pattern within our modern PHP ecosystem. Here’s an example solution. We are implementing a memoizing Registry that’s outside my CakePHP framework code but uses CakePHP’s database layer. In July 2020’s php[architect], I wrote a most excellent rant, “We Got Robbed.by Edward Barnard

Published in Parallelize Your Code, February 2022

DDD Alley: Turning to Domain-Driven Design

By Edward Barnard

We begin our implementation of Domain-Driven Design with simple refactoring. We’ll take a close look at what complexity might be hidden within the expected implementation. That observation will guide us in refactoring toward Domain-Driven Design. by Edward Barnard

Published in Domain-Driven Resolutions, January 2022

Here Be Dragons: Solution Space

By Edward Barnard

We explored the problems of burnout and gatekeeping. We hinted at solutions. Now we can have fun. We’ll begin with a trip to the National Security Agency, discuss Imposter Syndrome, and find ways to “pay it forward” as a career choice. Finally, I’ll share my own goals in paying it forward as I prepare to pivot. by Edward Barnard

Published in The Zen of Mindful Programming, December 2021

Designing for MySQL Transaction Failures

By Edward Barnard

Planning for failure is difficult because it’s usually not practical to predict every possible thing that could go wrong. This month we’ll see a mechanism for capturing those “rare and random” failures. by Edward Barnard

Published in The Zen of Mindful Programming, December 2021

Here Be Dragons: Problem Space

By Edward Barnard

There’s a strong tendency toward “gatekeeping” right now in the 2020s. Senior developers warn “there be dragons” while announcing a “hands-off” policy toward the crucial areas of the codebase. You and I need to get past that. Where’s the fun when you can’t touch the dragons? The joy’s in experiencing software development, dragons and all. This month we’ll examine the problems of burnout and gatekeeping and see an alternative to the toxic gate keepers’ environment. Next month will be just plain fun. by Edward Barnard

Published in The Art of Data, November 2021

Design Patterns by Moonlight: The Dragon Wrangling Pattern

By Edward Barnard

I’ve seen many instances of “gatekeeping” now, in the 2020s. Senior developers warn “there be dragons” while announcing a “hands off” policy toward critical areas of their code base. The code has become too fragile to touch, too costly to change. The Dragon Wrangling Pattern provides a framework for allowing newer developers, or persons new to the project, to contribute with much-lessened risk.

Published in Decrypting Cryptography, October 2021

Design Patterns by Moonlight: When There Be Dragons

By Edward Barnard

As our codebases become ever more complex, the cost of change rises as well. Any change or enhancement carries a risk of breaking something else. The problem is even more acute for people new to the project who’ve not yet learned the pitfalls waiting in that particular codebase. This month we’ll be examining the problem and considering a solution. Next month we’ll see a solution as a straightforward pattern.

Published in It’s Really an Upgrade, September 2021

Design Patterns by Moonlight: How I Do Interfaces

By Edward Barnard

How do the building blocks come together to form a whole? Most resources on Design Patterns look at each pattern in isolation, allowing you to focus on the pattern and its uses without being distracted by side issues. What’s missing, I have found, are examples of fitting those patterns into a working system. This month we’ll look at a feature involving the validation of user input. We’ll be using the PHP interface in quite a few different ways as we build out that feature.

Published in Trimming One’s Sails, August 2021

Sustainable PHP: Soylent Green

By Edward Barnard

Like many programmers, I am not a “people” person, but this article is about people. First, how might you discern what “people” aspects of your project are essential? Here’s my approach. Second, how might people inspire you and help make what you do more fun? We’ll see my approach as we make the transition from abstract discussions back to concrete details.

Published in Deep Dive Into Search, July 2021

Sustainable PHP: Wizard Thinking

By Edward Barnard

This month, we’re indulging in a bit of magic and a bit of weirdness. That’s my way of explaining what I call Wizard Thinking, something I’ve found to be an instrumental skill indeed.

Published in Testing Assumptions, May 2021

Sustainable PHP: Machine Learning and Yoda

By Edward Barnard

When you encounter extremely costly errors, take steps to prevent the error from happening in the future. The earlier we catch an error, the less expensive it is to fix. Here we discuss two costly situations: a typo in an if statement and upcoming PHP 8 breaking changes.

Published in Busy Worker Bees, April 2021

Sustainable PHP: When the World Shifts

By Edward Barnard

Last month, we used Herbert O. Yardley’s “The Education of a Poker Player” to learn about testing business rules. This month we’ll explore what happened when the world shifted, and Yardley lost not just his job but his career. The lesson here will be “don’t be like Yardley”—yet Yardley’s story is, by all accounts, fascinating. Agnes (Meyer) Driscoll, like Yardley, was breaking codes on behalf of the USA. The world, too, passed her by. She failed to make the transition from pencil-and-paper to digital computing. Yet she’s fondly remembered as “the neglected giant.” We’ll begin with my own story of how my world shifted at the turn of the Millennium, bringing me to PHP.

Published in Lambda PHP, March 2021

Sustainable PHP: Testing Business Rule

By Edward Barnard

There’s an old joke that runs, “We just got a new project. You two start coding while I go find out the requirements.” This month we talk about evaluating and implementing business rules, thus meeting project requirements. We focus on discerning what’s important and what isn’t, and recognizing interactions that can quickly get out of hand. For our working example, we’ll be evaluating standard poker hands. Well-known card games make great examples because they’re easily understood by non-technical people, and it’s instantly apparent whether something is modeled correctly or not.

Published in Dealing with Data, February 2021

Sustainable PHP: Database Playback Testing

By Edward Barnard

While completing the Deep Analysis we discussed last month, I was faced with the inability to test. That’s because—I discovered–accounting data cannot be erased—even in the sandbox. There’s no way to begin each test with a clean test environment. This month we walk through a relatively convoluted solution. We’ll capture the accounting data as we send it through the API, along with capturing data at various points along the way.

Published in Newfangled Views, January 2021

Sustainable PHP: Deep Problem Analysis

By Edward Barnard

Sometimes, I need to write experimental code in order to explore and understand how the system works. This is particularly true when dealing with third-party software. Sometimes those experiments become large with many thousands of lines of “experimental” code. Here are my principles and guidelines for making that experimental code a success.

Published in PHP 8 Bits and Git, December 2020

Sustainable PHP: Developing Domain Events

By Edward Barnard

Domain Events are one of the mainstays of modern Domain-Driven Design. They’re powerful, simple, useful. However, when developing them, we need to consider infrastructure. We’ll examine the need for explicit database transactions, view a table design, and provide a way to do our future selves a favor!

Published in SOLID Foundations, November 2020

Sustainable PHP: Refactor to Competitive Advantage

By Edward Barnard

Technical debt is always, and continuously, a challenge. Needs change. This month we’re looking at an approach for being continually prepared for change—refactoring, with unit tests in place.

Published in Running Parallel, October 2020

Sustainable PHP: Build A Composite

By Edward Barnard

How might we keep the next PHP project from evolving into the dreaded Big Ball of Mud? This month we’ll explore and build a possible foundational structure, a “composite.” Then, having built out this structure, we’ll realize that we might still be over-engineering things a bit—but this structure remains a necessary step along the way.

Published in Under the Scope, September 2020

Sustainable PHP: The Quest

By Edward Barnard

This month, “The Quest,” takes us on a quest to avoid the Big Ball of Mud. We’ll begin by learning what the Big Ball of Mud is. Our quest will discover that Domain-Driven Design (DDD) can be our solution, but the current state of the art does not quite (to the best of my knowledge) “bridge the gap” between pure DDD and our typical framework-based PHP development. Next month, in “Build a Composite,” we’ll explicitly bridge that gap with PHP code using a standard PHP framework.

Published in Data Discipline, August 2020

Sustainable PHP: We Got Robbed

By Edward Barnard

Modern PHP software is well capable of large projects. We, therefore, need to approach architecture and design thoughtfully. That observation, unfortunately, runs at odds with our current “agile” methodologies. Here, we take a look at what went wrong and how it got that way. We’ll see the solution is “obvious.”

Published in Warp Driven Development, July 2020

Sustainable PHP: The Cost of Change

By Edward Barnard

PHP projects generally focus on rapid development. The PHP ecosystem allows us to develop new ideas in mere hours or even minutes. However, over the years, many PHP projects reach the point where changes take radically longer. There’s a high risk of breaking something else—which is the worst possible outcome when the company depends on that online presence. Here we start at the beginning with the Manifesto for Agile Software Development.

Published in Advanced Design & Development, June 2020

History and Computing: Transcontinental Railroad

By Edward Barnard

We’re looking at the background behind the U.S. Department of Justice plan to consider antitrust action against the giants of high tech. We’ll see how ocean transportation gave way to transcontinental transportation. That’s the background we’ll need for seeing how transcontinental transportation became the antitrust action that’s setting a precedent for big tech.

Published in Unsupervised Learning, May 2020

History and Computing: Silicon Valley Takedown

By Edward Barnard

On November 18, 2019, U.S. Deputy Attorney General Jeffrey A. Rosen laid out a game plan dealing with tech giants such as Amazon, Apple, Facebook, and Google actively killing competition and forming monopolies. Congress has discussed the possibility of needing new laws to deal with advancing technology. Rosen’s speech, by contrast, showed us our current laws have already proven themselves up to the task of returning high tech to being fair and competitive. Should “big tech” change in a significant fundamental way, that affects all of us.

Published in Machine Learning and OpenAPI, April 2020

History and Computing: My NSA Mug Shot

By Edward Barnard

The secret to finding and fixing the problem was in discerning patterns in the noise. I can’t share the actual code that fixed the problem. What I can do, though, is walk you through an exercise in finding patterns in the noise of a seemingly-random number. We’ll have fun!

Published in How Magento is Evolving, March 2020

History and Computing: The Y2K Deadline

By Edward Barnard

Twenty years later, we’ve mostly forgotten Y2K. Nothing happened. However, there were years of effort behind the non-event. Corporate delay made the endeavor far more complicated because skills had not been passed along to the next generation. What was so difficult? I’ll show you, with a few lines of code from my piece of Y2K.

Published in Cultivating the Developer Experience, February 2020

History and Computing: Mastering the Craft

By Edward Barnard

Truly mastering a skill means passing that skill onto others. What if the skill is so prohibitively difficult it’s not possible to pass on, not in your lifetime? Nathaniel Bowditch faced this problem 225 years ago. We’ll see the problem and how difficult it was. We’ll see how Bowditch created a way which each of us can emulate today.

Published in New Habits, January 2020

Pragmatic PHP: Abstract Thinking

By Edward Barnard

Software is built of abstractions layered on top of more abstractions. We, therefore, all do abstract thinking one way or another. But there is one form of abstract thinking which can help us to understand—and communicate—how the whole system works. We’ll use the flow of a river as an analogy to help communicate that type of understanding.

Published in Expedition PHP, December 2019

Pragmatic PHP: Think Like a Computer

By Edward Barnard

There’s a skill fundamental to software development I’ve always found useful. This skill is essential when working with every programming language, including PHP and when working across PHP frameworks. Like all skills, mastery comes from study and practice. We’ll even discuss how beginners can practice this skill with just HTML and CSS.

Published in Object Orientation, November 2019

Pragmatic PHP: Testing Singletons

By Edward Barnard

This month wraps up our singleton coverage. We’ll see the self registry variant (a self-contained registry pattern implementation). We’ll find ways to test singletons and learn how to test database memoization without requiring an actual database.

Published in Coding Without Fear, October 2019

Pragmatic PHP: Studying Singletons

By Edward Barnard

Practice makes perfect, except when writing PHP code! Our new column Pragmatic PHP explains patterns and variations I’ve used over the years. The better we understand a pattern, the better we can successfully solve the problem before us. This month we’ll take a deep dive into the Singleton Design Pattern. Even though it’s generally considered an anti-pattern, we’ll see useful variations I use time and again. Can global state, static methods, and properties be unit tested? Certainly. We’ll see how.

Published in Master of Puppets, September 2019

Internal Apparatus: Generated Singletons

By Edward Barnard

This month we study the Singleton Design Pattern, but with a twist. We start with a correct implementation but get it wrong by refactoring. We’ll examine the PHP generated code, each step of the way, to understand what went wrong. We’ll observe at least two reasons the Singleton Design Pattern is now considered an anti-pattern. We’re preparing to learn useful variations next month by seeing precisely how it works under the hood.

Published in Renovating Applications with Symfony, August 2019

Internal Apparatus: A Walk Through the Generated Code

By Edward Barnard

The PHP compiler/interpreter reads through our PHP code and produces an intermediate form. PHP’s virtual machine then interprets this intermediate form. PHP’s “generated code” feature allows us to walk through this intermediate form, better understanding exactly what PHP does with the software we write. We’ll begin with a three line example, observing the generated-code changes as we transform our example into a function call and then a static method call. We’ll implement a recursive algorithm to see how the code generator handles the situation.

Published in Find the Way With Elasticsearch, July 2019

Internal Apparatus: Memoization

By Edward Barnard

Memoization is another form of memory use. I see it regularly used for improving application performance, but it’s also used to improve compiler performance. To learn the concept, we’ll use a PHP project with database tables, then look at other ways to use the technique.

Published in How to Tame Your Data, June 2019 —Available for Free

Internal Apparatus: Memory Abstractions

By Edward Barnard

We normally don’t care about abstractions in software, because they exist to hide details we shouldn’t need to care about. However, sometimes, we do need to know the detail. An essential part of how PHP works involves memory management. This month we’ll see new ways to think of memory itself; we’ll also introduce a learning tool we’ll be using in upcoming articles. We’ll be simulating an ancient mainframe computer, and its hard-wired operator console, using modern text messages.

Published in Serverless, ReactPHP, and Expanding Frontiers, May 2019

Internal Apparatus: Patterns in the Code

By Edward Barnard

The PHP compiler source code includes many patterns that can be frustrating and intimidating, because they are so different from typical PHP code, until we understand the structure and context. C’s preprocessor has a significant role in these unfamiliar patterns. We look at several of these patterns in the compiler’s PHP Array implementation.

Published in The New Frontend Fundamentals, April 2019 —Available for Free

Internal Apparatus: Hash Table Collisions

By Edward Barnard

We continue our deep dive into how PHP implements arrays as hash tables. We’ll see how the collision chain works. We’re not ready to dig into the C implementation just yet, so we’ll see how to build and rebuild the hash table using PHP code. This month we’re learning how PHP arrays are stored and manipulated; next month we’ll see the C code itself.

Published in Building Bridges, March 2019

Internal Apparatus: Beginning the Deep Dive

By Edward Barnard

Understanding C code requires far more than understanding the language syntax—we need to understand the environment and context. Along the way, we’ll learn more about how computers work. We’ll be taking a deep dive into how PHP implements arrays. We begin our deep dive this month by looking at the PHP executable file and PHP’s packed hash table.

Published in Out on a Limb – February 2019, February 2019

Internal Apparatus: How PHP Works: Show Me the Code

By Edward Barnard

We all use PHP; it’s open source, which means anyone can take a look. However, it’s not as easy as with the various PHP frameworks, because PHP is written in C and makes heavy use of C preprocessor macros. We’ll see it’s relatively readable once we know how and where to look.

Published in DevOps Depths – January 2019, January 2019

Education Station: Interview Coding Challenges

By Edward Barnard

Meanwhile, the days where employees stay with the same company 20-30 years are long gone. We move around or move on from contract to contract. For many of us, this means formal job interviews. Many of those interviews include coding challenges; that can be a problem. Let’s talk about that!

Published in Better Practice – December 2018, December 2018

Education Station: The Day the Internet Died

By Edward Barnard

The more things change, the more they remain the same. We’re taking a 30th Anniversary Tour of the Morris Worm. We’ll find that the same attacks and defenses remain in use today. It behooves us all, as modern software developers, to understand our history.

Published in Generics and Project Success – November 2018, November 2018

Education Station: Producer-Consumer Programming Techniques

By Edward Barnard

This month we have a “cookbook” of producer-consumer programming examples. We work through a complete example of timing production web page loads. We then consider techniques for message versioning, funneling, and feature migration.

Published in Internal Journeys – October 2018, October 2018

Education Station: Producer-Consumer Programming

By Edward Barnard

Producer-consumer programming is an excellent technique for offloading work from your main application. You can scale resources to meet increased demand. You can smooth out spikes by placing your backlog in a queue. You can set aside long-running tasks such as thumbnail generation. We’ll develop a simple CakePHP application that produces and consumes via a free CloudAMQP (RabbitMQ) account. Although we use CakePHP, the principles are universal to any modern PHP framework.

Published in Magniphpicent 7.3 – September 2018, September 2018

Education Station: That’s Logical

By Edward Barnard

This month we practice working “close to the hardware.” We’ll see why this is becoming more important to today’s software developers. We’ll use the PHP bitwise operators to manipulate single-bit binary numbers. We’ll then take a more general look at ways to learn what we need to learn.

Published in Masterful Code Management – August 2018, August 2018

Education Station: Build an Algorithm

By Edward Barnard

If you have trouble making change for a dollar without a calculator, and don’t care, this article may not be for you. Otherwise, come along with me! We’ll be converting between numbering systems. We’ll create an algorithm for converting between decimal (integer) and hexadecimal numbers.

Published in Navigating State – July 2018, July 2018

Education Station: Build an API, Part Three

By Edward Barnard

In this series, we look at using Behavior-Driven Development (BDD) and specification by example to develop a RESTful API. In Part Three, we focus on the HTTP verbs directing any RESTful API. Understanding where and when to use HTTP verbs will inform how we structure our API and affects the developer experience.

Published in Command and Control – June 2018, June 2018

Education Station: Build an API, Part Two

By Edward Barnard

In this series, we look at using Behavior-Driven Development (BDD) and specification by example to develop a RESTful API. In Part Two we introduce Behavior-Driven Development as a way of communicating with non-developers, our stakeholders.

Published in Treasure, Old & New – May 2018, May 2018

Education Station: Build an API, Part One

By Edward Barnard

In this series, we look at using Behavior-Driven Development (BDD) and specification by example to develop a RESTful API with JSON-formatted request and response. In Part One we introduce these concepts, design our database, and implement a minimal working API.

Published in Testing in Practice – April 2018, April 2018

Twitter for PHP Development

By Edward Barnard

The Internet Research Agency indictment carries strong implications for the software development community. We’ll educate ourselves by drilling down into examples of computational propaganda with Twitter. Then, we’ll relax and learn how we can use Twitter to further our professional development by connecting to the greater PHP community.

Published in Long Running PHP, March 2018

Education Station: Shifting and Masking with a Side of Crypto

By Edward Barnard

The basics can be tricky. This month we take a careful walk-through of a few lines of cryptographic code in PHP. This leads us through the difference between ones’ complement and two’s complement representation. We achieve weirdness by combining logical AND with integer addition.

Published in Know Your Tools, February 2018 —Available for Free

Education Station: What is a Real Programmer?

By Edward Barnard

We expect a shortage of software engineering talent in 2018. Those with a deeper understanding of how things work will most benefit from the shortage. Let’s bring in 2018 by taking on one of those fundamentals, binary arithmetic, but with a twist: We’ll use XOR and AND logic for our implementation.

Published in Setting Up to Succeed, January 2018

Learning Machine Learning, Part Three: Data Wrangling

By Edward Barnard

Part One and Part Two of Learning Machine Learning explored the machine learning (ML) workflow. We built and evaluated a K-nearest neighbors classification model. By far the most work for this classification project, behind the scenes, has been wrangling the input and output data. Since this sort of PHP/MySQL data wrangling is nothing like building a website, we’re using Part Three to build our wrangling skills.

Published in Talking Code, December 2017