What Is The Purpose Of Private?
12-Nov-2020 1938
Codebases are constantly evolving. New code gets added to implement new requirements. If we’re lucky, existing code gets renamed, redesigned, refactored and broken apart to improve clarity, simplicity, and performance. And if we’re really lucky, code eventually becomes obsolete and gets deleted.But it’s difficult to build upon code that is constantly changing. It’s like trying to build a house on shifting sand. If we write some code that calls a method, can we rely upon that method working correctly six months from now? What if someone changes the behaviour of the method in a way that we aren’t expecting? Will they realise that we depend upon that behaviour, and be careful not to break our code? Maybe. After six months, I wouldn’t even trust myself to remember.These problems incur real costs, mostly in terms of wasted developer time — for example, time spent fixing bugs in previously-working code due to changes in dependencies. But there are also nasty second-order costs like developers adopting a very defensive style of coding, due to perceiving the codebase to be fragile and unreliable in general.
What Is The Purpose Of Private? #ruby #rubydeveloper #rubyonrails #Purpose #Private? https://rubyonrails.ba/link/what-is-the-purpose-of-private