I recently rediscovered this article during an excellent discussion brought forth by Adam’s Stream
! The question was about the use of private extension functions. I’m usually prone to using extension functions only when I can’t directly change the receiving class (Hello,
However there are some interesting advantages to using private extension functions, the main one being Context specific perspectives. Basically, code that uses an object can have it’s own, localized understanding of how to use that object. The model object and other contexts do not need to know about this functionality so can it makes sense to keep it close to where it is used.
Despite all of this I’m still not totally sold on the concept. My main concern with private extension functions is testing. They introduce functionality that can’t be easily tested.
What are your thoughts on this? I’d love to hear them!
Special thanks to Tyler McGraw
for discussing this at length with me last week!