== Encapsulation may be in the eye of the beholder Here is an interesting question: is _getloadavg()_ a more or less encapsulated way of getting the load average than (on Linux) reading _/proc/loadavg_? I wound up thinking about this in the aftermath of [[feeling rueful about discovering ../python/DangerousObviousAppeal]] Python's interface to _getloadavg()_, and I don't think it's as simple as I made it out to be in my [[original entry ../python/DangerousObviousAppeal]]. For me, what it comes down to is different perspectives. An interface like _getloadavg()_ is nicely encapsulated for someone who can easily use the C library; you get an interface that works on any system that supports it. But for someone using alternate languages like Python, Perl, or Ruby, a file as an interface is much more accessible than a something that's wrapped up in the C library, and thus the interface it provides is much more abstract and usable. You would much rather be able to get the information by just reading a file than have it only available if you can figure out how to call a new C library function. (I would go so far as to say that a new interface that is only available by calling a C library function is not so much wrapped up in the C library as locked up in the C library.) So: from the perspective of getting the load average on a lot of different Unixes in a C program, _getloadavg()_ is more encapsulated. But from the perspective of getting the load average from a lot of different environments on a Linux system, I'd argue that _/proc/loadavg_ may be more abstracted and encapsulated, since it's available to everything and you use it just the same way in all of the languages.