Code vs. Coding
Solution 1:
Code is the result of a coding process. The coding (process) of an algorithm results in executable code (product).
There is a similar question about learn to code vs learn coding. In that case they are equivalent, as they are both verbs.
In your example The coding was done years ago, the usage is arguably correct when you talk about the process. With a different verb it would not work:
*The coding was written years ago
The code was written years ago
Edit: Just for completeness, to code is also a verb. A code is a mapping between symbols, eg Morse code mapping e to '.' and t to '-', or ASCII mapping 32 to ' ' and 65 to 'A'.
Solution 2:
Say you want to tell your friend that you are going to write a program that would find the solution to a quadratic equation. So you can say,
I am going to code a program that would find the solution to a quadratic equation.
Or you can say,
I am planning on coding a program that would find the solution to a quadratic equation.
You can also say,
I am going to write a program that would find the solution to a quadratic equation.
Also, "code" may be used in a sense that you are going to write the program but haven't started yet. "Coding" in that sense is used when you have stated to program.