• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A reflection about Controllers getting fatter in CI4

#1
(It's a sunny morning with a cup of coffee on the veranda so please forgive this philosophical post)
Been working on my brand new shiny CI4 project for a couple of days now and it's shaping up rather nicely. This project is a planned new REST-based backend for an old monolithic web-project created eons ago. The new UI is made in Sencha ExtJS 7.0.0-EA so it's bleeding edge both frontend and backend.

I have been using CI3 for many projects and consider myself rather fluent in how it works. Looking back at the CI4 project so far I notice a big shift in how I code CI4 compared to CI3 and notably that my Controllers are "fattier" than in my CI3 Controllers. With CI3 I adopted the "thin Controller - fat Model" approach where the Controller basically only called functions in the Model. The Models' code got pretty lengthy but kept the notion of working on the data while the Controller mainly checked input and access. In CI4 I now have lengthy database code that should have gone into the Model in CI4.

Don't get me wrong - I sort of like the new Model in CI4 but it is too much pixie-dust sprinkled over them. With all this magic going on I don't feel confident to add code in the Model that may upset the delicate machinery, breaking things. The (imagined?) one-to-one mapping between a Model and a database table may be part of my thinking around this. The mixing of the Query Builder and the Model is another thing that really scares me and I tend to use the Query Bilder completely separate from the Model.

All my hesitation might be just me over-thinking stuff but we need to deliver a fast and reliable solution to our customers and users and I need to feel as confident with CI4 as I did with CI3.

A big thank you for moving CI4 forward!
/Mattias
Reply


Messages In This Thread
A reflection about Controllers getting fatter in CI4 - by tgix - 08-13-2019, 12:09 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.