Crit Russell

September 17, 2019

Game Workshop 2019

Follow the instructions here to get the base for the code: Repo. Open your browser and use the local webserver of choice from the Repo instructions to load the web page. Open up the developer console on your browser. We will be checking this console for errors while we develop the game. Your game in the browser should look similar to this (with the developer console open): Asset Manager Lets get an asset manager implemented real quick. ... Read more

September 16, 2019

Game Static Maps 2019

In the Game Workshop 2019 post I needed a way to handle making maps out of 32 by 32 assets provided by the file assets/sandwater.png in the Project Repository. After a ton of research I landed on the following solution. If I envision that sandwater.png has a 32 by 32 grid applied: The first region has an upper-left coordinate of {x: 0, y: 0} The next region to the right has an upper-left coordinate of {x: 32, y: 0} The region below the first region has an upper-left coordinate of {x: 0, y: 32} We could create a static map using values like the following: ... Read more

August 10, 2019

Building a Go Structured Logger

Why structured logging? Basically: to use your logs to get aggregate data. If you can consolidate them (for example, with a logging server/service), then you should be able to pull interesting information about the health of your systems and possibly even useful data for your business and/or product. Why another log package? It’s an example of what you can do with Go’s standard packages. I’ve used something similar in the past to help with combining libraries that have features I want in an easy-to-use internal API. ... Read more

August 5, 2019

How to Tame Your Pull Requests

These guidelines were used in a talk I presented at the Idaho Falls Programmers Group on July 17th, 2019. Context A Pull Request (PR) has at least two participants. An author A reviewer It makes the most sense in a team environment. As The Team We care. The rest of the business can be a burning dumpster-fire but we are the cool, professional core that delivers amazing features consistently and on time. ... Read more

February 26, 2018

Application Specific Error Handling

Go’s standard error is extremely simple to use which is a feature I like. It lets you add context by implementing its interface only when your application needs to. This can make cross boundary design simple and flexible. An API/RPC web service might be a good illustration. Some assumptions about this example are that your clients are mostly HTTP and care about the HTTP Status Code returned from the server. Also, that you are trying to separate your business logic from your web logic. ... Read more

January 20, 2018

Go and MySQL

I’ve been using Gorm for a while and wanted to see what it would look like to use the standard database/sql package instead. My main concern was development time since Gorm makes it simple to create the structures needed for simple queries. Basically a lot less typing. My exploration yielded a pattern that I’ve enjoyed so far. Also, my (not yet very thorough) benchmarks indicate that removing Gorm’s heavy reflection from the program yielded better application performance for large queries. ... Read more

January 19, 2018

Go Tests and Databases

I had a talk with a friend about unit and integration testing today. They were pointing out that their “tests basically generate 200mb of ‘helloworld’ bytes and write them to a temp file that gets cleaned up after the test.” That reminded me of a pattern that I’ve been using for my new startup to cleanup database rows after integration testing. It’s a really simple thing that is paying off in local (to my laptop) record management. ... Read more

© Crit Russell