Building Modules (and Skills)

Building a software project is very similar to building a hardware project - you take a collection of modules and assemble them into the final system. Sometimes these modules are available 'off the shelf', sometimes you have to design and build them yourself. If you're nice, you share the ones you build with the rest of the world.

Sharing your designs not only helps other developers (and makers) it forces you to look at your design differently and helps you hone your design skills. You might take a bit more care with your PCB layout for example so it won't cause problems when sent to a fabrication house or you might be a bit more careful about your choice of components, making sure that the ones you select a readily available and relatively cheap. Building something for public consumption is very different from building something for yourself.

Not Designed for Reuse

This is clearly not designed for reuse. I am ashamed to say I have written code that looks like this as well.

In the same way that you might publish your design for a hardware module as a set of design files you can also publish your software to public package managers to share them with other developers.

If you have used Raspbian on the Pi you would already be familiar with apt-get which will fetch and install full software packages (and their dependencies) for you. Similar tools exist to install software libraries that you use in your own applications. Python has PyPi and the pip tool, NodeJS has npm and DotNET has NuGet. Each of these is a public repository of packaged source code that can easily be added to your application and each of them allow you to publish your own packages for public consumption.

There are a number of tutorials available describing how to set up and distribute a package - this one for Python and this one for NuGet for example. A quick Google search will find others so there is no need to get into the details here.

I have been using private Python package manager for a while now - as well as providing a single location for my shared code to live it makes it easy to install various custom utilities I have written with a single 'pip install' command (especially useful for Vagrant provisioning scripts). A lot of the code and utilities in that repository is very, very specific to my internal network setup and it doesn't make sense to share it with the outside world.

Designed for Reuse

This is designed for reuse. Image Credit

The trouble is that this leads to some less than ideal implementations - once something works 'well enough' in my environment I publish it, no-one is going to see it but me and if it causes something to break the only person effected by that will be me. If the package is public though that forces me to be a bit more careful - I have to consider different use cases, more resilient error checking and better documentation. These are all things I should be doing in the first case but that often get skipped in the name of expediency. In other words it's good training for a professional programmer.

For most of my career I have worked individually or in very small teams - a lot of the niceties (unit testing and documentation for example) weren't done as well as they could be. These things take time away from what is usually a very tight schedule to begin with and it was easy enough to simply talk to your other team members to sort out any errors or bugs that might come up in their code.

My new job doesn't allow for that any more - I am working with a large, globally distributed team and producing well documented, well tested code is essential. Add to this that I'm working mostly in C# now - a language I have used before but not extensively - and it's becoming painfully obvious that I need a bit more practice and experience in some skills that I have let lapse over time.

I had a fairly large project in the planning stage when I was offered this position so I decided to write it in C# to get the practice I needed in a less critical environment. After discovering the additional gaps in my skill set I decided to refactor parts of the application into sharable modules and publish them on GitHub and NuGet - this forces me to consider an audience beyond myself and make the effort to do the job correctly, not just expediently.