Ben Laposky, Oscilon
Technical Tips

Simple Software Verification, Part 3: Karnaugh Maps

(Image by Ben Laposky) [hamzh_toggle title=”Series Parts” state=”closed”] Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps [/hamzh_toggle] Welcome to the third and final article in this mini-series on software validation. In this article we’re going to discuss state machines, what desirable properties they should possess, and then I’ll demonstrate a simple tool for verifying them called Karnaugh Maps. Identifying State Machines As a general rule of thumb, you can identify a program that…

Technical Tips

Simple Software Verification, Part 2: Trace Tables

(Image by Leonardo Solaas) [hamzh_toggle title=”Series Parts” state=”closed”] Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps [/hamzh_toggle] Welcome back! In the previous article I explained why you might be interested in software verification techniques and then showed you how to use Execution Tables to verify your software for specific cases. In this article, we’ll generalize Execution Tables into a format that will allows us to create simple inductive proofs about our loops. Trace Tables…

Technical Tips

Simple Software Verification, Part 1: Execution Tables

[hamzh_toggle title=”Series Parts” state=”closed”] Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps [/hamzh_toggle] (Image by Manfred Mohr) Introduction If you’re a software developer, and you work somewhere even remotely sane, then chances are good you employ some form of automated testing in your day-to-day practice. Automated testing is a wonderful and extremely valuable tool, but there is nevertheless something slightly fanatical and suspicious about the claims of those who prescribe it as the strategy for managing software quality. Namely,…


Fixing Python’s title Function

Python’s title function has some weird side-effects when you’re titlizing a string like, for example, a street name: >>> "62nd".title() "62Nd" >>> "West 62nd st.".title() "West 62Nd St." Here’s how you can fix this: import re def fixed_title(input_string): parts = re.split(r'\s', input_string) for idx, value in enumerate(parts): if re.match(r'[A-Za-z]', value[0]): parts[idx] = value[0].upper() + value[1:] return ' '.join(parts) A simple fix that produces the right result: >>> fixed_title("West 62nd st.") "West 62nd St."    

Opinion Technical

Forensic Analysis of “No Silver Bullet”

(Image by Lee Ufan) I. Our task — Software engineering has a long and hallowed tradition of uncritically evaluating and citing evidence [1][2]. It is our keenest joy to snatch a quote or cite a statistic without any critical evaluation of the source. As far as one might like to dig into the past this is the way it has always been done, and maybe the way it always will be done. Perhaps in the early days the fight for…

Opinion Technical

Why Software Process Never Works

Nothing induces more ambivalent feelings in working software developers than the idea of process. On the one hand we crave the sanity, insight, and opportunity for self-improvement that processes promise. On the other, we actively fear trying to introduce them into our organizations. Stories of botched or half-assed attempts to apply some new-fangled methodology are as common as dirt. Often times the end result can be worse than if nothing had been done at all. One popular explanation for this…

Technical Tips

Monitor Celery Queue Consumption Speed

A lot of times when using the python Celery library it’s useful to be able to monitor how fast the queue is being consumed. This is useful if you need to do a back of the envelope to see how long  a queue will take to chew through, or just to see how the current status of the queue to make sure there aren’t any blockages. So I decided to whip up a simple script to do just that. While this…

To work iron, a hammer is needed, and to have a hammer, it must be made. For this purpose there is need of an other hammer and other tools, and again to get these there is need of other tools, and so on to infinity. In this way one might try to prove, in vain, that men have no power to work iron. But the fact is that at first, with the tools they were born with, men succeeded, however laboriously and imperfectly, in making some very simple things; and when these were made they made other more complex things with less labour and greater perfection; and thus advancing gradually from the simplest works to the making of tools, and from tools to other works and other tools, they have reached a point where they can make very many complex things with little labour. In just the same way the intellect by its inborn power' makes intellectual tools for itself by which it acquires other powers for other intellectual works: and from these works still other tools - or capacity for further investigation - and thus makes steady progress until it reaches the summit of wisdom.
Spinoza - Treatise on the Emendation of the Intellect

On The Gradual Nature Of Improvement

genetic algorithms
Technical Tips

Implementing Genetic Algorithms In Scheme

I’ve been learning a lot of Scheme programming recently, and while learning is great, it’s nothing if you can’t cut your teeth on a project of your own every once in a while. I needed a project. It had to be something not dictated by SICP, something fairly challenging, and also something of decent size. When I first tried reading SICP in college, I’d tried implementing genetic algorithms in it and failed horribly. To see if I’d made any progress I…

Technical Tips

Python Tip: Convert XML Tree To A Dictionary

I was doing a simple XML integration with SOAP service today and it really struck me that a lot of the data manipulation would be easier if the data was a dictionary. In addition, the XML returned was guaranteed to be fairly small and have only a handful of schemas – so a full-blown SAX parser wasn’t really necessary as there was no risk of overflowing memory with the raw XML data. So I decided to write a simple recursive…