1991-2016—25 years of Art & Logic

Mentoring Future Engineers

Mentoring Future Engineers

I am privileged to say that over the last four years, I mentored a group of high school students wanting to experience STEM in a hands on way. The mission: create a robot in six weeks. The challenge: complete on time, under budget, and with a team who may not know one another. Sound familiar? (more…)

There is a Bug on this Code

There is a Bug on this Code

Software is a serious business. Fatal bugs have been around since at least the 1980s, and a decade-old report estimated the annual cost of bugs at $60 billion. Tech companies spend millions on political lobbying. Opponents argue over labor shortages and H-1B visas.

So how about we take some time out to give three cheers for a little levity?

[“hip”,”hip”]
hip hip array!
(more…)

Level Up Your Coding Skills With exercism.io

Level Up Your Coding Skills With exercism.io
A few months ago I stumbled across across an interesting open source project created by Katrina Owen called exercism.io that provides a collection of programming practice problems in over 30 languages. On the surface, it’s a great resource for learning to code or learning a new language. I’ve found however that as you dig deeper it has much more to offer on a number of levels.
logo
To get started you simply install the exercism command line client, login with GitHub, pick a language to work in, and fetch your first problem. The first problem in many languages is often just a simple “hello world” exercise just to get you started. When you fetch a problem you get a ReadMe file with a description of the challenge and a suite of unit tests. In TDD style you write code until the tests are passing and you’ve solved the problem. Afterwards, you submit your solution and other exercism users are able to review and comment on your code. You can carry on the conversation and submit additional revisions of your code as part of this informal peer code review.

(more…)

Configuring Backbone.Model Properties With Less Code

Configuring Backbone.Model Properties With Less Code

My previous post demonstrated the use of Object.defineProperty to programmatically add a list of properties to an ES6 class, such as a Backbone.Model subclass, reducing the amount of boilerplate code necessary. The example in that post added simple getters and setters, but it’s possible to go further for Backbone.Model properties, also configuring in a single data structure functionality like:

  • Options for properties, such as disabled setters
  • Default values for properties
  • Mappings for parsing date strings and model relationships

This technique uses a common base class from which all other model classes descend. The model subclasses (e.g. a user model) provide a list of property definitions, which centralize various aspects of those properties. The base class has configuration methods which iterate over the property definition objects.

In the particular examples below, the base configuration methods handle attribute to property name mapping, default values, and server data parsing, but this technique can be applied to other configurable property-related tasks, such as marking some properties blacklisted or viewable only by admins.
(more…)