A Cautionary Tale on Object-Oriented Programming

For me the biggest issue with reliance on setter/getter routines to access data is the potential for a large performance hit. You are left with either a copy (and sometimes a deep one) or returning a pointer. I don’t find either option particularly attractive. Folks that push OOP on the premise that the cost of developing and maintaining code far exceeds the cost of running code so performance can take a back seat have probably never worked in an environment where human lives are at stake and you have to get correct results in as short of time as possible. No amount of savings in dollars compares with saving human life. Still most of my issues with Fortran OOP are with how it is implemented in the language and not the OOP paradigm. The issues with inheritance and run-time polymorphism were known at the time the Fortran OOP was being developed but instead of developing a facility that emphasized generics (templates etc) we are stuck with a facility that is built around inheritance instead of focusing the things that have been proven to be of the most benefit to scientific programming (generics, interfaces etc.). Hopefully, the introduction of templates in Fortran will save the language much like it did for C++ (but I’m not holding my breath until that happens).

5 Likes