Hot Koehls

The more you know, the more you don’t know

This content is a little crusty, having been with me through 3 separate platform changes. Formatting may be rough, and I am slightly less stupid today than when I wrote it.
03 Feb 2009

No "private" setting in open source

I love the PHPMailer system. Straightforward, effective, very well documented and supported. It’s everything that a piece of software should be, and best of all it’s free. The parent company, codeworx Technologies, supports and maintains a piece of software used by millions of sites for free, and gets a ridiculous amount of exposure in return. Win-win. I came across the only beef I have with their code just the other day, and it illustrates a larger issue with open source projects as a whole. Fwd:Vault uses PHPMailer to send all its outgoing messages. I want to keep a log of all outgoing messages, so I extended PHPMailer to store a copy of the message in my database. When I ran the code, I found that the “To:” address was not getting stored along with the rest of the data. I had probed the core PHPMailer class and found the variable containing this information, but had failed to check its scope, which was set to <a href="">private</a>. I changed this to public and I was good to go. But should I really have been forced to make this extra step? I had taken the time to go through their code to find what I need and use it to meet my needs. What interest is it of the developer that I use his/her code in a way that they do not “condone?” Even if I break functionality, it’s my problem to solve it. If you write something with the intention of releasing it to the world, you must assume that no part of it will be hands off. Developers declare classes and variables as private, protected, and final when they don’t want other people playing in their sandbox. Practically speaking, you make it more difficult for others to utilize the code you’ve has written, which seems to conflict with the intention of releasing it in the first place. The practice also runs counter to the very nature of open source, which is that all information is free and clear. Unless the structure of your code demands specific scope settings — those situations are extremely rare — show some faith in your fellow devs and save them the extra step of unlocking your code. There’s enough work to do without making it difficult for ourselves.

comments powered by Disqus