JavaScript, Node.js, and the Flying Wedge Anti-Pattern
The "Flying Wedge" is the name of a military formation in which troops would march into battle in a V-shaped formation. That same V-shaped "formation" unfortunately has a tendency to show itself in JavaScript and CoffeScript. And in the vast majority of cases, it is bad practice.
Code that's easy...
Node.js Debugging with the Built-in Debugger
console.log()
approach wasn't cutting it, either. I need to fire up Node...
Node.js: Five Things Every PHP Developer Should Know
I recently started working on a few Node.js applications. Coming most recently from PHP (and Drupal in particular), I found the transition to Node.js to be surprisingly easy. Pleasurable, in fact. But I had to learn to think differently about a few things.
Below I list the five things I think every...
Five Reasons for Doing Drupal Development on a VM
In years past, I used to do my development on a local machine, and then push my work to a remote server for testing. About two years ago, though, I switched my environment. I began using virtual machines instead of physical servers. Configuring them for Drupal, I could do my Drupal development locally...
Node.js: Connection Pools and MongoDB
Node.js can interact well with MongoDB using the MongoDB native driver. The driver comes with plenty of documentation. However, one feature that isn't explained clearly is the pooling system.
The MongoDB Node library can create a pool of connections to the database that can then be shared throughout...
Node.js Automated Testing: A Quick Intro to Writing and Running Tests
In-depth resource on how browsers work
How Browsers Work is an in-depth resource -- about 50 printed pages long -- explaining how a browser begins with HTML, CSS, and JavaScript files, and ends up with a display.
The clear explanation, based on FireFox and Chrome/webkit, explains many of the nuances that frequently cause edge-case bugs...
Good Code: A Useful Definition
What is "good" code? We toss around all kinds of high-level definitions, but these are usually either hopelessly vague or hopelessly complex. This month's Pragmatic Programmer magazine offers a fantastic definition, summarized on this card:
(Apparently originally from Agile in a Flash)Tim Ottinger...
Microbenchmarking PHP: Switch Statements are Slow
There are very good uses for Switch statements. They can be great for nesting logic. But sometimes they are used as a way to (essentially) map a name to a value. In such a scenario, the body of the case
is just a simple assignment.
After noticing this pattern a lot recently, I thought I'd benchmark...
Your Code is Not Your Baby
In the introduction to The Gay Science, Friedrich Nietzsche famously compared writing to giving birth:
"[W]e have to give birth to our thoughts out of our pain and, like mothers, endow them with all we have of blood, heart, fire, pleasure, passion, agony, conscience, fate, and catastrophe."
Ever...