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

There are "Blub" languages which are such that if you don't use inheritance to connect two record types T1 and T2, either to a common supertype S, or to each other, then T1 and T2 are not substitutable. The users of these languages came up with the term "object based" for that situation in order to try to linguistically connect that to object-oriented programming somehow.

In real OOP, we don't have to use inheritance for objects of different types to be substitutable, so "object based" doesn't exist as a separate phenomenon. We use inheritance when two or more things are internally similar, such that they can share a chunk of implementation. If things are similar only externally (API level) but have totally different internals, then we don't use inheritance.

OOP is happening when we substitute objects of different types into the same code and they work, regardless of whether those objects are related to each other by inheritance.

"Object based" is when we cannot do that.

It's basically a new (or not so new any more) term for "abstract data type" which is used when the abstract data type language supports obj.function(arg) syntactic sugar.

If we take Wirth's Modula-2 or Pascal exactly as-is (two languages exemplifying abstract data typing support) and then add the "obj.function(arg)" sugar, they suddenly become "object based".



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

Search: