3 ms·
> I'm in some programming class in france. The teacher argued that OOP and encapsulation makes programs more secure. It really felt like a political statement.
by aikah 12y ago
> I'm in some programming class in france. The teacher argued that OOP and encapsulation makes programs more secure. It really felt like a political statement.
Really depends on what he meant by secure.I'm french too.Encapsulation isnt about shipping proprietary binaries.You dont need OOP for that,furthermore,almost anything can be decompiled so your point is moot.
You'll understand when you work with a team,you'll understand the value of encapsulation, and forcing every developper to work with well defined interfaces that cannot be violated.Encapsulation makes communication easier,testing easer,it makes everything easier.
> Templates are a good extension of OOP, but it's not used that much, even while the STL justifies the existence of templates.
I would argue templates have little to do with OOP.It's a tool that allows genericity.You could have generics in a non OO language.
> It's just a coding practice, it's not some grand way to think and construct applications.
No it's a feature not a practice.The alternative is ugly stuff like in javascript where you put _ before prototype methods to express an intent. So much that ES6 comes with symbols because it shouldnt be just an intent.A developper should be able to express what he means,no just an intent(still possible in ES5,with priviledge methods but noT compatible with prototypal inheritance).
OOP is a tool,encapsulation is one of the most important things in OOP.Wether a language implement explicit encapsulation or not is of course an implementation detail.