walls.corpus

By Nathan L. Walls

  • Pollen/Raleigh
  • Busy Bee/Raleigh
  • Blossoms/Raleigh

Articles tagged: development

While debugging

The following are things I should generally keep in mind when I’m deep in code debugging. Inevitably, if I spend more than five minutes trying to track down a problem, it boils down to something like the following:

  • The documentation is lying
    • Well, more likely, I’ve misread the documentation and I’m not passing an argument correctly
  • The path to the binary being called isn’t correct
  • The wrong Gem, CPAN module or system library version is getting called
  • Something isn’t spelled right
  • I’m not connected to the right server or database
  • I’m on the wrong branch of code
  • I don’t have the right credentials
  • With RSpec tests failures might mean the database isn’t truncated after a previous test run failed
  • Something isn’t plugged in
  • The code being debugged was coded in an eval block and the debugger is going to lie about where it is
  • The bug could stand to be reduced … further
  • If hoping/expecting UTF-8 clean text, check for ISO-8859-1 or, God forbid, Windows-1252 characters

I’d do well to review this list when troubleshooting before spending some number of hours down the rabbit hole. I’ll also need to augment the list as I find other things

Winter break as retooling time

I’ve seen a few companies, both tech and manufacturing, use a winter shutdown to schedule plant maintenance. A forced break also acknowledges the reality that a significant subset of their employees are going to be out. Rather than wrestle with project schedules, everything is shutdown1.

The companies I’ve worked for typically haven’t followed that pattern. For instance, newspapers publish 365 days a year. But, if you have an extended chunk of time around Christmas and New Year’s Day, it’s a great time to step back from whatever you’re working on and see what you could be doing better.

This year, I’ve got the following on my docket:

  • Finishing a reread of Chad Fowler’s The Passionate Programmer
  • Finishing a three-quarter’s read copy of Release It
  • Working on a better understanding of RSpec custom matchers by reading David Chelimsky’s The RSpec Book

It is admittedly ambitious, and I’ll be satisfied simply to make significant progress on two of these goals.

Whether I’m in a headspace for software development, photography or something else, the key is taking time to step back from doing and really examine two things: How am I doing what I’m doing? How do I want to be doing what I’m doing better?

This winter break is about closing the distance between those two things.

  1. We’ll set aside the financial/managerial aspects of forcing everyone to burn time off whether they want it or not.

Lonely coding

Marco Arment created Instapaper, one of my absolute favorite ways to cache and read links I just don’t have time to read right now. He was very recently interviewed by Bridging the Nerd Gap, and was talking about his set-up, coffee, editors and other geek bits. There’s much to respect there.

Then, when asked his hardest to replace tool, he names PHP. I know good, valuable PHP can be written. Instapaper is written in PHP. Flickr is, too. I’m not so much interested in his choice of language, but his rationale at using it:

Most people judge PHP on bad tutorial code they saw ten years ago. But it’s a very capable, advanced language that supports many modern programming amenities

Very true, and I’ve been guilty.

But then, he outlines what he doesn’t like:

… Its method names, parameter orders, and general styles are inconsistent. Its core designers and Zend are all over the place and often make decisions that I strongly disagree with. It doesn’t have any practical support for parallelism. And nearly every third-party module or library I’ve ever used has been terrible.

Coding professionally in PHP is lonely. While I know this isn’t the case, it always feels like we’re the only ones using it at this scale, because we hit so many bugs in critical modules …

I feel a strong aversion to that lonely feeling as a developer. That’s one reason why I’ve grown more attached to Ruby and moved away from Perl as my preferred language in recent years. It isn’t the community around the language. I’m certain PHP has a sizable community. Instead, there’s something else – are the developers I want to learn from where I am? I know there are benefits to being a great teacher, so even being the smartest guy in the room doesn’t have to be all bad. But I don’t see any benefit in being a programming monk.

Further, I’d find it very frustrating as a developer if I felt the language maintainers and I were working at cross-purposes. And to not have great third-party libraries? I’ve run into my share of RubyGem and CPAN crap, but there’s always been a number of great things that provide much better solutions than I could make (or, given my interests, would care to make). This all sounds like this frustrates Arment as well, but for the life of me, I couldn’t see myself continuing to hold on to the tool if all this were true. I’m fascinated Arment can.

Rails 3 – Solving NoMethodError -- undefined method for Markdown

I just switched an app from Rails 3.0.0.beta4 to Rails 3.0.0 and while poking around the app, I started getting the following error:

FooController raised exception: NoMethodError -- undefined method `markdown' for …

It took a bit of hunting through the Rails project history, but I found the relevant commit. In short, text helpers for Textile and Markdown were removed from Rails 3.0.0.

What wasn’t so obvious from actionpack/CHANGELOG was why the change was made.

Thankfully, there is a gem to add the helper methods back in. Give Formatize a look. Adding it to your Gemfile should resolve any NoMethodError exceptions

A Virtual Staging Machine

This site and the others comprising our little company run on a Virtual Private Server. I’ve long thought about a staging or lab environment, but never acted on it. However, in the course of tracking down some performance issues earlier this month, it occurred to me that a VMWare image running Ubuntu would be perfect and easy to set-up. So, I’m giving it a shot.

Basically, I’ll have a much nicer way to experiment with adjustments to how I deploy Rails, have a place to learn Chef and be able to test system service configurations. I don’t know why I didn’t think of this sooner, but I’m by no means the first.

There’s more to come, but it’s easy set-up. I just needed to download VMWare Fusion, the Ubuntu server ISO and my production data to get rolling. The VM is configured to run as closely as I can to how my node is running, down to available memory and disk. I just need to set-up databases, then add the VM as a Capistrano target for a few Git repositories and I can get to experimentation.Â