Writing maintainable Julia code
2019-07-25, 14:30–15:00, Room 349

How to use abstractions to write code that will be easy to follow and change while also not significantly impacting performance


Have you ever updated an algorithm's code just to find that the algorithm has changed in unexpected ways? Have you ever started coding an algorithm just to think to yourself that you had already done something extremely similar for a different algorithm? These problems are often the case because code is not broken down into clear conceptual components that are independent from one another and easy to reuse.

To illustrate how this can be accomplished we will walk through the implementation of three highly similar iterative eigenvalue/eigenvector algorithms. It will be shown that each of the three iterative algorithms consists of the same main conceptual components which will be extracted into a single method used by all three iterative algorithms.

The result will be code that is easy to follow at a high level because breaking it into high level conceptual components will make it easier to read and follow. Changes will also be easier to make because finding the correct area of the code to change will be easier and there will be less risk of unexpected side effects because the other components should be independent. Finally some discussion will be made about the performance implications of introducing more abstractions and how if the abstractions are kept at the higher levels of the algorithms code it is highly unlikely that performance will be significantly impacted.


Co-authors