What is protocol-oriented programming?

1

I wonder, what is protocol-oriented programming? I heard a teacher comment on this type of programming, about this paradigm, but it was a bit vague.

    
asked by anonymous 29.09.2017 / 04:51

1 answer

4

It is vague because there is no formal definition, it is not universally accepted. Swift is a language that uses protocols to generalize operations, and in the background protocols are interfaces in other languages, with small differences. So the term refers to this, which is strange because just one mechanism naming a whole paradigm seems to me exaggerated, so outside of the domains of Apple languages nobody talks about it. Objective C also uses.

The protocol is like an interface with standard implementations, more or less as they occur in Java 8, Kotlin and C # 8. It is a limited form of inheritance and polymorphism, almost like a trait . But it goes further and works as an extension of types by value.

    
29.09.2017 / 11:32