cryptoizotx avatar

S O L I D Principle Rules in iOS

cryptoizotx

Published: 10 Nov 2018 › Updated: 10 Nov 2018S O L I D  Principle Rules in iOS

S O L I D Principle Rules in iOS

  • The Single Responsibility principle tells us to separate responsibilities. But to know what these responsibilities are, we have to look at the bigger picture of our app. The MVC pattern already helps us respect this principle. Its tree structure is a top down hierarchy. The view controllers, which embody the core behavior and flow of our app, are at the top;

  • the Open-Closed principle tells us to keep types open for extension when we add new functionality. You can spot violations of this principle by looking for long branching statements. You solve this by moving functionality down to lower level modules. This goes again in a top down fashion;

  • the Liskov Substitution Principle says that derived types must be substitutable for their base type. As we have seen, this is from the point of view of the code that uses such types. So it is again top-down;

  • the Interface Segregation Principle makes us split interfaces into small ones to avoid dependency between the clients of such interface. Here we look interfaces from the outside, from the point of view of a client. Top-down again;

  • the Dependency Inversion Principle is the one that most explicitly states its top-down approach. It says that high-level modules dictate the interfaces of low-level modules. These interfaces, in turn, dictate the structure of the code in the low-level modules.
    Source iOS Architect

Leave S O L I D Principle Rules in iOS to:

Written by

Crypto Trader / Software Engineer

Read more #ios posts


Best Posts From cryptoizotx

We have not curated any of cryptoizotx's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From cryptoizotx