Remy Porter

Remy is a veteran developer who writes software for farming robots. They pick tomatoes.

He's often on stage, doing improv comedy, but insists that he isn't doing comedy- it's deadly serious. You're laughing at him, not with him. That, by the way, is usually true- you're laughing at him, not with him.

Joined Up

by in CodeSOD on

Sandra from InitAg (previously) works with Bjørn, and Bjørn has some ideas about how database schemas should be organized.

First, users should never see an auto-incrementing ID. That means you need to use UUIDs. But UUIDs are large and expensive, so they should never be your primary key, use an auto-incrementing ID for that.


Three Minutes

by in CodeSOD on

Angela's team hired someone who was "good" at SQL. When this person started, the team had some regular jobs which ran in the mornings. The jobs were fairly time consuming, and did a lot of database IO. When their current database person left for another job, they hired someone who had a "good grasp" on SQL. We'll call him Barry.

Barry started out by checking the morning jobs every day. And over time, the morning jobs started getting slower and slower. That was a concern, but Barry swore he had it under control. Barry did not share that a handful of slow queries- queries which took three or so minutes to run- had suddenly started taking 75+ minutes to run. Barry didn't think about the fact that a little time with the query planner and some indexes could have probably gotten performance back to where it should have been. Barry saw this problem and decided: "I'll write a Python script".


Preformatted

by in CodeSOD on

Amity sends us a "weird" replacement, and I regret to inform you, it's not as weird as it should be.

$body = str_replace(['<pre><code>', '</code></pre>'], ['<pre>', '</pre>'], $body);

Development Tools

by in CodeSOD on

A few holiday seasons ago, Paul S was doing the requisite holiday shopping online, looking for those perfectly impersonal but mildly thoughtful gifts that many companies specialize in. This was one of the larger such vendors, well known for its fruit-filled gift baskets. As is not uncommon for our readers, when the site started misbehaving, he pulled up the dev tools. He didn't solve the problem, but he did learn a lot about how they were managing their API keys, as this was exposed to the client:

    env: {
        APP_AUTH0_GUID: 'ctZZL1BqgKm9kBmDEKAjt0yBeQ47Cpwl XS0xxpLFS5g8o-EUpSu4fi9ecOqN19WnXn-EqI9yaupwme22bKuBd2jH3Kf3QngZ',
        APP_LOGGING_ENABLED: 'true',
        APP_LOGGING_SERVICE_PATH: 'r/api/logging/mbp-ui',
        REACT_APP_MBP_LOGGER_CONSOLE: 'ERROR',
        APP_TIQ_ACCOUNT: '1800flowers',
        APP_TIQ_PROFILE: 'full',
        APP_TIQ_ENV: 'prod',
        APP_PAYPAL_SDK_URL: 'https://www.paypal.com/sdk/js',
        APP_PAYPAL_CLIENT_ID: 'AcYrxrOkFwUnMKRoJmkOR0N6caopqRNqwNRxy6H-EvZ-IKUz22i-E0uT0uMT7JQZEC33Oy1HCNsgm_le',
        APP_PAYPAL_ENV: 'production',
        APP_PAYPAL_SOURCE: 'PWA',
        APP_VENMO_ENV: 'production',
        APP_VENMO_PROFILE_ID: '2705494007504552889',
        APP_AUTH_LOGIN_SOURCE: 'undefined',
        APP_SG_BASKET_SCRIPT: 'https://cdn2.smartgiftit.com/scripts/widgets/gift-basket.js',
        APP_AUTH_DOMAIN: 'login.celebrations.com',
        APP_AUTH_AUDIENCE: 'celebrations-prod.1800-flowers.auth0.com',
        APP_STATUS_BAR_ENABLED: 'true',
        APP_WALLET_ENABLED: 'true',
        APP_VERIFY_ADDRESS_HOST: 'api.edq.com',
        APP_VERIFY_ADDRESS_AUTH_TOKEN: '47d991c9-043e-4073-bee3-a5c8922baa3a',
        APP_FULLSTORY_ORG_ID: 'MXD30',
        APP_GRAPHQL_ENV: 'production',
        APP_VISA_CHECKOUT_API_KEY: 'B0LQRDVCE0LWKBHR880J14gCRlEjr_UqLhh6V-yYRAmcvD0W8'
}

The Barren Fields

by in CodeSOD on

Today, it's not exactly the code that was bad. For some time, a government agency had been collecting information from users using fillable PDF forms. The user would submit the form, and then a data entry clerk would copy the text from the form into a database. This, of course, raised the question: why was someone manually riding the copy/paste button?

Sally was tasked with automating this. The data is already in a digital format, so it should be easy to use a PDF library to parse out the entered data and insert it into the database. And it almost was.


Completely Readable

by in CodeSOD on

It is eminently reasonable for companies to have "readability standards" for their code. You're writing this code for humans to read, after all, at least in theory. You need to communicate to future inheritors of your code.

But that doesn't mean readability standards are good. Tony's company, for example, has rules about returning boolean values from functions, and those rules mean you are expected to write code like this:


Greater Than False

by in Representative Line on

Today's anonymous submitter passes us a single line of JavaScript, and it's a doozy. This line works, but that's through no fault of the developer behind it.

{arr?.length && shouldNotShow === false > 0 (...)}

Poly Means Many, After All

by in CodeSOD on

Capybara James sends us some code which is totally designed to be modular.

This particular software accepts many kinds of requests which it then converts into a request for a ListView. This is a perfect example of where to use polymorphism, so you can write one transform method that operates on any kind of request.


Archives