Logbook + Scratchpad

legacy

The reason why I've mentioned legacy code in the last post is that I've recently reopened an old project of mine (which I'll expand upon in another post), and I've immediately seen a number of Python packages that either are outdated, have undergone a number of changes, or simply I have forgotten about.

  • pylab, a Matplotlib plotting interface, has been replaced by pyplot.
  • mplot3d, used in Matplotlib to create 3D plots, now does not require to be imported explicitly.
  • PyQt, the Python bindings to the Qt framework, is now at version 6. Obviously this changes some of the API.
  • VPython, an easy-to-use 3D library that I've used quite a lot in the past, now defaults to using a Jupyter notebook rather than a standalone viewer.
  • I had largely forgotten about Mayavi, an interactive 3D data visualization library. I'll need to take a look at it again. A small practical note: pip install mayavi does not work with version 4.8.1; instead, use pip install https://github.com/enthought/mayavi/zipball/master.
  • wxPython, my favourite Python GUI toolkit, and pyqtgraph, a more specialized graphics and GUI library, still seem largely the same. I have just not used them in a while.

#python #legacy

One thing I enjoy doing every once in a while is to dig up some old code I wrote some time ago and look at how things have changed and, most importantly, how I have changed. I see not only how different conventions and paradigms that are established nowadays would make things different (and not always for the best), but also how I now give more importance to clarity and simplicity, and at the same time how I see more possibilities and different ways to solve the same problem.

This exercise makes me appreciate more the problem of maintaining legacy code. A developer starting work on an existing project will always see:

  • Changes in the API
  • Changes in code conventions (spacing, variable names, even indentation sometimes)
  • Duplicated code
  • Complicated code
  • Changes in external libraries
  • Changes in pieces of the overall architecture

The list goes on and on. The most important thing is always to be aware that today your skill is different (hopefully higher), and your knowledge of the problem and the domain is better, than yesterday. Be grateful and happy for the experience you have gathered so far, since it's experience that brought you to appreciate this.

#software #legacy