Archive for the 'Coding' Category

Dec 16 2011

In Which Eric Survives A Horrible Week

Published by under Coding,Doing

I certainly didn’t see that coming.

Last Friday morning, it all went to crap. Our site – the big, ticket selling one and not the new, not ticket selling one – started having problems. Bad problems. Can’t sell ticket problems. For a ticket selling website, you might call that kind of thing a critical problem. We were up and down for most of the day, and couldn’t figure out why we were suddenly having problems when things had been going well for so long. It quieted down over the weekend, but Monday, the problems came back with a vengeance.

Monday night found me angry, depressed and feeling hopeless. I might have had a bit of a breakdown on the couch that night before going to bed. Might have. Not saying I did. Tuesday was slightly better, if only because I’d gone slightly numb to the stress and was starting to get a handle on what was going wrong. It still didn’t stop me from maybe, possibly, emotionally shutting down for a bit on Tuesday night at the hockey game and freaking Erin out. Perhaps. Maybe. Not saying that happened.

Wednesday I came in, soundtrack to Tron: Legacy pouring into my brain through earbuds, with a plan. I think the plan might have worked.

Things have been better since Wednesday morning. I’m still not convinced everything is solved, but I certainly have a handle on the main problem and my fixes got us through a really busy day of sales. So, maybe, possibly, crisis averted.

The awesome thing about a week of unmanageable stress is the time immediately following, when you aren’t actually stressed anymore but don’t remember a thing about what your life was like before you were going out of your mind. What was I doing? Was I working on something? Was that day I was sitting on the couch losing my mind really only four days ago? It hasn’t been an entire month of me freaking out?

Considering this all came on the heels of my little writer-crisis, I think this adds up to about a week and a half of me feeling like a bloody lunatic.

So here’s what I’m asking. To the universe.

Can I take the weekend off? Just the weekend. I’d really appreciate it.

Thanks. You’re the best. I especially dig what you’re doing with supernovae. Those things are sick.

XOXO, Eric.

4 responses so far

Nov 30 2011

ABC

Published by under Coding,Creating

Here’s all I know about working in sales: Always Be Closing. That might just be something from a movie, come to think of it. Do actual salesmen say that?  It’s good advice, though. Maybe not to salesmen. My advice to salesmen is to Always Be Finding Another Job (For Your Sanity). But for everyone else?

I have a lot of friends who want to get into programming, or write their first novel, or shoot a short film. They’ve come up with an idea and want to know what I think of it. Don’t ask me why people want to know what I think about things. I talk enough without the encouragement. But they ask, and I inevitably say one thing. Well, maybe two, if I think the idea is really cool. Which it is, actually, a lot of the time.  If it’s cool, I tell them so. That’s the first thing. Then I say something else.

Go and finish it.

We all have piles of unfinished projects. Half written stories and chunks of code that don’t run and basements full of boxes we never unpacked in the five years since moving. I don’t know about you, but I know exactly what I’ve learned from all of those incomplete things: absolutely nothing.

No, that’s not true. I did learn something from them. I learned to think less of myself.

The problem with good ideas is that you convince yourself this might be the best one you’ll have for a very long time, so you’d better not screw it up. That kind of thinking is poison, and apart from laziness (another problem in which I am well versed) it’s the single most prolific murderer of projects.  Without a doubt, your idea is going to get away from you. Maybe early on, more likely in the middle, that solid block of gold will turn to sand and slip through your fingers. It’s a given. It’ll happen. If the goal in your head is don’t screw this up and not get this sucker finished, you’ll decide you already failed and give in.

Enough of those and you start to think that you’re the problem.  Your ideas are great, sure, but you can’t make them work. When the next idea comes, you remember the last four unfinished novels, films or websites gathering electrons on a hard drive somewhere and decide there’s no reason even to try.

I’ve never learned much of anything from half finished works of genius (which is what they somehow remain, no matter that you fled when they slipped the leash), but I’ve learned buckets from completed pieces of crap. And, oh boy, have I got them. Some of them are websites still live and in production or scripts floating out in the wired. Some sit here, on my computer, never to be read again. I’ve learned invaluable things from all of them, but none so important as realizing I could make it across the finish line.  That lesson lets me set something aside when I need to and know I can come back and make it work with a clear head. That lesson gets me over mountains and under barbed wire fences. It’s what keeps me strong when I’m lost and spinning out nothing but garbage.

