PHP

How to Learn PHP Unit Testing With Katas

All PHP code gets tested. Most of it is tested by the developer when they check to make sure the webpage looks right in their browser; some when you run an API response tool, like Postman. Some of it is tested when that same developer writes automated tests and runs them against it---this is our focus. Sometimes code is first tested when the unfortunate client or user feels like using the feature and tests the developer's work. Hopefully, they're not disappointed.

Continue reading

Standard
PHP

PHP Web Scraping: What to know before you start with Symfony Panther, Goutte, and more

First and foremost, scraping the web (in PHP) is bad, mkay? PHP web scraping isn't worse than doing it with other languages, it's just that web scraping in general is most likely to be looked by with disdain by content-producers. And it'll make your code more brittle than it should be, and is general going to make an application more complex to build.

Continue reading

Standard
High-Level Concepts

All Programs Have a Surrounding Human Context. This Matters

This is the second in a series detailing what I consider "Thoughtful Code." In the first one, I highlighted the high-level overview of what I consider "good" code, here I'm going to go (a lot) deeper into what this overarching framework means in its specific components. Well one of it's components. Specifically, the context in which our code lives, and how that shapes our definition of code quality.

Continue reading

Standard
High-Level Concepts

Thoughtful Code is Contextual, Intelligible, Verifiable, and Cellular

I've been thinking a lot lately about what makes code "good." Let's take it for granted that "good" is so meaninglessly subjective that it's not really a useful term for one to use when talking about a program or block of code. So let's say that "thoughtful code" is code that meets my personal subjective definition of "good." But before you zone out, I want you to know that a lot of "bad" code is actually "good" and vice-versa. The counter-intuitive reality is that WordPress contains some of the best PHP code on the planet. Let me explain why…

Continue reading

Standard
High-Level Concepts

ORM Patterns: The Trade-Offs of Active Record and Data Mappers for Object-Relational Mapping

One of the topics of seemingly perennial discussion among programmers is whether object-relational mapping (often abbreviated to ORM) is evil or not. Opinions seem to run the gamut from "I use and love it" to "I tried it once and never will again." And you often encounter at least a few "what are you talking about?"s.

Continue reading

Standard
High-Level Concepts

The OWASP Top 10 from 2017, Explained

Recently (at the end of 2017), OWASP updated its Top 10 list. For the unfamiliar, let me briefly explain what that means: the industry standard of basic-web-security education has altered. Though it's never been a complete security education, the OWASP Top Ten is where almost all standards for web-developer security education begin. So when it changes, that's kind of important.

Continue reading

Standard