November 12, 2002
The principle of least privilege

A very interesting post, nay, essay from the martellibot on The principle of least privilege vs. public by default, taking in the Waterfall methodology, Eastern European politics and Wittgenstein en-route.

It's in the Python newsgroup, but it's applicable to any development environment, and the code samples are in multiple languages.

The only Python thing that you need to know is that object members prefixed with a single underscore (_likeThis) are 'private by convention'. That is to say - there is nothing to stop you accessing or modifying these members, but the onus is on you to know what you are doing.

Members prefixed with a double underscore (__likeThis) really are private. You cannot access or modify these members through the normal mechanisms. (There are still ways of getting at them, but you really better know what you are doing.)

Alex argues that 'private by convention' is A Good Thing.

Posted to Software development by Simon Brunning at November 12, 2002 12:52 PM
Post a comment

Email Address:



Remember info?