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


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