And why and when you shouldn’t

Image for post
Image for post
Think about who you’re telling game over — just because the player failed doesn’t mean the game failed. Photo by Sigmund on Unsplash

A few months back, I was reading about HTTP status codes — as one casually does — when I stumbled across 2 gems:

  1. Return code 418 is “I AM A TEAPOT”. It’s an April fools joke — well, as close to a joke as us nerds can muster. I’ll have a link at the end of the article.

I knew this in the back of my mind, but it wasn’t until I worked on a particular project until I realized the wisdom behind this distinction, and why it matters. Error handling — the difference between developing and engineering — requires understanding the role all actors play in a system.


…has a lot to do with treating spaghetti code

Image for post
Image for post
Photo by Mae Mu on Unsplash. Not the final product of our recipe — try the recipe yourself!

Our Secret Family Recipe

Before making your sauce:

  1. Fill a pot with water. Add salt — we advise a lot. Add oil if you want; we don’t.

In short: steep your spaghetti in tea instead of plain water. …


How the framework fosters deception and undermines the basis of civilization

Image for post
Image for post
Kinda what I looked like when I uncovered Angular’s fatal flaw. Photo by Tim Gouw on Unsplash

Angular Is Not All Awful

I’ve worked with Angular professionally, some good and bad codebases. I have to say, most of Angular is fine. Many parts are actually pretty neat — I’m a fan of how much it uses reactive programming concepts, exposes web component support, and provides a nice dependency injection system.

Some of the concepts and structures are similar enough to Spring that some of my junior backend colleagues were able to find their way around the codebase — which is valuable in-and-of-itself.

But, there is at least one thing that can go horribly wrong with Angular.

No, I’m not talking about the boilerplate, the learning curve, the performance, or the upgrade process. My beef with Angular is far more fundamental and perverse. …


Image for post
Image for post
Hopefully, I’ll save you from getting her headache. Photo by Aiony Haust on Unsplash.

You’d imagine free public datasets would be painless

This wasn’t painless. But now that I’ve figured it out, I want to save you Google-ers out there some time.

What’s Google Colab?

Colab is a way to run Python Jupyter Notebooks on the Cloud, for free. It’s provided by Google and integrates with Google Drive. Very clean way to handle “but it doesn’t work on my computer!” issues.

See the “Resources” section at the end of this article for a link.

What’s Kaggle?

Kaggle is “Your Home for Data Science”. It hosts public datasets and competitions revolving around Data Science and Artificial Intelligence. It adds a sense of gamification to it as well. …


Deploying quantopian.com algorithms for live (or paper) trading with Docker

Image for post
Image for post
Build your own compass for finding your way through the market. Photo by AbsolutVision on Unsplash

Before we talk code, we will clear up 2 misconceptions about stock investing, namely:

  • stocks are a zero-sum lottery (investing is not, trading may be)

Then, we will discuss the technical side of stocks, particularly focused on Quantopian algorithms, alpaca.markets, and deployment with Docker on an AWS EC2 instance.

But First, Where’s The Code?

Relax, it’s all right here in GitHub. Don’t forget to star the repo!

This Is Not Gambling

For some reason, some people think trading stocks is an entirely risky affair, akin to the lottery. There is some risk involved (depends on the stock!), yet unlike the lottery, the numbers are in your favor.


Never lose a form submission again

Image for post
Image for post
Now that’s what I call local storage! Photo by Aneta Foubíková on Unsplash

Story Time: Moodle Quizzes

Some years ago, I used an open source LMS called Moodle (comparable to Blackboard or Canvas, if you’ve heard of those). At the time, it was not the prettiest, but it worked well enough, and the school could not complain about the price. I really only had one complaint.

When taking a test/quiz in Moodle, it would pop up a reminder about how much time you had left. Not the smoothest user experience (UX), but understandable at the time. However, if you were typing a response, the text area would suddenly be de-selected. …


Resolve. Reject. But what about neither?

Image for post
Image for post
Race your promise against the clock. Photo by Jonathan Chng on Unsplash

Promises are a nice way to wrangle your asynchronous JavaScript. When they resolve or reject, you can easily view how these 2 outcomes are handled with Promises.

However, asynchronous tasks have 3 scenarios: resolve, reject, or neither. The latter scenario, combined with delayed resolution/rejection, often goes unconsidered in our JavaScript code, perhaps assuming the underlying library is mature enough to eventually reject operations that take too long. However, this may not be the case — and if it isn’t, the handling required may not be exactly the same as any other error.

For example, consider slow network requests, database operations, or loading scripts. Depending on your use case, you may want to retry the request with a different host, notify an SLA tracker, or notify a 3rd party UI developer about their web component taking too long to load. …


Or: How to Cancel That Embarrassing Email

Image for post
Image for post
Photo by Andrej Lišakov on Unsplash

Ever send an email you immediately regretted, or click submit even when you noticed something was wrong? “Where’s the red X? Can I quickly stop that?”, you cry!

Promise Methods

In Javascript, asynchronous behavior is captured with Promises. While they are cleaner than callbacks and are deeply integrated with the language (async and await), Promises have very few methods: then accepts a callback which is run when the behavior succeeds, catch runs a callback upon failure, and finally runs in both scenarios. cancel is not among these standard Promise methods.

Let’s see how we might work go about breaking the Promise interface and cancel behavior. …


Image for post
Image for post
What mobile app testing feels like. Ow. (Pen and paper? Seriously? :) ) Photo by freestocks on Unsplash

It is tricky to set up automated testing of mobile apps. Maybe you’re on a small project and your Jest + Enzyme unit tests aren’t giving you the ROI you want. Maybe you want to test network error scenarios or time-sensitive logic, but don’t have the means to do so in your current app framework. Your friends in the web-development world tell you about Cypress, but they don’t have a React-Native mobile app to test.

There’s a way to bridge the gap that doesn’t require rearchitecting your app. In this article, I lay out how to apply the best of web app testing to your React-Native mobile app, with a few tips and tricks along the way. …


Use Expo Web to Deploy to GitHub.io with Continuous Delivery Scripts

Image for post
Image for post
Your phone, your code, and your localhost:19006 site — all that’s left is deployment! And coffee. That mug is totally empty. Photo by Christopher Gower on Unsplash

You have an Expo.io app, and you’re ready to deploy your web version. I’ve deployed on GitHub.io for free and hit a couple 100% avoidable issues — since then, it’s been smooth sailing with 1 command to deploy to production.

By the end of this article, you will know how to:

  • Deploy your website (for free) on github.io

Deploy

Deploying any GitHub pages static site on github.io is simple. First, Install gh-pages as a devDependency in your project. …

About

James Fulford

Harvard. Software Engineer. American. jamesfulford.com

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