7th June at 09:30

Where I work, nearly all of our legacy estate is on Oracle technologies. Some of these systems are between 15 to 20 years old.

Much of the software is written in the Oracle database programming language, PL/SQL, which stands for Procedural Language for SQL. Legacy PL/SQL is hard to modify.

Compared to software development, where there's a maturity around tools and techniques, such as testing and refactoring, there doesn't seem to be the same level of innovation at the database tier. This stagnation means it is hard to maintain and modify code, frequently leading to procedures that are 5000+ lines long with all the expected complexity. Clean code principles target "modern" languages, although some of the clean code principles can be applied to PL/SQL but this is rarely the case based on current experience.

Organisations want to move faster. Continuous delivery and the supporting practices help achieve higher levels of throughput, stability and quality. Keeping your business logic in the database is antithetical to the goal of responding to change with agility. Keep databases for what they do really well: store and retrieve data, establish and enforce relationships, query data for answers, automatically handle performance optimisations, provide access control and more.

I've been looking for a side project to get my hands dirty again, something out of the critical path but potentially useful. I want to know that our footprint is reducing for technologies we want to shift away from. One crude measure is to count the number of lines of code in PL/SQL. I'm only interested in the trend line. Going up over the year = bad. Going down = good.

I plan to build something that will periodically analyse each repo with PL/SQL, count the lines of PL/SQL and store the data somewhere, so I can then chart it later on. Cloc looks like a good place to start.

What other proxies are there are for understanding and measuring legacy systems?