开发者

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 开发者_Python百科better to procedural/structural programming.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