Unit Testing Frontend Network Requests

Unit testing is a great way to help ensure the continuous delivery of working code over a product’s lifecycle. In client-side applications, unit testing data retrieval is especially important since using data from these asynchronous calls is at the core of what most of these apps do.

Unfortunately, asynchronous calls aren’t easy to test. Read more on Unit Testing Frontend Network Requests…

A Feature-Oriented Directory Structure For C# Projects

After working on .NET applications for the past six years, I recently spent a few months using Ember.js and AngularJS. Both originally supported organizing files in a project by type: separate top-level directories for models, controllers, views, etc. But this has changed over the past few years to prefer organizing by feature area—Ember with pods Angular with modules.

It’s worked well for Javascript apps, so I recently experimented by converting one of my C# apps to follow the same principles. Read more on A Feature-Oriented Directory Structure For C# Projects…

Developing on OS X Inside Vagrant

I maintain an OS X tool for sandboxing the popular Homebrew package manager called brewdo. Because I need my MacBook to keep working day-to-day, I need a way to develop features and fixes in brewdo without risking my system’s integrity.

If brewdo targeted Linux, I could very easily use Vagrant to spin up a Linux system and develop it there. brewdo targets OS X, though. And although Apple gives permission to virtualize it, they don’t give permission to share copies of it.

But all is not lost. OS X on Vagrant is achievable, and without skirting Apple’s copyright. Read more on Developing on OS X Inside Vagrant…

Why I Choose ClojureScript

I’ve always enjoyed learning different programming languages. I’ve had colleagues who wished one language would emerge obviate all the others, but not me.

For me, programming languages are like food: it’s the variety that makes it fun. Every language makes different tradeoffs, they elevate different ideas, express them in different ways. Each is a unique tool in my toolbox. Read more on Why I Choose ClojureScript…

Read more on Why I Choose ClojureScript…

Safely Binding Unescaped Content in Web Applications

“Snakecharmers,” a chromolithograph by Alfred Brehm, c.1883

Binding unescaped HTML or CSS content on a web page is a scary proposition for most web developers. The idea conjures up black-hat hackers attacking your company’s infrastructure and high-visibility hacks. In fact, cross-site scripting vulnerabilities may exist on as many as 70% of all web sites.

In this post, I’ll explain what cross-site scripting vulnerability is, when it’s OK to silence warnings, and how to do so in two popular JavaScript frameworks: Angular and Ember.js. Read more on Safely Binding Unescaped Content in Web Applications…

Assembling Your Computer’s Brain, Byte by Byte

Computers are amazing machines. They can perform massive amounts of stuff every second, and they’re being put into everything around us to make the things we interact with on a day-to-day basis smarter and better.

This is made all the more remarkable by the fact that computers are astonishingly dumb. My favorite explanation of just how dumb computers are can be found in one of my favorite recorded talks, Richard Feynman’s lecture about computer heuristics. (Start around the 10-minute mark for the particularly relevant bit.)

One of the secrets to making these dumb machines do smart things is the way applications get loaded and executed within your OS. But have you ever thought about who loads the code that loads your code?
Read more on Assembling Your Computer’s Brain, Byte by Byte…

Simplifying Objective-C Value Objects with Mantle and the Builder Pattern

I’ve come to the conclusion that regardless of how “functional” a programming language is, the best way to handle state is with immutable value objects.

Wikipedia defines a value object as follows:

“In computer science, a value object is a small object that represents a simple entity whose equality is not based on identity: i.e. two value objects are equal when they have the same value, not necessarily being the same object.

Value objects should be immutable: this is required for the implicit contract that two value objects created equal, should remain equal. It is also useful for value objects to be immutable, as client code cannot put the value object in an invalid state or introduce buggy behaviour after instantiation.”

I’ve found that immutable value objects are particularly well suited for passing data around when using one of the Reactive Extensions libraries. While not a direct port, I lump ReactiveCocoa into the same category, and it benefits just as much by sending Objective-C value objects on its signals/streams.
Read more on Simplifying Objective-C Value Objects with Mantle and the Builder Pattern…

Transitioning to ReactiveCocoa 4

If you’ve been reading our blog for any period of time, you’ve probably noticed several posts on the topic of Function Reactive Programming and the ReactiveCocoa library. Up until now, all of these posts have been about ReactiveCocoa 2, which was written in and for Objective-C. Now that Swift is gaining in popularity, the ReactiveCocoa developers are working hard on a new version that is written in Swift and leverages some of the functional features that are fundamental to the language. Read more on Transitioning to ReactiveCocoa 4…

Linux Utilities for Diagnostics

I spend a fair amount of time troubleshooting issues on Linux and other Unix and Unix-like systems. While there are dozens of utilities I use for diagnosing and resolving issues, I consistently employ a small set of tools to do quick, high-level checks of system health. These checks are in the categories of disk utilization, memory and CPU utilization, and networking and connectivity. Triaging the health of the system in each of these categories allows me to quickly hone in on where a problem may exist.
Read more on Linux Utilities for Diagnostics…

Using a Design-Time ViewModelLocator With Caliburn.Micro

I was introduced to Caliburn.Micro less than a year ago, and it has since become my preferred MVVM framework for XAML development. It supports several conventions that reduce boilerplate code. It’s an opinionated framework that encourages a ViewModel-First approach during development.

Unfortunately, design-time support out of the box is limited to ViewModels with a public parameterless constructor1. This works for a while, but it becomes tedious to duplicate and maintain code that only exists for design-time support. I now use a DesignTimeViewModelLocator class for binding sample data in the designer.
Read more on Using a Design-Time ViewModelLocator With Caliburn.Micro…