What makes a language Object-Oriented?

后端 未结 15 2211
无人共我
无人共我 2020-12-07 17:01

Since debate without meaningful terms is meaningless, I figured I would point at the elephant in the room and ask: What exactly makes a language \"object-oriented\"? I\'m no

15条回答
  •  误落风尘
    2020-12-07 17:33

    In my experience, languages are not object-oriented, code is.

    A few years ago I was writing a suite of programs in AppleScript, which doesn't really enforce any object-oriented features, when I started to grok OO. It's clumsy to write Objects in AppleScript, although it is possible to create classes, constructors, and so forth if you take the time to figure out how.

    The language was the correct language for the domain: getting different programs on the Macintosh to work together to accomplish some automatic tasks based on input files. Taking the trouble to self-enforce an object-oriented style was the correct programming choice because it resulted in code that was easier to trouble-shoot, test, and understand.

    The feature that I noticed the most in changing that code over from procedural to OO was encapsulation: both of properties and method calls.

提交回复
热议问题