There are other big, important things to learn, but you won’t learn a single one of them from the unfinished or incomplete. Live with a mess of a codebase for a while and you’ll start figuring out how to do the next one better.  Reread that novel you wrote and you’ll see where things got away from you, and maybe you’ll recognize it when it happens again.  Finishing things won’t make you a good programmer or writer on its own, but you won’t get close until you learn how to close.

2 responses so far

Nov 18 2011

Let There Be Website

Published by under Coding

The apocalyptic month of October, which stretched its Cthuluian tentacles far into November, is finally over. That’s right, friends. The Cultural Trust’s new website is live!

Seriously, check it out!

One thing that’s no fun about being a programmer is that the majority of what you do is meaningless to friends and family.  I’ve built a few really cool things in my career, but you can’t go home and say, “Mom! Look what your son did today! He built an entirely functional model to handle dynamic pricing for flex packages!” Not unless you like that glazed over look people get when you describe technology to them.

Today, though? Today is awesome. Today I can point with a jittery, anxious hand to a brand new website and say that it’s mine. My website. The one I built with my hands. Use it, and you’re using stuff I built. The thing near killed me a few weeks ago. There were a few days of catastrophic stress levels in there. By the end, the stress of it had crept into every other aspect of my life. Erin could almost certainly count the number of days I didn’t come home ranting desperately on one hand.  This has been, hands down, the most stressful month of my life in memory. But look! There be website here!

So what didn’t I do for the site? Well, I don’t do graphics, so anything pretty was the work of graphic designers. While I can execute a layout, I can’t design them, so the look of the site was drawn, so to speak, by someone else, but implemented and coded by me. While programming is a lot like writing, it is nothing like visual design, so I suck at it as badly as I have my entire life. I know just enough about visual art to be seethingly jealous of those good at it. Also there are a few bits of functionality – that spinning carousel thing on the home page – that are free, downloaded website plugins that I then customized. Writing code means knowing when to steal code. I know when to steal code.

The rest is all me. There are a lot of cool things about it that you can’t see, but the neatest is this: If you troll around, you’ll see a lot of event information. When things are coming up, links to buy tickets, and all of that. That information? It all pulls from our ticketing site, culturaldistrict.org (which I co-developed, and which is now all mine for the foreseeable future) with the power of hot, sticky, Ruby API magic. No one has to enter events a second time into the new site. It just slurps them in and shows them. Considering our old site was The Stinky Pit Of Duplicate Effort, this is a big deal. And I built it. Give me a moment to high five myself.

This means that I can spend the weekend recovering.  Since I have no idea how I come off to people (not kidding. at all.), I’m not sure how much of a basket case I’ve seemed for the past month and a half. If it’s been excruciating, it’s hopefully coming to an end.  If not, cool. No idea how I pretended to keep it together.

Now let’s go down to the pub and grab some drinks, yeah?

2 responses so far

Nov 01 2011

Vanity URLs in Radiant CMS

Published by under Coding

We use Radiant CMS as the framework for the Cultural District website, so it made sense to use the same framework when the time came to rebuild the Trust’s. One requirement we have for the Trust’s site that we did not for the District was the use of Vanity URLs: you know, how if you want to make it easy for someone to get to some really long url, you can make up a nice short url with a memorable word that directs people on to the right place. saalonmuyo.com/awesome redirects to, say…well, let’s face it. Anywhere that goes is rickrolling someone. You get the point.

So, how did we do it?

Basically, whenever you go to a URL in Radiant, it falls through a few steps.  First, it checks if there are any defined routes you’ve set up in your *_app_extension.rb file.  Failing that, it falls into Radiant’s SiteController, which searches every single Page to see if the path the user entered matches any of the Pages’ slugs. If it finds something there, it processes and loads that page. If it fails, Page’s find_by_path method returns the FileNotFoundPage you have defined. (This is assuming you have a FileNotFoundPage defined, which you should. Here’s how.) The SiteController then processes the FileNotFound page and displays that.

