authored by Wayne Witzel III

Dynamic and static typing with unit tests.

On April 20, 2009 In python, brainstorm, c++ Permalink
There is an on going discussion at the office with a team member who refuses to use dynamic languages. Claiming that most of his errors are typographical errors and they are caught by the compiler. So for him, since these errors are not caught until runtime, he throws and entire group of languages out the window. He also claims that to ensure that same level of checking with a dynamic language you would have to create more unit tests than normal to prevent introducing unhandled runtime exceptions. So I decided to do a little test over the weekend. I created a very simple Number class in Python and C++. Using the exact same TDD development process, I implemented some very basic operations including division, addition, subtraction, etc... I ended up with 12 tests. The exact same tests for both the C++ and Python implementation resulting in 100% of the executation path being covered. I decided that the compliation (in case of C++) and passing of the tests determined a success. Then went back and inserted common typographical errors. Mistypes, extra = signs, not enough = signs, miseplled_varaibles, etc... The end result was I was unable to get my unit tests passing while introducing syntax that would induce an unhandled runtime exception in Python. Granted, in C++ the compiler did catch a lot of things for me, but the point here is I didn't have to create any extra tests to ensure that same level of confidence in my Python code.
Read and Post Comments

Blog themes and SCM.

On October 11, 2008 In brainstorm, sourcecontrol Permalink
We have a new theme? You like? If not, blame commenter rholmes, it is his fault. Seriously though. In a previous post he brought up a very good point, the site looked like hell if you were browsing with images off. Well this new theme looks better with images off and overall it isn't too horribly bad. So, if you don't like it, suggest one, just make sure it looks good with images turned off. Now to the SCM part. After about a week of playing with Github and Lighthouse, I found them both to be great products. They integrated well with each other and the tools for working with Git are available under every platform. If I didn't already have my own server and experience deploying Trac and Mercurial I would use both these services without question. That being said, though I have enjoyed my time working with those tools, I've migrated my Github source and Lighthouse tickets over to a newly installed Trac 0.11, full circle. End result. If you like tinkering. If you like managing your own installations or you have some customization/integration you would like to do, use Trac and Mercurial, otherwise use Github and one of the great ticket systems it integrates with; I enjoyed Lighthouse. For fun, here is the circle of ticketing and scm life I've gone through over the last 6 years or so.
  • cvs and PHP Ticket
  • svn and home grown Python tickets
  • svn and Trac
  • Github and Lighthouse
  • mercurial and Trac
Have to wonder what is next. A lot of people at work have been asking me why Github or mercurial? Why Wayne? True, that most of the time I am using the repositories for me, myself, and I (De La Soul), but the benefits extend just beyond handling version control for an arbitrary number of developers and clean merges. I'll do a write up soon. All the sourcecode for this site is now located at: I'll be updating all the old links through the other posts to reflect this. Fun.
Read and Post Comments

Keeping a Kitchen: A programmers approach.

On September 17, 2008 In python, brainstorm Permalink
A recipe site to end all recipe sites? After going through piles of recipe and food sites I found absolutely nothing that met my needs, be it a pay site or a free site. Nothing did what I was looking for. After speaking to some friends and family, throwing around my ideas, I decided that was I was looking for wasn't all that far fetched, just no one has really taken the time to do it. First, lets cover what is how there.
  • Recipe sites (tons)
  • Diet sites (tons)
  • Kitchen/pantry inventory sites (a few)
Doing some quick Google searches for those terms and you'll find yourself piles of links. You'll find plenty of sites that do food tracking for diets, plenty that do recipes, some that combine diets with recipes, but none that combine all three. What I want from a site
  • Recipe database
  • Item database (for recipes and shopping lists)
  • Ability to add new recipes
  • Ability to edit existing recipes
  • Kitchen/pantry inventory (barcodes?)
  • Daily, Weekly, Monthly food planning
  • Sensible shopping lists (more on this)
That is a fairly short list and I was unable to find all those elements in any site. As for those sites that had some of the elements, most were over complicated and far from intuitive to use. Sensible shopping lists Ok, simple example. Lets say you add the Chips and Salsa recipe to your list of items you're eating this week. Your pantry inventory doesn't contain chips or salsa. Most sites that incorporate recipes and shopping lists will give you a shopping list like this
  • 1/2 cup Salsa
  • 10 tortilla chips
OR it will just remove the quantities
  • Salsa
  • Tortilla Chips
The second one isn't actually that bad, because that is what you need. The problem with the second list is when you already have Salsa or Tortilla chips. Most sites have no tie in to kitchen inventory. This site, if used religiously for all your recipes and meals would provide an accurate shopping list for all meals planned based on the shopping list you choose to receive. This means you could enter in all your recipes, plan your meals for 3-months, and bring out 1 week or 2 week lists. As you mark meals cooked for each day, the lists will dynamically update to provide accurate inventory tracking.
Read and Post Comments

Project: Developing a simple insurance interface.

On July 06, 2008 In python, project, brainstorm Permalink
I play a game called EVE Online and I create and support a lot of software for our in-game corporation. After recently migrating forums away from punBB over to vBulletin I was stuck with the choice to either migrate our existing Ship Insurance script (written in PHP) or create a whole new system from scratch. Being a lover of Python, TDD, and sausage, I of course picked the rewrite option since it would be the most difficult and suck up more resources and time than just migrating some shitty PHP script. The requirements are very simple. Allow claim to be entered. Allow claim to be approved. Allow a claim to be denied. Allow an agent to see a listing of all claims. Allow filter options by ship type and pilot. Allow agent to enter in the payout. Save all past claim information. (reporting) My personal goals for this project. 100% coverage with unittests. Use TDD methods to develop the project. Use the Trac system to support development. Use Pylons with a SQLite DB Use Ext for any fancy shit. Code available soon as I get my repository back online.
Read and Post Comments