There are things that programmers, especially in the early stages of their "careers" when they focus solely on writing software, do not fully realize. They mostly involve formalities and the sad fact that code is not necessarily created for fun, but is above all a component of the client's business venture. As a result, some aspects may seem silly from a rookie's perspective, yet they matter for keeping the terms of cooperation and for dealing with how things develop further (both positively and negatively).

One such step is handing the source code over to the client. Let me say up front that this text does not cover the legal side of the process. You will find plenty of lawyers' write-ups on the web that go into various nuances (for example the obligation itself or confidentiality). Here we focus on the situation in which a software house has to hand over such code and asks not whether to do it, but how.

Let's start by saying (or rather writing) what counts as source code and why the client may need it. As for the first question, source code usually means all the files that let you modify, build or recreate the software running on a server or in another environment. In other words, it is not always just the contents of the developers' Git repository, although it usually comes down to that. Sometimes, though, it is necessary (or advisable) to deliver, for example, a complete folder with libraries, or external files from which certain data in the database can be restored (although in such a setup they should be part of the repository contents). A built version of an Angular app, for instance, is not source code. Yes, you can put it on a server, but you cannot easily modify such software, so it is useless for the developers who maintain the code.

What exactly gets handed over is agreed individually between the client and the contractor. As I said, most often it is plain source code, that is the current contents of the repository, but sometimes the client needs additional materials. Note the word "current": a repository usually has many branches, and the main one ("master" or "main") is not always the version deployed on the server. So make sure (if only out of professionalism) to deliver the version of the software that actually runs. Of course, we leave aside any documentation or instructions here.

The next question is why a client may want access to the source code. The IT industry is peculiar in this respect. An electronics engineer building a device for a client will not hand over all the wires, resistors and capacitors separately, and a builder will not hand over bricks and mortar. Software, on the other hand, is quite malleable and is usually modified or extended in the future. On top of that, the material from which the final product is made is easy and cheap (even free) to get here. So, again leaving aside legal issues, licenses and contract clauses, the client may ask for access, for example, to protect themselves against losing the contractor. Sometimes you need to move the work to another contractor, and without the source code that is usually impossible. There are also cases where the client sets up their own team after a while to keep maintaining the software, and that team needs something to work on or has to collaborate with the original contractor for a time.

The source code is most often handed over at one of three moments:

  • after each phase or sprint: the parties can agree to send the materials after every completed phase of the project, which is most often combined with signing an acceptance protocol. This is quite a good solution, though it is worth adding it to the sprint tasks, because in the heat of battle with the code, developers sometimes simply forget about it.
  • after the project is finished: in theory it seems the most sensible option, but remember that software is rarely truly finished. It sounds absurd, but in the era of MVP versions, agile methodologies and the maintenance phase, the fact that a project is finalized need not be so obvious. There is always something to do or extend, and in really few cases can you say this is the end, there is nothing left, we are free, we can go.
  • after the cooperation ends: it cannot be denied that sometimes the parties part ways once all business obligations have been fulfilled. This is of course the moment when the client can also demand the source code from the contractor, if there are no other obstacles (for example licensing).

We already know the "what", the "why" and the "when". Now let's move on to the "how": what are the ways to hand over source code? There are at least a few.

  1. handing over a password-protected ZIP archive, or an unprotected one, if the client likes a shot of adrenaline. This is probably the most common method, as it is the most obvious: it is just a bundle of files that you can send. But remember to do it the right way. Best of all, of course, in person, on a USB stick or, back in the day, a CD. Most often, however, such archives are delivered electronically and protected with a password, which is then sent separately by a secure method (even by SMS).
  2. uploading to a designated (S)FTP server of the client: this is a variation of the previous option, in which the archive is delivered electronically, but it usually involves encrypting the data (for example with GPG). It is rarely used, though, because it requires suitable technology on the client's side. Much more often you use either a "plain" handover, or...
  3. putting the code in an external repository: since the contractor uses a repository to maintain their code anyway, it is usually much simpler for the client to create a Git repository (or for the contractor to create a second one), and the handover is then a standard "push" to another "remote". This has the advantage of simplicity, but also of an extra backup. There is a downside, though: the contractor does not always agree to show the entire history of the code (for example, not wanting to reveal the developers' personal data), and in this case that is very hard (bordering on impossible) to avoid. It is also very rare to give the client direct access to the contractor's repository. This is risky on several levels (personal data, security, unauthorized interference in the schedule) and violates a certain developers' "enclave".

Whichever path you choose, it is worth mentioning that handing over the source code does not mean the contractor loses access to it. They always need it, if only for further modifications, a service contract or handling the warranty. Still, making the source code available to the client, if they want it and it is not restricted by law, matters both for the hygiene of the cooperation and for the contractor's professionalism.

Best regards and thank you, Jakub Rojek.