Hacker News new | past | comments | ask | show | jobs | submit login

I thought the central point of OOP was to encapsulate functions ("methods") and the data ("objects") they operate on, thereby providing a way to structure code? That's why it's called "Object Oriented Programming" and not "Polymorphism X Y".

Wikipedia at least seems to agree with me.




I think one problem that people have when they are talking about object oriented (or FP for that matter), is that there isn't a clear definition around what it means. Most developers agree that it is some mix of encapsulation, polymorphism and inheritance.

There is a lot of disagreement about which of those is more important. For me polymorphism is the most important, encapsulation is useful sometimes, and inheritance might be a negative attribute. For you encapsulation.


I had that revelation at my college Lab, teacher discussing why OOP was such a beautiful thing, none of them could agree on definition of OOP nor the qualities.

FP is smaller and stricter, it's almost formally defined (you have denotational semantics for FP VM for what it's worth).


That is only in the case of OOP as introduced by Smalltalk.

For example, OOP with multi-methods, does not imply such encapsulation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: