Posts

What Shape Should My Code Take? (using FizzBuzz)

Image
 Sometime back in my early days of programming, I learned to enjoy a truth table. Fizzbuzz seems to beg for a simple truth table - the values ' should_fizz ', and ' should_buzz ' form up a simple tuple of booleans, and the choices are True, False - fizz False, True - buzz True, True - fizzbuzz False, False - string of the number This expresses rather neatly in Python, is efficient and pythonic, and handles negative cases neatly also: But here's the rub:  One of the "normal" changes is to add a rule that multiples of 7 say 'woof' even if they are also divisible by 3 or 5. That's a peculiar rule, but let's consider it for a moment. If I am going to add another term to the set, I have to edit the match line and every case line. I will have to add new cases for all the possible truth values in my new 3-tuple table. That's not so much fun.  The changes to my test suite are, at least, minimal. The best expression in our codebase may not be t...

A vimrc starter

Here is a .vimrc file built from the recommendations in my Vim book, " Use Vim Like A Pro " (available on LeanPub ).

Convenience Scripts for Projects

Image
Recommended bash scripts for every project clean_start  ensures you are ready to start new work. It does: 'pull -r' (which fails if you have uncommitted work) a refresh of the local environment  'git clean -i' in case you have untracked files you've forgotten about a full test run. onboard is the script to run if you are a brand-new developer and you need to set up your development environment. It will deal with setting up the environment (installing dependencies and any virtual environment) and runs the tests. run runs the application itself. I started adding run scripts when I started changing between ruby, python, java and other projects and got tired of having to remember which incantation started the servers.  This is a shortcut. run_tests will run all of the tests -- every kind. run_integration_tests will run only the integration tests (I don't always separate these). I don't use a script to run only the unit tests, because I have IDE configured to...

Why is working faster not working?

Working faster isn't working?  Do you want to understand why that is? Warning If you are working with development teams (and aren't a developer or ex-developer) then this might be jarring , but it's intended for good and not for offense. The reason it takes so long for work to be done? I know from a distance it seems like it's "they're not working hard enough," but it's very possible (better than 50/50) that they're working too much. The queues Wherever there is a handoff, there is a queue. If the person receiving the work is busy, the queue becomes a wait. How long work waits is largely a matter of: How many things are in the queue? How often can someone pull the work from the queue? How long does it take to complete the job once started? How long does it take one task to clear all of the other queues and reach production? We tend to think of our workflow like this: [Step 1] ---- [Step 2] --- [Step 3] -- [Release]      In reality, it looks more li...