A simple, plain English explanation

Imagine you’re working on a school project with your best friend.

You have to write a research report, and you decide to take turns doing the work.

Your friend creates a doc with the introduction, calls it Project_v1, and emails it to you.

You add the next paragraph, rename it Project_v2, and email it back.

And so on, back and forth, adding paragraphs. Pretty inefficient, but gets the job done. Until the editing stage.

In Project_v19, you both edit the same paragraph, at the same time, and the email it to each other. Your changes overlap. You have to decide whose changes “win”.

It’s pretty confusing, but you figure it out.


Part 1: Speaking in machine learning

Last year, my girlfriend and I were apartment hunting in Vancouver, a notoriously expensive city. Walking into a 700 sq foot apartment that’s listed for $2000 (and feels like a shoebox) makes one go “this is crazy.” Having that happen multiple times makes one go “wait, is everyone crazy?”

Well, let’s find out. Can we use machine learning to predict what a “good” rental price is for a given apartment size?

(This is the first of a few articles on the basics of machine learning. To set expectations, we’re not going to solve the problem in this article, but we…


Military strategist John Boyd on creativity

Creativity doesn’t come from deep study of one particular field. It comes from combining ideas from multiple fields.

In fact, there’s no such thing as a truly original idea. Innovative ideas are just existing concepts, rearranged in novel ways.

To expand this idea, let’s look at the career of John Boyd.

John Boyd was a fighter pilot who went on to become one of the most original thinkers of the 20th century. His advocates call him the best military strategist since Sun Tzu.

His life’s work was a theory of strategy called maneuver warfare. But he also applied the principles…


What the heck is serverless?

Why you should care about AWS Lambda:
- it’s one of the most popular services on Amazon Web Services (AWS)… or at least one of the most talked about
- it’s an incredibly cheap way to build your application
- it’s a big part of AWS’s “serverless” architecture

Which leads us to our first question… what the heck is serverless, anyway?

What does serverless mean?

Serverless architecture is a lie.

Or, at least, a misleading name.

Serverless doesn’t mean no servers are involved, it just means you don’t have to think about those servers.

You don’t have to manage them, or provision them, or…


How to accelerate your growth

Photo by Denys Argyriou on Unsplash

Beginnings

The moment I decided to become a software developer, I was sitting in the basement of a hostel in Peru.

This was 2015. In 2014, I had graduated university with a degree in English Literature. But what was I supposed to do now?

(For those considering a degree in literature the answer is… not a lot.)

I had originally wanted to be a high school teacher, but decided I wanted more. More control over my time, more rewards for excelling.

Okay, so I wouldn’t be a teacher. So what would I be instead? What did I actually want?

In truth…


Five points to remember

Writing this article started with a question: if I could give a new developer one piece of advice to help them write great React, what would it be?

My answer: write clean components by following the rules of writing clean functions.

Why focus on writing components?

Our goal is to write React applications that are easy to read, easy to maintain, and easy to extend.

There are a lot of factors that go into this: architecture, state management, file structure, code formatting, etc etc.

But the bulk of our application—the bulk of the code our team will be working with—will be components.

If your components…


Decide which GraphQL library is right for you

Photo by rawpixel on Unsplash

Introduction

So you’re decided to try GraphQL in React.

You’ve read the articles extolling how it is the future. You’ve seen its usage spread to major tech players. And the developers you know won’t shut up about it.

Now what?

Well, the two major libraries for adding GraphQL to your React app are Relay and Apollo. Both are mature solutions, and plenty of people will swear by one or the other.

But which one is right for you?

I can’t answer that question for you. …


Using the Single Responsibility Principle to build better apps

Photo by Austin Kirk on Unsplash

The advantage of the component system in React (and view libraries like it) is that your UI gets split into small, digestible, reusable chunks.

Each component is usually compact (100–200 lines), a size which is easy for other developers to understand and modify.

But while component brevity tends to be the case, there’s no hard and fast rule. React will not complain if you decide to package your app into one monolithically monstrous 3000 line component.

…but you shouldn’t. In fact, most of your components are probably too big—or rather, doing too much.

In this article, I’ll make the case…


The path to slimmer controllers and models

Photo by Patrick Schneider on Unsplash

Imagine you have a controller with some complex business logic.

class UserController < ApplicationController
def create
user = User.new(user_params)
if user.save
send_welcome_email
notify_slack
if @user.admin?
log_new_admin
else
log_new_user
end
redirect_to new_user_welcome_path
else
render 'new'
end
end
# private methods
end

This code isn’t unreadable, but there’s a lot going on. The controller has too much to deal with—it needs private methods to cover everything from sending a welcome email to notifying slack to logging whether it’s an admin or user.

Clearly, if we want skinny controllers, the above approach isn’t the best.

We could extract all of the above into…


A revised and up-to-date guide to the new React component lifecycle

Since my first article on this subject, the React component API has changed significantly. Some lifecycle methods have been deprecated, and some new ones have been introduced. So it’s time for an update!

(See how I resisted making a shouldArticleUpdate joke? That’s restraint.)

Since the lifecycle API is a bit more complex this time around, I’ve split the methods into four sections: mounting, updating, unmounting, and errors.

If you’re not super comfortable with React, my article here provides a thorough intro.

Tip:

Build React apps faster with a collection of reusable components. Use Bit to share your components and use…

Scott Domes

Writer & teacher, currently focused on software (JavaScript, Rails & more). Author of Progressive Web Apps with React.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store