I am creating a web application using PHP. I am doing my best to implement an MVC structure based on my understanding. I am not using a framework such as Laravel, etc.
Currently I am implementing it with the Controller as procedural and the Model and View as OOP with classes etc. The controller of course will instantiate and utilize the objects of the model and view, but other than that the controllers themselves are strictly procedural.
Is this a perfectly fine implementation? Or is there a benefit to making the controllers OO as well?
Update:
I think some people were confused as to what I meant by procedural programming. Basically, what I meant is that the controller does not use the class
keyword. Whereas the model and view components are themselves classes. While the controller itself operates in a procedural fashion it does use the new
keyword to instantiate the view or model and makes use of those objects. For further clarification Wikipedia provides a brief article on the differences between procedural and object oriented programming.
If you need further clarification please just ask rather than downvoting.
If this update helps clarify things please vote to reopen the question. If the question is not clarified please let me know what is not clear.
Is this a perfectly fine implementation?
. We can't tell because we haven't seen any code.Or is there a benefit to making the controllers OO as well?
There is a benefit to making everything OO and if you've already done such programming as I assume you have you'd already know the advantages of OOP over procedural programming. – Alternatex 2 days ago