In order to define a Vanity URL, we needed to get in the middle of that process.  We created a VanityUrlPage class – Radiant allows you to create custom page types – with two custom fields: Vanity URL and Target URL.  Then, we overrode Page’s find_by_path method so that, if it failed to find anything, before we returned that FileNotFoundPage, we tried to see if a VanityUrlPage existed that matched. Then, we interrupted the SiteController so that, before it processed the page, it checked to see if it had found a VanityUrlPage and, if it did, redirected the user appropriately. So, how about some code?

This is all assuming you have a Radiant extension you’re developing.  If not, you could create an extension just to do this. But let’s assume you already have an extension created.  Within vendor/extensions/<your_extension>/ directory is a lib directory. Within that, I created an extensions directory, and within that, I created two files: page_extension.rb and site_controller_extensions.rb.

Within page_extensions.rb, we needed to override find_by_path. (Note that my module is called SatelliteAppExtensions. Yours will be called, YourNameExtensions instead.)

module SatelliteAppExtensions
    module PageExtensions

    def self.included(base)
      base.class_eval do
        alias_method_chain :find_by_path, :vanity_urls
      end
    end
    def find_by_path_with_vanity_urls(path, live = true)
      raise MissingRootPageError unless root
      page = root.find_by_path_without_vanity_urls(path, live)
      if page.is_a?(FileNotFoundPage)
        vanity_url = VanityUrlPage.find_vanity_url_by_path(path, live)
      end
      vanity_url ? vanity_url : page
    end
 end
end

So, what’s that doing? Well, alias_method_chain is  - as Brennen would call it – some hot sticky ruby magic that lets you say that when someone calls find_by_page, they actually call find_by_page_with_vanity_url. From now on, the only way to get directly to find_by_page is to call find_by_page_without_vanity_url.  We use this so that we can implement some of our own logic around the find_by_page call.  Essentially, we immediately call find_by_page_without_vanity_url, and if we get that FileNotFoundPage back, we run a query on the VanityUrlPages to see if we get a match. That’s the find_vanity_url_by_path call. Let’s look at that.

VanityPage

