best-of

  • Leaving Yahoo After 15 Years

    Today was my last day at Yahoo. I decided to resign after 15 years.

    In 2007, one year before joining Yahoo, I was living in Southern Illinois and just graduated high school. I was working for a local company making websites for K-12 schools.

    My former boss there, Dav Glass, recently moved to California for a job at Yahoo. I visited Yahoo’s campus in Sunnyvale that summer. The energy and excitement there marked me.

    One year later, when I was 19 years old, Dav invited me to apply for a job. Soon I found myself opening a yodeling purple box with a full time job offer to build apps for the web. I dropped out of university and moved across the country.

    Joining Yahoo in 2008 was a very special time. Hack Days in Sunnyvale and NYC. Working alongside smart folks who have shaped our entire industry. Nonstop learning.

    Over the years I was a YUI Library core contributor, learned how to help other developers, built developer tools, and most recently I helped build Yahoo Mail.

    The last 6 months have been an incredible time. I led a team of 7 engineers responsible for our React framework. Together we made iteration speed as fast as possible. Everything was made faster without a big rewrite — faster dev startup, faster React Fast Refresh, faster PR builds, faster clock speed. A lot of new code was written with modern dependencies. We built tests for UI outcomes instead of implementation details. And we removed tech debt in the existing product too. It was very ambitious and I am proud of the team I am leaving behind. I wish them all the best.

    I will have more to share on my upcoming plans in the next few weeks.

    Yahoo changed my life. California is now my home. The time has come to move on, but I will always be thankful for all the Yahoos who helped me become the engineer I am today.

  • California, Forever

    Last weekend, we packed the truck and headed for Sacramento.

    Diapers, travel crib, stroller, motorcycle.

    We visited old friends and started new fall traditions. Apple orchards and pumpkin patches with our families.

    And kept a few old traditions alive.

    My grandparents rode motorcycles. As they rode, they helped others. Hundreds of motorcyclists attended my grandmother’s funeral and many shared how their lives were transformed after meeting with her. I hope to honor their legacy.

    The best place to ride a motorcycle is California: natural beauty everywhere, wonderful weather, lane-splitting, moto culture, mountains, rivers — for all of its problems there is a reason so many come from all over to enjoy this place.

    I came to California to work. These days folks can work anywhere. But there is something special in this place. It is not perfect, but it is home.

    I intend to remain and raise my family here. Instead of seeking a place with less problems, I want to help leave this place better than I found it. I set out to do just that many years ago. And now I am beyond thankful to call this place home.

    California, forever.

  • Hosting a nonprofit website for free with WordPress, Azure, Trellis, and Terraform

    I open sourced the WordPress stack and Azure web server infrastructure used for awakeningchurch.com.

    Azure can host WordPress at no cost because Microsoft offers $3,500 a year in Azure credits for nonprofits. You only need about $360 of these credits to serve a simple website with a staging and production servers.

    WordPress stack

    The WordPress repo is a combination of Trellis and Bedrock which provide server provisioning and dependency management powered by Ansible and Composer. You can manage it all with the simple Trellis CLI.

    Inside you will find:

    We are using Composer to install and update WordPress plugins like these:

    Some custom plugins we developed for custom post types like teaching and events are not yet open source. We are moving from Azure DevOps to GitHub for hosting repositories and these plugins will make the move soon.

    Infrastructure with Terraform

    The infrastructure repo contains a Terraform configuration to setup a blue-green deployment of a staging and production servers.

    You can get a lot of performance out of a small server with Trellis when using FastCGI caching.

    The setup is simple: a single Standard B1s server and a Premium SSD P4 32 GB for each environment. This costs about $30/month for two servers with one per environment. We only use about $360 of our $3,500 credits so the hosting is free.

    Other infrastructure

    We also use Azure storage for storing WordPress uploads and the Azure CDN for delivering uploaded assets. Uploads and CDN URLs are handled by the Azure Storage Plugin. Costs are minimal and there are plenty of left over credits to spend.

    This storage infrastructure is not included in our web Terraform infrastructure because it was created long ago.

    What’s next

    As I need to recreate servers to upgrade them, I plan to extend the Terraform repo to include a wrapper stack to switch Cloudflare DNS to new servers. I do DNS changes manually for now.

    Self-hosting is great

    I hope this example of hosting a WordPress website will help you in creating websites of your own.

    Nonprofits with nerds on staff (or volunteering) can make use of the $3,500 in Azure credit to make their website hosting free.

    I believe owning your web presence is important. Most folks can grab a domain and pay a provider to host WordPress. Since you control your site’s data, you can easily grow your site later and have hundreds of hosting options, plugins, and themes to build your site.

    And if you are comfortable on the command line, you can use the Trellis CLI to create a new WordPress installation and start a $5 DigitalOcean droplet which is more than powerful enough to host most websites. You can locally develop your changes and deploy them to your production site with little effort.

    Getting started looks something like this:

    brew install roots/tap/trellis-cli vagrant virtualbox
    trellis new example.com
    trellis up

    This very site uses Trellis. I host several more websites using similar tools which makes self-hosting WordPress much easier.

    WordPress block editing has made WordPress into a very flexible tool for content. I recommend you try WordPress out if you haven’t used it in a while — it’s good.

  • Build Modules, Not Examples

    I’ve been thinking out loud this afternoon about how modules make Node.js successful with @ekashida, YUI’s newest team member.

    YUI is a powerful open-source library for developing web apps. Node and YUI both document their APIs very well. Unlike Node, we also have 250 examples to help people get started. Yet lots of people have trouble getting started anyway.

    How do we make that easier?

    We’re not the only web app library with this problem. Ember has received criticism around getting started and quickly responded with a roadmap to improve it. In their response, Tom Dale said:

    Ember promises—and, we think, delivers—tremendous value. But ramping up to that point is not easy, and we received this feedback repeatedly and take it very seriously.

    We get the same feedback for YUI. We also take it seriously and a fellow team member is working on better documentation. Ember’s action items include a Getting Started guide, a short screencast, live examples to run demo code, and other things. These are good and will help.

    But then, I think about Node. Their official newbie documentation begins and ends with Hello World on their homepage. Node’s newbies do not get started with an example. They get started with npm.

    Modules Are The Example

    Node has effectively outsourced their examples to the community using npm.

    You may be thinking: “Reid, modules are not examples. They are tools you use to build an example, or a real app.” Well, you’d be right. Node’s community has built enough modules to help people build apps they care about with a tiny learning curve. Instead of reading about code, these newbies are building something with a tool—the module—that lets them start building what they care about right away.

    Few newcomers to Node.js use require("http") to build their first web app. If the barrier-to-entry was to understand the HTTP module, a lot of people would walk away. They don’t want to learn about that module, they want routing. View rendering. You know, a web app.

    The example is Express. Newbies have a project in mind and it’s probably something that needs a router, view rendering, and middleware. Express delivers that. You don’t need to learn about Node yet, you learn Express.

    Once you’re up and running, you have real code and real problems. Not theoretical problems in a narrative, but problems that are running on your computer. Problems getting in the way of building what you care about. That’s motivation.

    Since you’ve already spent an hour getting the basics setup because the Express API was a lot easier to get started with, you’re now motivated to dig deeper into Node to find the next solution.

    Building A Ramp, Not A Cliff

    Understanding everything Node has to offer isn’t something you learn overnight. But that isn’t necessary. A lot of people have built modules on top of Node’s core that make all kinds of common problems easy. These modules are easy to download and use. Newbies are engaged immediately. Then, they’re are progressively lured into deeper water. The community grows.

    If you need to learn a million things before you can get started, you’ll never start. If that’s your project’s learning curve, you’re presenting newbies with a cliff. Some people will climb it, some will seek climbing experts to get to the top. Some may have the patience to read a book about climbing, or watch a screencast featuring someone else climbing.

    But most people want to get started today, so they’ll leave and find an alternative way to the top that’s easier to climb.

    Node provides many ramps. They aren’t ramps you merely read about: they’re ramps you walk on, build on, get experience with, and get more complicated as you go up. It doesn’t fix every problem and some people will still be confused. But it works pretty well.

    At YUI, I’ll be encouraging our team to focus on building example modules: the ramps to mastery. YUI is already modular, but that isn’t the same. I’m talking about bundling modules in YUI’s core into a fully-baked solution to a common problem. Other people on my team are hard at work on the first product, and now I know why I’m so excited: it’s a ramp.

  • Write Code That Works

    Dav Glass and I visited the Yammer office in San Francisco this week to discuss build & test tools we use at YUI.

    We showed off Shifter for building YUI, Grover for testing headlessly, Yeti for testing in browsers, and Istanbul for statement-level code coverage. We use Travis for running most of this stuff in public CI. We now require 70% statement coverage before a new YUI module is allowed to land in the core and nobody can commit when the Travis or internal CI build is broken, unless the commit fixes the build.

    This is all very impressive. But @mde was quick to notice that we didn’t drop everything to get to this point—before diving in, you first need to prioritize what you work on. I couldn’t agree more.

    When you’re starting from scratch, you start to love the metrics. Green dots for passing builds. Green coverage reports when you hit 80% of your statements. The increasing number of passing tests. I’m all for having good code coverage, but before you go crazy, you should be careful that you don’t start writing tests for the wrong part of your code.

    Your code is not uniform

    Your code has various levels of quality starting at the first commit you make. You will write some code that’ll last for weeks or months, and some code that’ll need a rewrite next week. You need to embrace this kind of change and understand where it happens in your project.

    Node.js solves this problem quite well with the notion of a Stability Index.

    Throughout the documentation, you will see indications of a section’s stability. The Node.js API is still somewhat changing, and as it matures, certain parts are more reliable than others. Some are so proven, and so relied upon, that they are unlikely to ever change at all. Others are brand new and experimental, or known to be hazardous and in the process of being redesigned. The Stability Index ranges from Deprecated (0) and Experimental (1) for unstable code to Locked (5) for code that only changes for the most serious bugs.

    It’s a good idea for any post-1.0 project to assign a Stability Index to the APIs in your own code. Not only is it a clear message to those using your APIs, but it’s also a clear message for your team. It tells you where you should—and shouldn’t—write tests.

    More stable, more tests

    If you write tests like they cost nothing, you’re going to find yourself writing tests instead of writing code that works.

    Kent Beck’s wisdom says it best:

    I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence (I suspect this level of confidence is high compared to industry standards, but that could just be hubris). If I don’t typically make a kind of mistake (like setting the wrong variables in a constructor), I don’t test for it. This answer is good and I’ll take it a step further: You should prioritize writing tests for parts of your code with a higher Stability Index. Especially if you’re just starting on a new project.

    If you’re writing tests for code that’s rapidly changing, you’re going to spend more of your time writing tests instead of shipping features. For code that’s brand new, I typically only test-first a small amount of code and wait a while before hitting that green bar on a code coverage report.

    Don’t get sucked into the allure of metrics too early. Remember what your job is: writing code that works. Code coverage and good testing tools are very important, but not if they get in the way of building what you’re supposed to build.