I've never been a proponent of object-oriented programming, and if anything I've grown less so the more I learn about programming in general. As I've studied different programming paradigms, I've realised that immutability is one of the central concepts of program design, affecting software written according to any philosophy. It's hugely important in functional programming, with implications in optimisation and concurrency on top of the simple safety guarantees.
Basically, everything that can be immutable probably should be, unless you've got a good reason for mutable state. In my experience, writing programs in any language in pursuit of this goal leads to safer, better code. You have nothing to lose by using
const where applicable—immutability is free!
(Incidentally, I've toyed with the idea of creating a fork of GCC for a dialect of C++ in which all types are
const unless explicitly qualified as
mutable. If there's support for such a thing, I will totally commit to maintaining and using it.)
From an OO standpoint, immutability enforces encapsulation by preventing unrestricted write access. It reduces coupling between classes because immutable objects must fully manage their own state and thus behave like ordinary values. Const correctness significantly eases the process of proving program correctness, especially in the context of concurrent programming. With C++ reference and C++0x rvalue reference semantics, you can make use of immutable objects without worrying about the overhead of copying them all over the place. Further, the compiler can work some pretty amazing optimisation magic if you're working with mostly immutable objects.
I know it sucks to type
const everywhere, but you rapidly get used to it, and the benefits become apparent over time in terms of reliability and maintainability. I'm not a brilliant writer, and it seems to be a proven difficult task to make a case for it, but I know that const correctness has been immensely helpful to me as a developer when designing and implementing programs, and I think experience is the best teacher in this regard.