class VanityUrlPage < Page

  def clean_target_url
    self.target_url.match('http://') ? self.target_url :
                       VanityUrlPage.clean_path(self.target_url)
  end

  class << self

    def find_vanity_url_by_path(path, live = true)
      vanity_pages = VanityUrlPage.find(:all, 
                  :conditions => "vanity_url like '%#{path}%'")
      vanity_pages.each do |vanity_page|
        return vanity_page if clean_path(path) == 
               clean_path(vanity_page.vanity_url)
      end
      nil
    end

    def clean_path(path)
      "/#{ path.to_s.strip }/".gsub(%r{//+}, '/')
    end

  end

end

In here, we do a search against all VanityUrlPages’ vanity_url field. If we get a match. Since we’re doing a SQL like query here, we might get a few false positives, so we then iterate through the results and see if any match exactly. The worry being that you have a /broadway Vanity URL and a /broadway/plays one and might get both back. If we get nothing back, we return nil. Oh, and clean_url just lets us whack any preceding or trailing slashes off the urls so they’re formatted the same.

Now, we’ve done what we need to find the Vanity URL page. But Radiant’s just going to assume it’s a normal page and render it, which we don’t want. We need it to redirect. Thus enters our site_controller_extensions.rb file.

module SatelliteAppExtensions
    module SiteControllerExtensions

    def self.included(base)
      base.class_eval do
        alias_method_chain :process_page, :vanity_page

      end
    end

    def process_page_with_vanity_page(page)
      if page.is_a?(VanityUrlPage)
        redirect_to page.clean_target_url
      else
        process_page_without_vanity_page(page)
      end

    end
 end
end

When Radiant finds a page, the SiteController runs it through a process_page call that essentially renders the thing for the user.  We need to not do that for a VanityUrlPage. So, if the returned page is a VanityUrlPage, we redirect_to the target_url for that page. (And, actually, we redirect to a clean_target_url, the method for which is found above, that normalizes what /’s are there for relative URLs).  If not, we pass the page along to the SiteController’s normal process_page method for normal handling.

Finally, we need to make sure Radiant knows to load your extensions to its core functionality.  There is a file named <your_extension>_extension.rb in your extension’s root directory.  For instance, for mine, it’s satellite_app_extension.rb.  Open that up, and you’ll see a method named “activate”.  Within that, you can define all kinds of things. In this case, we’re defining three things.  Two we’ve talked about (requiring those extension files), and one we haven’t (adding custom VanityURL Fields on the administration side). Give me a minute and we’ll get to the other thing. For now, just do something like this:

require 'lib/extensions/page_extensions'
require 'lib/extensions/site_controller_extensions'

admin.page.edit.add(:form, "vanity_url_fields",
    			:after => 'edit_page_parts')

SiteController.send :include,
    		SatelliteAppExtensions::SiteControllerExtensions
Page.send :include, SatelliteAppExtensions::PageExtensions

What’s going on here? First, we’re requiring the code files for our extensions. Second, we’re telling the SiteController and Page to include the modification we’ve made to them.

Now, about that vanity url stuff in the middle. One thing I’m not going over in detail is creating the Vanity URL page itself. The tutorial I linked is pretty comprehensive and I don’t want to rewrite a bunch of information that might go out of date anyway. But what you need to do to make this work comes in two parts.  You need to create the custom page fields for vanity_url and target_url,  and you need to make those fields available on the VanityUrl administration page. I’m going to copy you my migration file to add the fields and the partial code needed to show those fields. Use those in the appropriate steps in that tutorial. And ask if you have any questions.

Migration:

class CreateVanityUrlPages < ActiveRecord::Migration
  def self.up
    add_column :pages, :vanity_url, :string
    add_column :pages, :target_url, :string
  end

  def self.down
    remove_column :pages, :vanity_url
    remove_column :pages, :target_url
  end
end

Partial (_vanity_url_fields.html.haml):

- if @page.is_a?(VanityUrlPage)
  %br
  %hr
  .vanity_url
    = label :page, :vanity_url, "Vanity URL"
    = text_field :page, :vanity_url, :size => 100
  %br
  .target_url
    = label :page, :target_url, "Target URL"
    = text_field :page, :target_url, :size => 100
  %br
  %br

And that’s it. Have fun with your redirections! If you have any questions, comments or think this approach is bunk, let me know in the comments.

No responses yet

Oct 13 2011

Lady Tech

Published by under Coding

Here’s a question I wish we could all stop asking: Where are all the lady techies? I’m going to be hiring soon, and I have this sick feeling that I’m to get a couple dozen resumes and every one of them will have a Y chromosome lurking behind them.  It’s no secret or surprise that there’s a disturbing dearth of female developers. A lot of smarter and more tuned in people have spent time trying to understand why.  Societal problems, sure. Rampant, ingrained sexism in the industry, absolutely. Extra special denigration regarding a woman’s ability to do the job, without a doubt.

I shouldn’t be happy when I find a female developer on twitter who’s rocking an awesome position, or serving on an important standards committee.  It should be the norm. It’s not that there aren’t lady techs, and it’s definitely not that they’re inferior at the job.  I’ve worked with two female developers – at the same place, actually, which made the gender ratio only slightly nauseating – and I want to make something very clear.

The best developer I have ever worked with, hands down, was a woman. She wasn’t just the best developer I worked with. She was the very, very best.  I’ve worked with lead developers at huge consulting companies that couldn’t keep up with her on their best day. She’s not an aberration, or an exception to the rule.  She was just a person who put the time, effort and insanity of a double major in computer science and mathematics into her work.  I shouldn’t have to point out it was a woman from whom I learned the most, or for whom I have the most undying respect. I should just be able to talk about her as a great developer and be done with it. I can’t, though, because when the number of female applicants to the CS program at Harvard doubled, it brought the percentage to 25%. That’s an improvement!

The trend might be reversing. It can’t reverse fast enough.  What concerns me is that there are a lot of developers who have literally never worked with a female programmer and don’t think it’s a problem.  Those new computer science majors are walking into a gauntlet of quiet derision and casual disregard that no one should have to face. They’re going to slam into an industry that’s gotten used to thinking of women as peripherals to the development process. Quality Assurance or Project Management, maybe, but not coders.

I hope someone prepares them for it, too, because the last thing I want to see is disillusionment and frustration bleed most of them off. There are smart people who could make this field better, and we’re losing them because a lot of nerds cope with the humiliation of high school by using the field as a bulwark against the entire gender. Beyond the standard and terrible patriarchal notion that women and sciences don’t mix, is an uglier core of woman-fear.  One of the ways you insulate yourself from the bad days of school is deciding that you’re superior to the people picking on you.  For nerds who’ve entered a field where they deal with women only peripherally, that superiority complex festers and grows.

That’s what waits for that new surge of lady techs. That’s the wall they’ve got to bust through, Kool-Aid Man style, no matter what looks the anti-social geeks give as they pass by their cubicles. Bring your hammers, ladies. And send me your resumes.

3 responses so far

Oct 12 2011

Collaborators

Published by under Coding,Creating

I came into the Cultural Trust just as they were heading straight into a full rewrite of the Cultural District website. They’d hired a consulting company to handle development, and I’d be doing co-development with them for the duration of the project.  When the engagement ended, the website would be mine and the consultants would ride off into the sunset (so that you’d be blinded if you tried to follow them and blame them for all the bugs, of course).

There are a hundred reasons doing co-development with a consulting company can be a headache, but the one we’d chosen came bundled with Agile – a software development methodology that encourages speedy development by wiping away all the stupid manager-driven bureaucracy and replacing it with an insane process-driven bureaucracy.  Like so many Agile enthusiasts, they didn’t trust me to get into the game on my own without a little hand holding.  They sent out a developer to babysit me for a few weeks (actually a very nice and extremely talented developer) and teach me the ropes.

The ropes, in this case, being something called Pair Programming.  Here’s how it works: You find a desk. Stick one (1) computer on the desk, along with one (1) keyboard and one (1) mouse.  Find two (2) chairs, place them in front of the computer and sit the developers in them.  Demand that the developers work together, trading the keyboard and/or mouse between them.  While one is working, the other sits over his or her shoulder and, if the “driving” developer should pause or stop to think, they are encouraged to chirp ideas into their ear unbidden.  If this is insufficient, they may take the keyboard and/or mouse and interrupt their partner completely.  Continue forever.

I hated Pair Programming. It’s on a very short list of development practices that are cause to immediately reject a job, regardless of the bigger picture.  It’s not that sitting with another developer to work through a problem is bad.  It’s not. In the days before I was Solo Señor Web Developer, I regularly pulled people into a problem, or was pulled into a problem by another.  But in those days, I could always send them away when it was time again to start working. Pair Programming forces you to deal not only with the problem at hand, but with the impatient, fidgety reactions of someone wondering if you’ve gone quiet because you’re stumped or because you’re thinking.

It’s easy, after a few bad collaboration experiences like that, to get gun shy about collaborating with people at all.  Luckily, outside of the noxious environment of enforced Pair Programming, collaboration with other developers tends to be a fairly healthy process.  I’d kill for a few more developers in the room, just so long as they don’t try sitting at my desk and taking the keyboard when I’m in the middle of something.

My experiences co-writing have been more mixed.  This is, I’m sure, partly because co-writing is a far more finicky business than co-development.  In development, there are empirically verifiable outcomes.  You needed a button to open a window with these three fields, and the button does that.  There are plenty of religious wars to be had about programming, but by and large, most problems you have to solve can be stuck in front of someone, and that someone can say, “Yep, that’s what I wanted.”

Not so much with fiction. While certain types of bad are hard to argue – I can send you some objectively horrible stuff of mine if you need proof – it gets more subjective at the ‘good’ end of the scale.  That’s why every professional screenwriter has a litany of horror stories about the notes they get from executives and show runners.  Even the sane notes can pull a story towards a very different notion of good than what the writer had in mind.  Collaboration on anything artistic brings out the worst in a lot of people, as they try to get a story to not just be good, but as close to the platonic ideal that they had in mind when they came up with it.  Don’t believe me? Ask some people about the end of Battlestar Galactica.  And, since none of them actually wrote the thing, multiply their flame war by the heat of the sun. Most collaboration doesn’t get that bad, but falling out over how a story or play or movie should turn out has ended many friendships and professional relationships.

Having your work ripped apart by people can be rough.  It sucks. In development, there are things called code reviews that no one does like they should (though it would be in their best interest). One or more people pull down what you did over the last week and tell you all of the ways it should be better.  The outcomes of development are pretty empirical, but the methodology of how you got there can be just as subjective and religious as writing fiction.  But, like writing a collaborative project where you each get your own territory – an anthology, or being in a writer’s room on a show – you can take the beating from a position of safety.  You have a finished thing. You spent some time working out all the awful you could find before you gave it to them.  You have confidence in what they’re about to shred. That matters.  That really, really matters.

But like pair programming, co-writing something is having someone criticize you about things you don’t feel great about, either.  It’s someone watching you work and seeing all of the really crap ideas that would never see the light of day if there wasn’t someone at your desk with you, pointing out your indiscretions on the monitor.  That’s why collaboration can get so damned ugly. Your lack of confidence makes you turn nasty at criticism, even when it’s in the story’s best interest.  Someone telling you that sentence or block of code is trash stings.  You snap about how you know it’s bad, that you’re just trying to see how it looks before you keep going, how you just want them to shut up before you smash their stupid face into the keyboard to see if that makes the sentence better.  A story, an idea, a plan; they’re fragile at first, and even when criticism might be helpful, if it hits at the wrong angle it can shatter the confidence you need to be clear-eyed about how to make it work.

Co-writing – and, I suppose, pair programming – doesn’t just require the right amount of respect for each other. It demands the right kind of respect.  You have to trust that the person you’re about to hit with the ruler is smart enough to have chosen to do things a particular way for a reason.  You have to trust that the person criticizing you knows you’re not a screwup, that when they say that something kind of stinks that they’re seeing something you might have missed.  It’s not just that you respect their talent.  To let someone into the process that early, you have to trust that their judgment is sound. That they aren’t just seeing a good version of the story, but something close to your good version of it.

Otherwise, how do you let that person sit over your shoulder while you type some of the worse garbage you’ve ever put into pixels without feeling self conscious?  You don’t.  That’s why pair programming is so nasty a standard practice.  The number of people I would be able to collaborate with that closely is way smaller than the number of people with whom I’ll work in my life.  To make co-writing the norm – to make sitting at a desk with another human being while I expose myself to ridicule normal, to make that the standard – is lunacy.

Yet, I can understand the appeal.  When it works, when you do have someone you can respect that way, things fall together in fast andunexpected ways.  It’s lovely to have someone with whom that can work.  Earlier this year, I reconnected with my friend Rachel.  She’s the only person I was ever able to work with at that proximity, and a story I cowrote with her is one of the first really good things I helped produce. It would probably make me cringe to read it now (we wrote it years and years ago, when we were young and stupid), but it was an important piece of writing for me to finish.  Working with her again has brought that all back to me.  A really good co-writing partnership is magic.

Magic, though, isn’t reproducible.  It’s not predictable and it does not play by your rules.  I can’t say that, because the best early thing I wrote was the product of a collaboration, I will forever co-write everything, regardless of who my partner will be.  That’s insanity, just as saying that because the right programming pair can work faster than any two programmers alone, the same benefit will apply to any programming pair.  There are development houses where programmers have to rotate partners every few weeks.  Thinking about working that way makes me sick.  I’d lose my mind.

You aren’t going to produce most things alone. Your code will be tested and used by others. Your stories will be hacked at by publishers and executives.  Fellow developers and other writers will shred what you’ve done for your own good, and they’ll push you to make something far better than what was there to start.  You will collaborate.  But collaboration does not all happen at the same distance, and finding the right distance for you and your co-workers and co-writers will keep you from sharpening the knives when backs are turned.

One response so far

Sep 22 2011

On Troubleshooting

Published by under Coding,Doing

Imagine a line. At one end – say, far off to your right – the line starts to blur and fade.  Out there is where all the awesome, elite programmers live.  Now take a good, long sprint back down the line, past the midpoint and off to your left.  Not all the way, just a bit. If I’m being honest with myself, I’m at my desk near that point on the line.  Away from the elite and the great and the specialized, near most of the rest of the people who are hacking out a living in this field.  What I’m saying is I’m not a great programmer.  I’m good, but I’m not great.

Except in one area: I’m as good a troubleshooter as anyone I know.  Oh, yeah, ok, there are ones better than me out there.  Lots, probably.  But when it comes to narrowing in on a problem, finding a hidden glitch, I’m pretty great when I put my mind to it. Before the rancid smell of ego overwhelms you, though, let me say one more thing: it’s not because I’m anything special.  It’s not knowledge or ability or intelligence. It’s just that most everyone else handcuffs themselves before they begin.

When something breaks, before you really start trying to understand why, your brain flashes up as good a model of what’s going on as it can manage. It makes a lot of assumptions to do this, things that you’re pretty sure are true, so that you have something to work with.  If an application is locking up every time you try to print, your brain dredges up any facts it can about how the application prints.  It never has enough facts, though, so assumptions form a sort of cartilage between the facts to hold the skeleton of the model together.  Then things go wrong.

Your model is screwed up, I promise you. You’ve missed something, or misunderstood something, or just plain gotten it all backwards.  That’s fine. You needed a starting place, and if you start staking out the really awful ones, you get a sense of the shape of the real problem.  Only people start to get confused over what was a fact and what was an assumption, and if one of those assumptions are wrong, and that assumption is connected to what’s kicking your application in the shin, you’ve effectively lost your way out of the maze.

At some point when you’re solving a really gnarly issue, you’ll hit a wall.  You’ve tried everything sane, you’ve exhausted the rational options and you’ve still gone nowhere.  That’s when you need to take a knife to your assumptions – even the ones that just have to be true, the ones that really should be facts – and start hacking.   Mere Smith blogged about screenwriting yesterday, and repeated one of the most useful lessons in fiction: Kill your darlings. Today, your assumptions are your your darlings, and they need to bleed.

This sounds obvious, right? You’re thinking I’m not really saying anything useful.  I get it. This is really obvious advice.  It’s just that almost no one takes it. Even, and especially, really smart people who know their crap.

I had a problem today when we were trying to deploy the most recent version of the website.  It was dying when trying to generate the spiriting for our images (something about which I understand almost nothing) and rolling back.  But why?  What was dying?

./smartsprites.sh: 8: java: not found

I read this yesterday, after an awful day involving low speed car wrecks and a hundred obnoxious technical problems, and I just thought, “Crap, something is wrong with this sprite garbage that I don’t understand.”  And, since it was the end of the day, I told myself I’d look at it with an awake brain tomorrow and went home.  I got in this morning, looked at the actual shell script that was failing and realized I’d been a moron.  There’s nothing wrong with the sprites.  It’s telling me what’s wrong right there.  It can’t find java.  It’s trying to call a command, and that command just plain doesn’t exist.

And here’s where the confusion sets in.  You think:

  1. I’ve deployed this site 40 times before this.  We’ve never had a problem with java.
  2. Nothing has been deleted or changed on the server.
  3. Maybe the java command is failing and I’m just misunderstanding the error. Because…
  4. I know for a fact that Java is installed.

Only you don’t.  In your bleary-eyed death march the day before, you switched from using Web Server 1 as your deploy target to Web Server 2, which used to just pick up the changes you deployed to 1.  Java is installed: on Web Server 1.  You don’t know crap about what’s installed on 2, because it never mattered until today.

When I brought my sysadmin over to say, “We don’t have java installed on Web Server 2,” he pushed back.

“Of course Java’s installed. It’s installed on every machine.”

This goes back and forth for about a minute.  This is what I mean when I say smart people let their assumptions become shackles.  We’ve got an error. The error says JAVA NOT FOUND and nothing else. You really, really feel like java was installed.  So something is incorrect. Either the error is wrong, or your assumption is off.  Most people, at this point, go with their assumption and test something else.  But it doesn’t cost you anything but a little time to prove it.  Make a run at the problem like you’re totally wrong about this one thing and see what happens.  Either you’re proven right (“Ha! Told you Java was installed!”) or you’re proven wrong and you just won a little bit of the future.

In this case, I had to log into the server and type “java” at the command prompt to prove it wasn’t installed.  If I hadn’t had such an easy way to test that, we’d have been arguing for a lot longer.  Assumptions do their best to keep you from doing things you feel are a waste of time.  It can’t be that, so testing it out would be a massive waste of time.  But when you’re lost in the swamp, you have to stop worrying about wasting time and you have to start hacking down weeds.  Any weeds you can see, even the ones you really suspect will just lead to a dead end.  You left efficiency behind when you got stuck with this problem.  Now you need to be mercenary and be will to turn your knife on anything that might be in your way.

Don’t be afraid to be scattershot. Don’t be afraid to try out things that can’t possibly be the issue.  Eliminate every option.  Remove all possibilities.  Improbable isn’t good enough. Prove it impossible, or mark it as a potential problem.  Don’t feel bad about stabbing your assumptions.  They’re usually asking for it.

No responses yet

Sep 09 2011

Help! I Have to Hire!

Published by under Coding

Now that I’m Señor Web Developer, there’s a good chance I’m going to be blessed with a temporary junior developer to help out with the work tsunami currently breaking on the horizon.  While the final decision will be up to the whole team, it’s going to up to me to decide if the person can do the job.  This will be the first time where I’ve had real responsibility in the hiring of another developer, and I could use your help.  I’d appreciate ny thoughts, warnings, suggestions or ideas you have on the subject.

Specifically, here are some areas I’m thinking about:

  1. What kinds of things would you put on the job description? Anything you’ve found flags better candidates outside of the normal boilerplate?
  2. Suggestions for the phone screen? I’m probably going to use Steve Yegge’s excellent article on it as a guide, but what are your thoughts?
  3. What’s your interview process after the phone screen? Do you have people go through any kind of development tests? If so, what?
  4. What are your red flags? Conversely, what says, “This is a good candidate,” to you?

Your help in keeping me from hiring a train wreck is very appreciated.

3 responses so far

Sep 02 2011

September 2011 Project Update

Published by under Coding,Creating

Known in some corners as “What is Eric failing to put enough time into today?”

  1. Broken Magic - Finished eons ago, it has too few rejection letters attached to it.  After some brutal but lovely query letter criticism from Jon Merz, I hope to get this sent out to a few smaller presses this weekend.  In the meantime, I’m exploring the possibility of self publishing, since I’m sick of it sitting around, even if a big reason it’s sitting around is because I’ve only given it a half dozen chances to be rejected.
  2. Seanchai - The mythical, magical soon-to-be awesome self-publishing website platform for the 21st century.  A blog for long-form writers. WordPress for novels.  I’ll get a cool catch phrase soon, I’m sure.  Maybe.  I started work on before work utterly overwhelmed me. I’m getting back to this, since it’s both a good idea and something I would really like to use myself.
  3. Big, Long Project I Don’t Talk Much About - It’s a novel.  Three months ago I had 40,000 words done. Then I decided those all sucked, so now it’s down to 20,000.  I’m in the midst of the Chapter From Hell, which I’d like to finish so I can make some progress on something again. At this rate, the expected completion date is sometime in the summer of 1754.
  4. Untitled Climate Change Short Story - When Rachel Brody wants to collaborate on something, I say yes. The month of September will likely be the month of writing a SF story wrapped around the theme of climate change. I’ve gotten as far as deciding it has something to do with wine. That last sentence bound to give Rachel heart palpitations.
  5. Mimesis - A modern, young adult horror/fantasy novel about a very doomed love triangle. It’s been living in my head long enough that it’ll likely not go away until it’s written. This still needs some structural work, but I might use NaNoWriMo as an excuse to focus on this later this year.  Of course, that’s what I said last year, so be ready to point and laugh come December.

No responses yet

Apr 30 2010

Every Talk With a Consulting Company Ever, Re: Commenting*

Published by under Coding

You: Our current code is completely uncommented. Do you comment your code?

Them: Yes, we comment.

You: Excellent, commented code is very important to us.

Later…

You: This code has no comments.

Them: We will comment after things are done.

You: …really?

Finally…

You: Wait, we’re all finished, where are the comments?

Them: Allow us to explain our methodology of why code comments are actually unneeded and cumbersome.

You:

* Regardless of the relative merits of comments vs. clean code that describes itself, it’s hilarious that anyone takes this particular kabuki dance seriously.**
** I could have probably titled this “Every talk with a programmer ever, Re: Commenting.”  Ah well.

No responses yet

Next »