December 19, 2002
Encapsulation gotchas

The mutable return value gotcha mentioned in Avoid these simple Java encapsulation gotchas certainly isn't specific to Java - the same would apply to Python, and (I think) to C#.

Now, as a Python-head, I'm not big on enforcing encapsulation - see The principle of least privilege. But you certainly don't want to break encapsulation by accident, and mutable return values are an accident waiting to happen.

Posted to Software development by Simon Brunning at December 19, 2002 04:09 PM
Post a comment

Email Address:



Remember info?