From the course: iOS Lean Controllers: 1 Setup, Persistent Data, and Implementation

What is a lean controller?

- [Instructor] So in the previous lecture, we learned about what exactly does it mean to say this is a massive view controller, and in this lecture, we are going to talk about what exactly is a lean controller? Now, first things first. A lean controller is not really about reducing the number of lines. It's more about composition, it's more about putting the components in the right place, in the right order. Take a look at this very simple example of a massive controller. Now, a massive controller looks kind of like this. It might be setting up a database, initializing the database, creating user controls, fetching the records. All of these things are going inside the view controller. You cannot reuse them. If you have to reuse anything, you have to create a massive view controller, or the view controller, and then start using that. So we have to change it in a certain way that all of these things, setting up the database, creating user controls, fetching records, are small components that can be used in different view controllers. And that is what the whole course is about. The course is not about how you can reduce your 200 lines of code to 150 or 100 lines of code, no, that's not what we are talking about. We are talking about how we can put the things in their correct place. There is a place for everything, and everything has its own designated place.

Contents