[Swift] POP - Retroactive Modeling

So you write some classes and structures as we cool developers do.

And later, you need another class similar to the class you have written 3 month ago.

Retroactive Modeling, a dope technique available with Protocol Oriented Programming, is what you can use on that case, reusing written codes with additional features.

Let’s say, the president Joe Biden is in thanksgiving event and a turkey is on the table.

And then suddenly turkey on the table tries to flee and the president to catch it by himself because he was so hungry and we wanna know whether he’s gonna catch it or not.

So we make the both classes conform to the protocol Speedometer

And then finally we would be able to know he’s gonna catch or not.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store