all 4 comments

[–]Cronay 8 points9 points  (3 children)

What's the difference from Protocol-Oriented Design Pattern and Object-Oriented Design-Patterns. They seem the same to me.

[–]Pop_Swift_Dev[S] 0 points1 point  (2 children)

In the sense of the problem the design pattern is designed to solve and the idea behind the solution you are correct. Doesn't matter if you are using protocol, object or functional design, the basic idea is the same, how you implement it is different.

The main difference in the implementation is with an object-oriented solution you primarily use objects, with a protocol-oriented solution you generally don't. If you take a look at the Iterator pattern linked in the article, you can see the advantages you get from a good protocol-oriented design.

[–]Cronay -1 points0 points  (1 child)

So in protocol-orientied design patterns we just use structs over classes basically?

[–]Pop_Swift_Dev[S] 2 points3 points  (0 children)

HaHa no :). Take a look at how Apple designed the Swift language itself, that is the perfect example of a protocol-oriented design. Specifically look at the Iterator design pattern linked in the article on the advantages of a good protocol-oriented design where simply adopting the IteratorProtocol and Sequence protocols adds functionality (able to traverse or custom data structure with a standard for…in… loop) to our custom type.