4.7. Conclusion

In this chapter, you built the vast majority of a working web site in just a few days. The major controller functions, models, and views enable you and the client to see what's happening and iterate quickly.

As you continue your CodeIgniter career, keep the following points in mind:

  • In most cases, it's useful to work incrementally. Creating bare-bones controllers and models, and then changing them as requirements and needs dictate, is perfectly OK.

  • It's always helpful to think logically about the division of labor within your application. If you're dealing with data, create a model (remember that session data are data — they don't have to live in a database table!). If you're dealing with application flow or logic, make sure it's handled in the controller. If it involves something the user can touch, see, or interact with, put it in the view.

  • When in doubt, always remember that things should never get complicated, even if the problem at hand is complex. If you find yourself repeating functions in code, then it's time to abstract it into a model or even a private function in the controller. In the following chapters, you are introduced to private functions, helpers, and libraries.

Get Professional CodeIgniter® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.