Programming Tip: Tag your source code to assist the developers.

How many times have you searched in the code base of your company projects to know how a recurrent treatment was implemented? This might concern a technical treatment like the database access, logging, socket access, etc… , or it might concern a design needs like the design patterns implementation.

Currently, to develop a recurrent treatment, a developer could:

  • Spend several minutes in searching for what he wants in the code
  • Ask a collegue
  • Develop from scratch without using an existing code as a sample.
  • Use some guides from its company

In this post we will talk about a technique that we use in our company for recurrent programming needs.

The tip is to tag some treatments in your code base to assist the developers of your company when they need a recurrent treatment. Let’s take as an example the database layer: we could add for each recurrent need (Select, Insert, Update, Delete, stored proc) a tag in a method doing this treatment. This method will be the model of this recurrent need.

For example, for a  method  doing a select into the database, we can add the following tag in the comment block [DatabaseSelect]

Another example might concern a design pattern like the singleton or the adapter, it could be interesting to tag each actor of the pattern, and you can use as an example these tags [Adaptee] and [Adaptor].

Any developer could just search in the code where a tag exists if he or she needs specific treatment. A repository of all tags will be available from the company wiki web page. Of course a tag will be added only once and no need to add it wherever a similar treatment is done.

The advantages of this technique are:

  • Developers could find in few seconds what they want as recurrent treatments.
  • The source code will be homogenous for all the company projects.
  • The treatment tagged will be a reference concerning the implementation quality.
  • After few months, the company will have a repository of almost all the recurrent needs.

Sometimes, there is no need to be assisted by an advanced tool or a very advanced technique in order to assist the developers in their works; indeed, it’s very easy to adopt this technique and the result is very interesting.


Leave a Reply

Your email address will not be published. Required fields are marked *