What should I propose for a reusable code library organization?

| | August 6, 2015

My organization has begun slowly repurposing itself to a less product-oriented business model and more contract-oriented business model over the last year or two. During the past year, I was shifted into the new contracting business to help put out fires and fill orders. While the year as a whole was profitable (and therefore, by at least one measure, successful, we had a couple projects that really dinged our numbers for the year back around June.

I was talking with my manager before the Christmas holiday, and he mentioned that, while he doesn’t like the term “post-mortem” (I have no idea what’s wrong with the term, any business folks or managers out there know?), he did want to hold a meeting sometime mid-January where the entire contract group would review the year and try to figure out what went right, what went wrong, and what initiatives we can perform to try to improve profitability.

For various reasons (I’ll go into more detail if it’s requested), I believe that one thing our team, and indeed the organization as a whole, would benefit from is some form of organized code-sharing. The same things get done again and again by different people and they end up getting done (and broken) in different ways. I’d like to at least establish a repository where people can grab code that performs a certain task and include (or, realistically, copy/paste) that code in their own projects.

What should I propose as a workable common source repository for a team of at least 10-12 full-time devs, plus anywhere from 5-50 (very) part time developers who are temporarily loaned to the contract group for specialized work?

The answer required some cultural information for any chance at a reasonable answer, so I’ll provide it here, along with some of my thoughts on the topic:

  1. Developers will not be forced to use this repository. The barrier to
    entry must be as low as possible to
    encourage participation, or it will
    be ignored.
    Sadly, this means
    that anything which requires an
    additional software client to be
    installed and run will likely fail.
    ClickOnce deployment’s about as
    close as we can get, and that’s awfully iffy.
  2. We are a risk-averse, Microsoft shop. I may be able to sell open-source solutions, but they’ll be looked upon with suspicion. All devs have VSS, the corporate director has declared that VSTS is not viable going forward. If it isn’t too difficult a setup and the license is liberal, I could still try to ninja a VSTS server into the lab.
  3. Some of my fellow devs care about writing quality, reliable software, some don’t. I’d like to protect any shared code written by those who care from those who don’t. Common configuration management practices (like checking out code while it’s being worked on) are completely ignored by at least a fifth of my colleagues on the contract team.
  4. We’re better at writing processes than following them. I will pretty much have to have some form of written process to be able to sell this to my manager. I believe it will have to be lightweight, flexible, and enforced by the tools to be remotely relevant because my manager is the only person who will ever read it.
  5. Don’t assume best practices. I would very much like to include things like mandatory code reviews to enforce use of static analysis tools (FxCop, StyleCop) on common code. This raises the bar, however, because no such practices are currently performed in a consistent manner.

I will be happy to provide any additional requested information. :)

EDIT: (Responsing to questions)

Perhaps contracting isn’t the correct term. We absolutely own our own code assets. A significant part of the business model on paper (though not, yet, in practice) is that we own the code/projects we write and we can re-sell them to other customers. Our projects typically take the form of adding some special functionality to one of the company’s many existing software products.

6 Responses to “What should I propose for a reusable code library organization?”

  1. From the sounds of it you have a opportunity during the “post-mortem”to present some solutions. I would create a presentation outlining your ideas and present them at this meeting. Before that I would recommend that you set up some solutions and demonstrate it during your presentation. Some things to do –

    1. Evangelize component based programming (A good read is Programming .NET Components – Jubal Lowy). Advocate the DRY (Don’t Repeat Yourself) principle of coding.

    2. Set up a central common location in you repository for all your re-usable code libraries. This should have the reference implementation of your re-usable code library.

    3. Make it easy for people to use your code libraries by providing project templates for common scenarios with the code libraries already baked in. This way your colleagues will have a consistent template to work from. You can leverage the VS.NET project template capabilities to this – check out the following links VSX Project System (VS.Net 2008), Code Project article on creating Project Templates

    4. Use a build automation tool like MSBuild (which is bundled in VS2005 and up) to copy over just the components needed for a particular project. Make this part of your build setup in the IDE (VS.NET 2005 and up have nifty ways to set up pre-compile and post-compile tasks using MSBuild)

    5. I know there is resistance for open source solutions but I would still recommend setting up and using a continuous automation system like CruiseControl.NET so that you can leverage it to compile and test your projects on a regular basis from a central repository where the re-usable code library is maintained. This way any changes to the code library can be quickly checked to make sure it does not break anything, It also helps bring out version issues with the various projects.

    If you can set this up on a machine and show it during your post-mortem as part of the steps that can be taken to improve, you should get better buy since you are showing something already working that can be scaled up easily.

    Hope this helps and best of luck with your evangelism :-)

    I came across this set of frameworks recently called the Chuck Norris Frameworks – They are available on NuGet at http://nuget.org/packages/chucknorris . You should definitely check them out, as they have some nice templates for your ASP.NET projects. Also definitely checkout Nuget.

  2. Just an additional point, since we have “shared code” in my shop as well.

    We found out this is very much a packaging issue:
    Whatever code your are producing or tool you are using, what you should have is a common build tool able to package your sources into a “delivery component”, with everything used to actually execute the code, but also the documentation (compressed), and the source (compressed).

    The main interest into having a such a “delivery package unit” is to have as less files to deploy as possible, in order to ease the download of those units.

    The build process can very well be managed by Maven or any other (ant/nant) tool you want.

    When some audit team want to examine all our projects, we just deploy on their post the same packages we deploy on a production machine, except they will un-compressed the source files and do their work.

    Since our source files also includes whatever files are needed to compile them (like for instance eclipse files), they even can re-compile those projects in their development environment).

    That way:

    1. Developers will not be forced to use this repository. The barrier to entry must be as low as possible to encourage participation, or it will be ignored: it is just a script to execute to get the “delivery module” with everything in it they need (a maven repository can be used for that too)

    2. We are a risk-averse, Microsoft shop: you can use any repository you want

    3. Some of my fellow devs care about writing quality, reliable software, some don’t: this has nothing to do with the quality of code written in these packages modules

    4. We’re better at writing processes than following them: the only process involved in this is the packaging process, and it can be fairly automated

    5. Don’t assume best practices: you are not forced to apply any kind of static code analysis before packaging executable and source files.

  3. Charles Gardner on November 30, -0001 @ 12:00 AM

    First of all for code organization check out Microsoft Framework Design Guidelines at http://msdn.microsoft.com/en-us/library/ms229042.aspx and then create a central Location source control for the new framework that your going to create. Set up some default namespaces, assemblies for cleaner seperation and make sure everyone gets a daily build.

  4. Maven has solved code reuse in the Java community – you should go check it out.

    I have a .NET developer that’s devised something similar for our internal use for .NET assemblies. Because there’s no comparable .NET Internet community, this tool will just access an internal repository in our corporate network. Otherwise will work rather much the way Maven does.

    Maven could really be used to manage .NET assemblies directly (we use it with our Flex .swf and .swc code modules) is just .NET folk would have to get over using a Java tool and would probably have to write a Maven plugin to drive msbuild.

  5. One question: You say this is a consulting group. What code assets do you have? I would think most of your teams’ coding efforts would be owned by your clients as part of your work-for-hire contract. If you are going to do this you need to make absolutely certain that your contracts grant you rights to your employees’ work.

  6. Steven A. Lowe on November 30, -0001 @ 12:00 AM

    organize by topic, require unit tests (feature-level) for check-in/acceptance into library; add a wiki to explain what/why and for searching

Leave a Reply