On Rewriting Software

Kevin Barnes has an interesting post about software rewrites. Here are some of the questions he thinks you should be able to answer “yes” to in order to proceed with a high chance of success:

  • Do you honestly believe that if you rewrote it without adding any features the resulting code would be 33% smaller than the current code?
  • Do you have a very senior sponsor who understands and believes in the project?
  • Can you get enough resources (even on a temporary basis) to support development on the old code base while the new code is written?
  • Is the project critically important to the company’s future?
  • Can the company go without a major release of the product for half the planned coding duration?
  • Do you have anyone on the team who has successfully rewritten a major piece of software before?

I find his list thought provoking for two reasons. First, like (all|most) programmers, of course I have applications in use that I would like to rewrite.

Python 2.5 Library Reference for Plucker

I’ve created an updated Plucker version of the Python Library Reference for Python 2.5. It weighs in at 1.7MB, a bit fatter than the last one mostly because I tweaked the spidering depth to keep deeply nested pages from being skipped. All twelve of you who have an interest in such a thing can find it here:

Most boring upgrade ever

$ sudo portupgrade php5 php5-curl php5-sqlite php5-bla bla bla...
--->  Upgrading 'php5 bla bla bla...'
...
[Updating the pkgdb bla bla... done]
$ sudo apachectl graceful
$

New Year's programming resolutions

It’s that time of year. In no particular order, here’s a quick list of goals for Paul-as-developer in 2007.

  • Convert my remaining legacy PHP code (side projects and regular work both) to Django.
  • Write a useful PyObjC application.
  • Make some kind of contribution to Python itself, if possible.
  • Continue to add revision control and deployment automation to existing projects, as well as using it on new projects.
  • Continue to add unit tests to existing projects, as well as using them on new projects.
  • Learn a new language well enough to write a useful (small) application. Current candidates (all of which I’ve done at least enough reading on to have specific reasons for my interest, and some of which I’ve written toy programs in) are Haskell, Common Lisp, Io, Objective-C, and Ruby.

So, what about you? What are your coding goals for 2007?

dpaste.com update

My little pastebin site, dpaste.com, has been chugging along nicely since I announced it here about six weeks ago. Today I updated to the very latest Pygments codebase, which allowed me to add colorizers for Apache config files and bash scripts.

I’ve also started to add some Django-specific rules to the Python colorizer; it now recognizes Django model field types (model.CharField and the like). My thanks go to everyone who’s been using it, especially those who have given me feature suggestions and problem reports.

99-byte Python quicksort

Update: Browsing through my Python Cookbook this evening I discovered entry 5.11, “Showing off quicksort in Three Lines”, which includes some code very much like mine below. The entry does a good job of emphasizing that these bits of code are perhaps to be savored but not to be actually used. It also includes an insanely (impressively?) convoluted version that uses three lambdas in a single line and weighs in at 105 bytes. I thought this might be the best possible in Python 2.4 and earlier, but in fact a simpler version can be constructed using the old short-circuit logic trick, and at 94 bytes it’s even smaller than my original. Here it is: q=lambda s:len(s)and q([x for x in s[1:]if x<s[0]])+[s[0]]+q([x for x in s[1:]if x>=s[0]])or s

Enticed by the lovely Haskell quicksort example, and sullied by the code-crunching ways of Codegolf, I decided to see how small a Python quicksort function I could write. I stopped at 99 bytes.

Top 20 MySpace passwords

Bruce Schneier has an enjoyable article up on Wired News that describes what he learned analyzing some password data from a recent MySpace phishing attack. In it, he lists the top 20 most common passwords in his sample of 34,000:

password1, abc123, myspace1, password, blink182, qwerty1, fuckyou, 123abc, baseball1, football1, 123456, soccer, monkey1, liverpool1, princess1, jordan23, slipknot1, superman1, iloveyou1 and monkey.

Best quote from the article: “I don’t know what the deal is with monkeys.”