Module 10: Object-oriented Programming

One more week until Easter break!
This week we had an intensive one-week course on C++. Since I have used C++ in one of my previous projects, I opted to do the assignment straightaway. It was on class inheritance for different Ordinary different equation solvers, and running CxxTest to assert warnings if the code failed to behave as expected – according to the instructions given on the assignment (one should be reminded that, even when the code runs, ie. when miracle happens, it might not run according to the specification as we thought we had coded). It was fairly useful suite if you know what you should expect (in my case, the boundaries/end points data).

After that I built a class of Matrix, and Mesh, in an attempt to implement the Finite element method on a simple $m \times n$ grid, with Laplacian equation. Still some work to go before I can visualise it nicely, but it becomes more apparently how I am supposed to build an FE solver from scratch. Admittedly there are many FE solvers/libraries in all kind of programming languages, but it is undoubtedly useful to build one from scratch as a programming exercise.

I have also started reading up for my first rotation, which source code is also in C++. What prompted my interest is that, engineers, mathematicians and computer scientists code in very different styles and one can certainly tell just by reading through their code. This was indeed my first time reading a professionally written code – by a computer scientist. I did learn something new: some inbuilt commands which are more memory efficient; some syntactically smart lines; although documentation was… less apparent.

It has been a flexible week for me to improve upon my existing knowledge and to crash computers in ways that trigger memory allocation problems etc. A big part of programming, to me, is simply troubleshooting. As a person who jumped straight from “C++ for dummies” to reading/working with/debugging the medical image analysis software suite (and befriending StackOverflow), I appreciated that this week turned out to be a rather spontaneous week for me to consolidate what was missing in between the beginners and advanced level of C++ programming.

Now, after coding in a proper way, it is time to speed up the execution of code by – high performance computing. The HPC module next week would mark the end of our training period. In less than a month’s time, we will be scattered across the campus, working on our real and cool research!