I wrote an article discussing some techniques from statically typed languages. Head over to SitePoint to check it out! Here’s what you can expect: JavaScript type system, and how it tries to bite you Expanding more about the rule of consistent types with more details on using it to reduce bugs Dealing with type-checking and type-conversion in a way that …
In order to become a better developer, you must first become a teacher
The headline might sound pretentious, but what is the most important skill for a developer besides actually writing code? Communication. What do you typically do when you communicate as a developer with someone else? You explain problems, you describe solutions, you talk to non-programmers about what you’re doing. You could also say that you’re teaching others about what you’re doing. …
How to reduce bugs in JavaScript code by following the rule of consistent types
One of the most annoying type of bug in JavaScript code is when the code doesn’t have logical types. Oh hey, I’ll just sum these two numbers… NOPE! They’re actually strings! That just makes me so angry. To make matters worse, this is something I’ve had to deal with a lot with a codebase I’ve been working with recently. JavaScript …
Hello World Open 2014 thoughts
I participated in the coding world championships, or Hello World Open, 2014. The challenge was to write an artificial intelligence for a slot-car racing game. I wrote my bot in Haskell, and managed to rank 11 out of 856 competitors in the first qualification round, and 78 out of 203 in the second qualification round. Read on for some general …
Book review: Dependency Injection with AngularJS
Are you in the market for a book on AngularJS? Here’s my review of the book Dependency Injection with AngularJS, written by Alex Knol and published by Packt Publishing. Disclaimer: I was sent a free copy of the book for review purposes.
AngularJS best practices: Refactoring existing code to Angular
I’ve been involved in several projects where I worked on moving an existing codebase into using AngularJS. Some involved refactoring a small codebase, which is relatively straightforward in most cases, but I’ve also refactored much larger projects where moving everything at once is not an option. Here’s some best practice type stuff that I’ve learned along the way.
Library author: Don’t provide an exploitable interface
SQL injection is a pretty big deal. Its cousin shell injection is also a common issue, demonstrated quite well by a recent post to the PHP reddit. Although some suspect it was a troll, I heard echos from a variety of people who had seen pretty much exactly the same vulnerability in production. This got me thinking: People writing libraries …
Why use user story based testing tools like Cucumber instead of other TDD/BDD tools?
When you think of writing tests, usually you would write them using a tool from the xUnit family, PHPUnit, JUnit, etc., or if you like a more BDD-style approach, perhaps you would use RSpec, Jasmine, or some other tool like that. Then there’s Cucumber. Instead of writing your tests purely in code, with Cucumber you start by writing a human-readable …
Headless Chrome/Firefox testing in NodeJS with Selenium and Xvfb
The other day I wanted to run a bunch of tests with a browser in a NodeJS environment. Having been spoiled by how easy it was to do in a Rails setup using Capybara, I thought it would be easy considering how everything cool is easy to do with Node! Well, I thought wrong. It’s easy once you have everything …
3 ways to get backend data to AngularJS
It seems this is a rather common conundrum with Angular code: You have some backend data, say in PHP or Rails, and you want to output it when rendering the page so that Angular can display it. Since Angular is designed to work more as a single-page app framework, it isn’t immediately obvious how to do this without Ajax, so …