Meetup Talk on Building APIs

I spoke on Building APIs, focusing mostly on the upfront design of APIs, at the most recent Las Vegas PHP Meetup. Overall this was defiantly one of my better talks with lots of good feedback. One key things helped I believe in the preparation and eventual presentation of the talk. I presented a rough version of this to my fellow Loadsys employees with some valuable feedback provided from them.

Tagged with: , , , ,
Posted in Communication, Presentations, Programming, Web Development
Short Link:

Lighting Talk at CakeFest 2015: Projects Are Better When Maintained

At this year’s CakeFest I gave a lighting talk titled “Projects Are Better When Maintained”. Essentially, it was a complaint to be a better maintainer of the open source stuff that you put out. It went over really well and I got some good feedback from it.

Tagged with: , , ,
Posted in Communication, Computer Science, Presentations, Programming, Web Development
Short Link:

Just Say No to More End-to-End Tests

The bulk of your tests are unit tests at the bottom of the pyramid. As you move up the pyramid, your tests gets larger, but at the same time the number of tests (the width of your pyramid) gets smaller.

As a good first guess, Google often suggests a 70/20/10 split: 70% unit tests, 20% integration tests, and 10% end-to-end tests. The exact mix will be different for each team, but in general, it should retain that pyramid shape.

Title is provocative, but the sentiment of loading up on unit tests over end-to-end and integration tests sits well with myself. One of the key problems with integration and end-to-end tests is that they wind up being harder to debug when something goes wrong the exact place that things broke is hidden behind these multiple layers of code. Unit tests give you a key unit of code where, this changed and now it isn’t responding in the same way, look right there.

Tagged with: , , ,
Posted in Programming, Software Code
Short Link:

The Last Line Effect

So what we get is the following pattern:

The probability of making a mistake in the last pasted block of code is 4 times higher than in any other block.

Neat bit of research from Intel here and it makes a fair bit of sense to me that it’s easy to miss a duplicated line or other minor error when scanning multiple lines that all differ in very minute ways.

Tagged with: , , ,
Posted in Computer Science, Programming, Software Code
Short Link:

CakePHP 3.0, Use It In Pieces

One of the key goals of CakePHP 3.0 as discussed recently was making CakePHP 3.0 more decoupled. CakePHP 3.0 has achieved that goal very nicely. Take a look at the CakePHP organization’s repos on GitHub and you will find a long list of decoupled collections of classes that are all part of the overall CakePHP framework that can be used completely independently of CakePHP itself.

Perhaps you are interested in some of CakePHP’s utility classes, like the Security utility, which are a great resource for hashing and encrypting basic data (not passwords) that you want some amount of reasonable security applied to it. Or perhaps you are interested in CakePHP’s Validation system which provides for validating arbitrary arrays of data. The most complex and most interesting part of CakePHP 3 by far is even available for use independent of the rest of the CakePHP core, the ORM layer.

How about an example to help clarify how to use these different pieces in smaller projects. Let’s build a simple webpage that allows us to submit a contact form request and validate it using the CakePHP Validation Library.

I’m doing this in a new `index.php` file in a new directory. First we need to get the Validation Library in our directory.

$ composer require cakephp/validation

That creates a new `composer.json` and loads the CakePHP Validation package. Next in our `index.php` file we need to load the Composer autoloader and the CakePHP Validation Class.

namespace LoadsysTestValidation;
require dirname(__FILE__) . "/vendor/autoload.php";
use CakeValidationValidator;

Now at this point we can create a new instance of the Validator class and validate arbitrary arrays of data, like what we would get from `$_POST`.

$validator = new Validator();
  ->notEmpty('name', 'Name is required to be submitted.');
$errors = $validator->errors($_POST);

I worked out a complete example of this and posted it on GitHub as a sample if you need more details or insight into using the CakePHP packages.

The overall CakePHP framework may not be the right choice for everyone in every case. With the recent decoupling of the framework in the 3.0 branch, CakePHP can be more easily used for those times when you want to pick either the very best packages for your problem or you only need a limited subset of features from CakePHP for your web application.

This was previously posted on the Loadsys blog.

