Posts tagged: PROGRAMMING

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.

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?

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.

dpaste.com

I’ve re-launched my little Django-powered pastebin (formerly paste.e-scribe.com) under its own shiny new $8 domain name: dpaste.com. Not that the world really needs another pastebin, but people have been using it daily and it’s a fun side project. From the about page:

Philosophy: Simplicity and usability. The grayscale look makes the colorized source code stand out. Cookie-based personal defaults eliminate lots of extra form widgetry. Automatic expiry means the database never fills up. Auto-focus on the Code field means mouse-free operation. No required fields means you can paste, tab, return, and go. No running list of recent items means the spammers remain invisible. And Django makes nice clean URLs the path of least resistance.