views:

96

answers:

2

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.

+6  A: 

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 ^^

Pascal MARTIN
+1 for the open point of view!
RageZ
Thanks. I think that's what I needed to hear before a I screwed everything up in some misguided attempt to make it better. Next project I start, I will definitely give OOP a shot, but I think I've done so much with a different approach in mind that it would be counterproductive to hack it all apart and start over at this point.
Greg
@RageZ : thanks ;; @Greg : if you have a huge existing code-base, not re-hacking it to *try* making things better is probably better -- at least speaking of short-term (and it doesn't prevent you from using OOP in some new parts of your application, when needed)
Pascal MARTIN
http://drupal.org/node/547518
HeavyWave
+1  A: 

I can't remember the last time I've seen any large, serious application that was entirely in one paradigm of programming, even OOP. (That is, if "object-oriented" was a single uniform thing.)

I wouldn't worry in the least if a program didn't use OOP, but I would be a bit concerned if it only used one paradigm. (I'd probably be more suspicious if it didn't use functional programming at all.) No large task is entirely homogeneous, so if you're trying to use one paradigm for an entire program, it's probably a great fit in some areas and a poor fit in others.

Ken
I'm not a very good programmer, to be honest, but I'd like to think that I'm a quick learner and I try to assimilate any clever approach that I come across. So far it's been kind of "improvisational programming." :) Which I guess is a nice way of saying I don't know what the hell I'm doing -- but it's slowly coming into focus as I figure out by trial-an-error what works best where and when I just need to be consistent and organize. I'm learning. SO's been a lot of help.
Greg