Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How are modules and namespaces OOP?


To me OOP is about separation of concerns, abstract data types, information hiding. Modules/namespaces support decomposition the same way that objects do, and historically they became popular because of and in tandem with object-oriented languages. So it's true as others have pointed out that they can and do exist in other paradigms; I would argue that is evidence of the influence of OOP and the fact that its best ideas have been incorporated all over the place.


Those are just good programming principles in general though. Abstract data types, information-hiding, and separation-of-concerns were being done in C well before OOP was a thing. Granted, the information-hiding wasn't as sophisticated as it got once OOP was introduced, but I don't think it makes sense to attribute information-hiding to OOP as a result, especially since newer programming language have used visibility attributes in the absence of OOP classes.


Some would say abstract data types are not OOP -- OOP is defined by how it's different from ADTs: https://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf




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

Search: