Python Rocks! and other rants
Weblog of Kent S Johnson

#50 2004-06-29 08:18:08

StranglerApplication

Martin Fowler has written an interesting note about how to replace a legacy application with something new. He suggests adding new functionality around the old application until you finally take over all the old functions. He calls this a StranglerApplication.

The most interesting part of the note is the pointer to a paper describing a specific project. Parts of this project are similar to what I did with Meccano:

  • Work closely with the users
  • Find ways to build confidence in the agile approach
  • Deliver real value as early as possible
  • Let the customers try out the new product and get them hooked on it

Categories: Agile

 

#49 2004-06-24 07:35:28

Eclipse Preannouncement

You have probably seen the announcement that Eclipse 3.0 Final has been released. What you may have missed is the last line of the announcement: "Distributions of Eclipse 3.0 will be available by June 30 for download from http://www.eclipse.org."

In other words, they pre-announced the release! I don't think I've seen anything like this from an open-source project before - usually the release announcement accompanies the actual release.

Categories: Java

 

#48 2004-06-16 12:02:08

Python fashion statement

Did you know that you can buy a genuine python-skin bracelet? Here is one with a gold snake as well. According to the web site it is "sure to leave friends whispering!" I don't doubt that!

Categories: Python

 

#47 2004-06-16 11:40:48

Fun with difflib

I recently needed to show changes in the ordering of two lists in a way that makes sense to a person. Python's difflib makes this ridiculously easy. This little snippet does the trick:

import difflib

def showDiffs(old, new):
  ''' Show differences between two lists '''

  # Get the diffs
  diffs = difflib.SequenceMatcher(None, old, new).get_matching_blocks()

  rowFormat = '%-10s  %s'
  oldCurrent = newCurrent = 0

  for oldIx, newIx, count in diffs:
      # Catch up the output to the current diff position
      while oldCurrent < oldIx:
          print rowFormat % (old[oldCurrent], '')
          oldCurrent += 1

      while newCurrent < newIx:
          print rowFormat % ('', new[newCurrent])
          newCurrent += 1

      # Write the common sequence
      for i in range(count):
          print rowFormat % (old[oldIx+i], new[newIx+i])

      # Update current locations
      oldCurrent = oldIx + count
      newCurrent = newIx + count

Now showDiffs( [1,3,2,4], [1,2,3,4] ) prints out

1           1
            2
3           3
2
4           4

Sweet!

Categories: Python

 
© Kent S Johnson Creative Commons License

Comments about life, the universe and Python, from the imagination of Kent S Johnson.

kentsjohnson.com

Weblog home

All By Date

All By Category

Agile

Java

Python

Essays

XML-Image

BlogRoll

Powered by Firedrop2