Tagged with: , , , ,
Posted in Programming, Web Development
Short Link:

CakePHP 3.0 Retrospective

With CakePHP 3.0 out the door, I thought it would be good to reflect on the project. CakePHP 3.0 is the longest and largest open source project milestone I’ve ever participated in. At FreshBooks we do retrospectives on large projects as a way to see what went well, and what could have gone better. The goal is to discover things we should keep doing, and what to improve the next time around.

Thanks Mark for putting in the hard work of getting CakePHP 3.0 out the door. I wrote a piece for Loadsys talking about some of the new features that echoes a lot of the good things that Mark points out in his retrospective.

Tagged with: , , , ,
Posted in Programming, Software Code
Short Link:

In the pocket

I just don’t have a need for what the Apple Watch currently provides.

I’m sure its functionality will grow with time, though, and as it does I’ll revisit my decision not to buy one.

This doesn’t mean I don’t appreciate its appeal, even apart from the natural desire of gadget fans to have the latest thing. If being constantly connected were more important to my job or my sense of self, and if I had to process many more messages away from my desk than I usually do, I’d see the Apple Watch as a godsend—assuming, that is, that its user interface fulfills its promise to act as a timesaving message filter.

This is a near-perfect summation of my thoughts on the Apple Watch as it stands today. I would be a little more critical in some areas, but overall Dr. Drang echoes what I’ve said both on and off-line.

Tagged with: , , , ,
Posted in Technology
Short Link:

Economy of Tests

A common complaint with teams that first try their hand at automated testing, is that it is hard, costly, and not worth the effort. On the other hand, supporters say that it saves them time. In this post, we’ll try to add some nuance to the discussion. We’ll take a look at how different levels of automated testing affect the cost of development, both in the short and the long term, for both greenfield and brownfield projects. Finally, we’ll look at a simple strategy for introducing tests and migrating them across test levels, in order to reduce maintenance costs.

Something I’ve been exploring over the past few months is while I’m quite good at ensuring there are unit and integration testing done on my projects, one area of testing lacking is system or functional testing. This piece does a good job explaining some of the key differences and value trade offs in each.

Tagged with: , , , ,
Posted in Computer Science, Programming
Short Link:

Quantity Queries for CSS

In this article, I will be outlining a technique to make CSS quantity-aware using specially formed selectors. I will be applying these selectors to one classic problem in particular: how to alter the display of items in a horizontal navigation menu when there are too many to suit the initial layout mode. That is, I will demonstrate how to switch from a display: table-cell to a display: inline-block layout when the number of items in the menu becomes “more than or equal to 6.”

This is one cool technique, though it requires a fair bit of forethought at the implementation stage.

Tagged with: , ,
Posted in Programming, Web Design, Web Development
Short Link:

Google and blogs: “Shit.”

Everyone’s spending increasingly more consumption time dicking around in apps and snacking on bite-sized social content instead of browsing websites and searching Google.

Publishers are relying more on social traffic not because Google’s squeezing them out, but because that’s where everyone went. The dominance of mobile usage, social networks, and YouTube, plus attention-competition from apps, are the real problems for web publishers and blog writers.

The social and app revolutions haven’t been purely additive — much of the time people spend on those now has come at the expense of search, RSS, and bookmarks.

Every hour we spend on Twitter or Facebook instead of reading and writing elsewhere is just making this worse — and I’m as guilty as anyone.

Social networks have powerful benefits and are here to stay. But like any trend, we’ve swung too far in that direction for our own good, as both producers and consumers. I hope the pendulum starts to swing back soon, because it hasn’t yet. It’s going to get worse before it gets better, if it ever does.

This entire piece reads to me as; People have moved on from the medium that I think is more important (ie. blogs) don’t you bloggers know if you stop reading and linking to blogs, blogs will be less popular. Mehh? People/Culture moves on from mediums it no longer considers as important, think print media over the prior two-ish decades. Why should we be worried about this? Is it just worried in the abstract that blog traffic is declining, which is bad because – something? Is the argument that social networks are going to put bloggers out of work or something?

Tagged with: , ,
Posted in Culture, Social Media, Technology
Short Link: