Earlier quoted context omitted.
Central to OOP is message passing between objects. Few languages utilize message passing, so it seems you can decouple components without OOP just fine.
>Few languages utilize message passing Yet most of them call themselves object-oriented! I'm reminded of the Alan Kay quote, "I invented the term object-oriented, and I can tell you that C++ wasn't what I had in mind."
C Object Oriented Programming (2014)
31–40 of 61 posts
Re: C Object Oriented Programming (2014)
#32Earlier quoted context omitted.
>Few languages utilize message passing Yet most of them call themselves object-oriented! I'm reminded of the Alan Kay quote, "I invented the term object-oriented, and I can tell you that C++ wasn't what I had in mind."
Is Smalltalk’s message passing really all that different from methods from other OOP languages? Seems like quite an arbitrary distinction to me.
While not completely identical to Smalltalk's message passing design, the Qt project once went to all the trouble of building their own compiler just to be able to graft message passing onto C++. I think that goes to show that there really is a difference – otherwise, why not use the standard constructs C++ offered?
Whether or not that difference makes for better software is debatable. It does seem that at one time it did lend itself exceptionally well to GUI programming. NeXTSTEP/macOS/iOS also would never have been what they are without OOP. But we've also learned some programming tricks along the way, so it may not even shine there anymore. Swift, for example, has given up on OOP (except where @objc mode is enabled) and it seems like it manages to do quite well with GUIs (granted, having @objc mode to fall back on clouds that somewhat).
Re: C Object Oriented Programming (2014)
#33Earlier quoted context omitted.
Is Smalltalk’s message passing really all that different from methods from other OOP languages? Seems like quite an arbitrary distinction to me.
All OOP languages use message passing, but perhaps you mean languages with objects that are not oriented? While not completely identical to Smalltalk's message passing design, the Qt project once went to all the trouble of building their own compiler just to be able to graft message passing onto C++. I think that goes to show that there really is a difference – otherwise, why not use the standard constructs C++ offer…
Afaict the difference between Smalltalk and Objective-C style message passing and Java and C# style method calling is purely syntactic.
Re: C Object Oriented Programming (2014)
#34Earlier quoted context omitted.
All OOP languages use message passing, but perhaps you mean languages with objects that are not oriented? While not completely identical to Smalltalk's message passing design, the Qt project once went to all the trouble of building their own compiler just to be able to graft message passing onto C++. I think that goes to show that there really is a difference – otherwise, why not use the standard constructs C++ offer…
I mean that, to me, the difference between message passing and method calling is not significant enough to say that these languages are following different programming paradigms - like you say OOP vs languages with objects. Afaict the difference between Smalltalk and Objective-C style message passing and Java and C# style method calling is purely syntactic.
doesNotUnderstand:/forwardInvocation: isn't different? That is not just syntactical. How would you even begin to orient your objects without like functionality?
I agree that if you squint really hard they look the same. But if we say "they are all the same", what are you trying to communicate when you say OOP? Virtually all programming languages we use have objects. You may as well drop the OO and just use "programming". It would communicate the same intent.
Re: C Object Oriented Programming (2014)
#35Earlier quoted context omitted.
>Few languages utilize message passing Yet most of them call themselves object-oriented! I'm reminded of the Alan Kay quote, "I invented the term object-oriented, and I can tell you that C++ wasn't what I had in mind."
Is Smalltalk’s message passing really all that different from methods from other OOP languages? Seems like quite an arbitrary distinction to me.
Re: C Object Oriented Programming (2014)
#36Earlier quoted context omitted.
Is Smalltalk’s message passing really all that different from methods from other OOP languages? Seems like quite an arbitrary distinction to me.
Yeah, the callee doesn’t have to have the method defined for it to be called and Smalltalk objects have a default you can use to do things with messages you don’t handle for example forward them on to another object.
Re: C Object Oriented Programming (2014)
#37One advantage to this approach is that there is less compiler magic going on. I use a similar approach, but I prefer using type safe upcasting or model checked downcasting via inline functions or explicit references to base members, instead of direct C style casting. This also makes it easier to develop a uniform resource management strategy with allocator abstraction. Being able to easily switch between tuned bucket…
The biggest advantage of C-style polymorphism vs, say, C++ is that it actually offers much better encapsulation. Having private methods declared in the header file which is supposed to be the public contract for the class is such an anti-pattern. And the usual solutions offered for this problem are ugly in their own right (*pImpl). I only properly learnt to appreciate the power and beauty of OOP by reading people’s C…
Plus that same C pattern compiles in C++ without problems.
Re: C Object Oriented Programming (2014)
#38I had the great fortune to work briefly on the MS Word codebase, and I remember some ancient C code that manually implemented vtables. Probably not uncommon for that era.
Re: C Object Oriented Programming (2014)
#39Earlier quoted context omitted.
The biggest advantage of C-style polymorphism vs, say, C++ is that it actually offers much better encapsulation. Having private methods declared in the header file which is supposed to be the public contract for the class is such an anti-pattern. And the usual solutions offered for this problem are ugly in their own right (*pImpl). I only properly learnt to appreciate the power and beauty of OOP by reading people’s C…
Which C++ modules fix. Plus that same C pattern compiles in C++ without problems.
Re: C Object Oriented Programming (2014)
#40>Object oriented programming, polymorphism in particular, is essential to nearly any large, complex software system. Without it, decoupling different system components is difficult. (Update in 2017: I no longer agree with this statement.) The author doesn't seem to elaborate on this. I was taught OOP in university and then promptly learned that it's frowned upon in performance sensitive code, which is my main interes…