The actuarial profession is undergoing a process of modernization that is driven by technology. Despite this, many actuaries are unsure how to improve their technology and programming skills, lacking experienced mentors and any knowledge of best practices. There is a valuable opportunity here for actuaries to draw insights from software engineering.
Why should actuaries learn from software engineers?
Actuaries and their stakeholders increasingly understand that the innovative use of technology is one way to gain a competitive advantage. Tools and systems built with code can improve efficiency and reduce costs, among many other benefits. This means that the demand for actuaries who can code is higher than ever, and will continue to rise.
However, most actuaries have only basic coding skills, if any. This is not surprising – the journey to qualification leaves little space for learning a programming language to an advanced level, and actuaries who do code are largely self-taught or have learned it as a minor part of an undergraduate degree. In these environments and in most actuarial teams, the focus is rarely to develop production-grade software. Instead, code is typically used to carry out activities such as statistical analysis and data visualisation – and as quickly as possible.
These factors have led to a shortage of actuaries who are highly skilled, experienced coders, something revealed by the abundance of inefficient legacy systems and bloated spreadsheets found throughout the profession. To borrow the software engineering term, many businesses are rife with ‘tech debt’ – the implied accumulated cost of taking shortcuts.
So, who should actuaries look to for guidance? The answer is clear: software engineers, who use code every day to design, develop, test and maintain applications. In practice, this view does not appear widely accepted by the actuarial community – actuarial teams seem reluctant to recognize their work as software, even when it consists of scalable and reusable tools that are written in code. Actuarial and software work are incorrectly considered separate disciplines.
To an extent, this is simply a labelling problem – but labels are important. When they choose not to describe their code as ‘software’, actuaries distance themselves from the technology world. This is not the case with data science. It is well understood that there is significant overlap between actuarial and data work. They both add business value by finding insights in data, and actuaries are all the richer for this collaboration.
Fortunately, actuaries don’t need a computer science degree to improve their coding skills. Progress and innovation in the technology industry has exploded during the past few decades, marked by a wealth of information on how to write better code. Actuaries can select from the available resources to suit them. There has never been a better time to do it.
All this points to a clear conclusion – actuaries interested in coding should lean into this speciality. And look to the broader technology world for guidance, not just data science.
What can actuaries learn from software engineers?
It is not feasible to try to cover all the areas on which actuaries should focus in terms of writing software – it is a broad skillset that takes years of sustained effort to develop. However, there are a few areas in which beginners can make considerable progress with relatively little difficulty.
1. Think carefully about your program design.
Beginners tend to write code in the form of one long script, consisting of a series of commands to be executed in sequence. This works for simple exploratory exercises but is not sustainable when the task becomes more complex, and does not lend itself well to integration with other processes or systems. You wouldn’t build a spreadsheet using only one worksheet – so don’t try to do everything in a single script, particularly when there are thousands of lines of code.
Look to well-established software design principles, which are not necessarily difficult to implement. A start would be to take duplicated sections of code and move them into functions, or take larger sections and create modules in separate files. Modularization has many benefits – each file, module and function can be independent, making them easier to understand, test, review and re-use in other tools.
2. Use a consistent code style.
This relates to the styling and formatting of the code. It might seem superficial but code that is difficult to read and understand is more prone to errors, harder to update and collaborate on, and more likely to become obsolete over time. Actuaries understand this clearly when it comes to spreadsheets – a messy spreadsheet with hardcoded parameters in the wrong places is not likely to pass the actuarial review process. Equally, code that has no comments and inconsistent naming, for example, should not be accepted.
Code style is one of the easiest things to improve – simply select a published style guide and align your code with its principles. There are many style guides available online, such as PEP8 for Python and tidyverse for R.
3. Add value through code quality.
Actuaries tend to have a narrow conception of what ‘good’ looks like when creating a tool using code. They often implement the first (and perhaps only) solution they can think of, check it works on their use case, and move on. This approach tends to work only in the short term.
Testing for correctness is necessary but not sufficient for long-term solutions. There are many factors to consider, including portability, usability, simplicity, scalability, runtime, memory usage, and consistency with precedent. Good software is written by first considering the task’s requirements and constraints, then creating a solution that is optimized for the most relevant factors. This takes time, effort and empathy. It is always tempting to write a quick-and-dirty solution, but this just passes the burden onto those who will have to use the code in the future.
Learning to write better code does not necessarily mean understanding difficult algorithms or complex data structures.
Many best practices are easy to implement – invaluable and well understood by software engineers, but often ignored by actuaries.