Skip to main content
10 events
when toggle format what by license comment
May 9, 2016 at 17:16 comment added CodeYogi So, generally speaking implementation details could be data or private methods and encapsulation is to what extent we can hide those details behind client's why, in that case its more of an art than science right?
May 9, 2016 at 17:11 comment added amon @CodeYogi Data hiding is the most common kind of encapsulation. However, the way data is stored internally by an object is not the only implementation detail that should be hidden. It's equally important to hide how the public interface is implemented, e.g. whether I use any helper methods. Such helper methods should also be private, generally speaking. So to summarize: encapsulation is a principle, whereas data hiding is an encapsulation technique.
May 9, 2016 at 16:54 comment added CodeYogi Whats the difference between encapsulation and data hiding?
Mar 18, 2014 at 13:55 comment added OrangeDog "Objects are a pairing of methods and data" would do. All you need is something that has nothing to do with immutability.
Mar 18, 2014 at 13:36 comment added amon @OrangeDog Yes, there is no universally accepted definition of OOP, but I needed a definition to work with. So I picked something that is as close to the truth as I could get without writing a whole dissertation about it. However, I do regard dynamic dispatch as the single major distinguishing feature of OOP from other paradigms. Something that looks like OOP but actually has all calls resolved statically is really just modular programming with ad-hoc polymorphism. Objects are a pair of methods and data, and are as such equivalent to closures.
Mar 18, 2014 at 13:25 comment added OrangeDog Dynamic Dispatch is not a core feature of OOP. Neither really is Encapsulation (as you already admitted).
Mar 18, 2014 at 2:34 vote accept Hyperboreus
Mar 17, 2014 at 20:13 history edited amon CC BY-SA 3.0
clarification
Mar 17, 2014 at 19:58 comment added Hyperboreus Thank you very much, especially for the definition of the two core features.
Mar 17, 2014 at 19:54 history answered amon CC BY-SA 3.0