Search code examples
phpmodel-view-controlleroopprocedural-programming

Is it ever justified to write a fairly large, database-centric PHP app procedurally and without MVC?


Sorry for the rather subjective question, but I was hoping to get an opinion from someone more experienced than myself on this.

I'm pretty far into an ajax-driven PHP application and, while I have pretty good separation between markup and behavior on the client side, my PHP is slowly becoming a bit of a mess. I'm doing alright so far breaking it up into parts and structuring in a way that I don't have too much repetition, but I'm definitely beginning to see how this can become a burden with enough code. So I've been reading about OOP and MVC and now I'm trying to decide whether it's worth refactoring for CodeIgniter or Kohana. Intuitively, it feels like this would be more work than it's worth, but I know I may be singing a different tune in a little while.

In your experience, is it considered absolutely hackish to write a serious application procedurally today, or are there certain kinds of applications that lend themselves better to procedural/structural programming.


Solution

  • MVC and OOP are just "ways", amongst others. Yes, they are great, facilitate good struturation of code, and are used a lot, but they are not the only way you can develop an application.

    For instance, Drupal is not using any kind of Object-Oriented code : it's all procedural... And it's a big application, that has lots of success, is used by many people, even on big sites, and for which many people have developped lots of modules... even if it almost doesn't use any class/object !

    I, personnaly, would go with MVC and/or OOP for almost any kind of new application ; just because I know those and they are helpful -- but those are not required when it comes to developping a great application : they help, but you can still have some crappy code if you don't behave when programming ^^