Cardale Posted February 24, 2008 Share Posted February 24, 2008 Are there alternatives to MVC out? What are some good ones? Quote Link to comment Share on other sites More sharing options...
Liquid Fire Posted February 24, 2008 Share Posted February 24, 2008 I know know of any, most people either use MVC or not that i know. Quote Link to comment Share on other sites More sharing options...
Cardale Posted February 25, 2008 Author Share Posted February 25, 2008 damn thats it huh? Quote Link to comment Share on other sites More sharing options...
trq Posted February 25, 2008 Share Posted February 25, 2008 I'm not sure you understand what MVC is actually. Put simply it is a design pattern, nothing magic. There may be different approaches to similar things but I wouldn't go calling them an alternate. Quote Link to comment Share on other sites More sharing options...
Cardale Posted February 25, 2008 Author Share Posted February 25, 2008 I know your super knowledgeable and everything, but it being a design pattern a alternative would be a design pattern that isn't MVC. Correct? Other good design patterns out there? Quote Link to comment Share on other sites More sharing options...
dbo Posted February 25, 2008 Share Posted February 25, 2008 If you're looking for an approach for building web applications, then MVC is the most well known, and probably the most natural way of accomplishing this. It just makes sense to separate the data layer, from design, from business logic, which is what MVC attempts to accomplish. If you're looking for more general design patterns that just promote good application development, ease of maintenance, etc etc. I was actually just reading through this article the other day. It may provide a good overview and help get you thinking along some new lines. Please post any new thoughts/questions as they come up, as debates and rants on the topic prove to be quite insightful. Here's the link: http://www.ibm.com/developerworks/library/os-php-designptrns/ Quote Link to comment Share on other sites More sharing options...
Xeoncross Posted February 26, 2008 Share Posted February 26, 2008 I know that sometimes (when I am tired) I design my stuff without the controller. (Model + View + Controler = MV) hehe Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted February 27, 2008 Share Posted February 27, 2008 I know that sometimes (when I am tired) I design my stuff without the controller. (Model + View + Controler = MV) hehe I don't think you understand the MVC pattern. If you only have a model and a view then you're essentially doing nothing. Quote Link to comment Share on other sites More sharing options...
Liquid Fire Posted February 27, 2008 Share Posted February 27, 2008 I know that sometimes (when I am tired) I design my stuff without the controller. (Model + View + Controler = MV) hehe I don't see how you could do that becuase whatever else you create to link the model to the view is going to be a controller. i mean use could just do a view and controller or even a model and controller but not a view and model. Quote Link to comment Share on other sites More sharing options...
koen Posted February 28, 2008 Share Posted February 28, 2008 http://www.martinfowler.com/eaaDev/uiArchs.html Quote Link to comment Share on other sites More sharing options...
Xeoncross Posted February 28, 2008 Share Posted February 28, 2008 (when I am tired) I design my stuff without the controller I don't think you understand the MVC pattern. If you only have a model and a view then you're essentially doing nothing. hehe... that's the point Read my post again. Quote Link to comment Share on other sites More sharing options...
fireMind Posted February 29, 2008 Share Posted February 29, 2008 Yea, really if you try creating any large-scale applications in PHP, you're more than likely to quickly realize the strengths of the MVC approach to things. Of course, with PHP the seperation between the view and controller is much less clearly defined (html view/controls; obviously seperating the controls from the layout is possible but might be more burdensome a task as far as agility is concerned than is worth the while), but nonetheless it's an excellent methodology to use for developing applications. Consider Ruby on Rails, basically an MVC-generating platform for web applications. In RoR, the Model and View were realized to be so closely intertwined as to have lent to the creation of the 'ActionPack', which is basically both in a nutshell. Anyway, I'm kind of ranting but I was really wondering, if not MVC what is it you're looking for more of? Just ideas in general/brainstorming or is there something lacking you're looking for? Personally, as of late I've found that MVC works quite well, especially for internationalization and AJAX/non-AJAX platforming via the controller seperation. The classes get quite hefty in function name/number once you start breaking everything up view-/controller-wise, but it really does work well as far as scalability and manueverability once the projects get large. Anyway now I'm just ranting. Hope this sparked some thought Quote Link to comment Share on other sites More sharing options...
Cardale Posted March 1, 2008 Author Share Posted March 1, 2008 Well I was just reading about MVC and I wish everyone could sum it up in about three sentences instead of endless paragraphs and code and bull. I just wanted to expand my understanding of where this is coming from and if any other design ideas existed. That article from IBM was good. Now I'm starting to notice a few comments about that being factory and that being what ever. I guess I'm just trying to move my understanding from coding little individual snippets to coding large scale projects on top of learning new PHP5 features. Is MVC basicly Model = The generic functions that need to be performed V = The template C = The controller is the handler of the model aftermath? What is it summed up in a nice little paragraph Quote Link to comment Share on other sites More sharing options...
trq Posted March 1, 2008 Share Posted March 1, 2008 I wrote this small example for someone a while ago, that might help a bit. Its not meant to be working code (never tested it) so I wouldn't ry it, but it might give you an idea. I still stand by what I said in that thread. Download the codeigniter framework and follow there 'Getting Started' guide, it will all make sense. Quote Link to comment Share on other sites More sharing options...
Cardale Posted March 2, 2008 Author Share Posted March 2, 2008 I think I understand. How do you decide whats what in terms of each logic type? I think thats what I will struggle with most. Model = Database Information or just database connection? V = The Presentation having multiple presentation classes for each individual object is good? or just one generic? One generic would be faster but might limit? C = The interpretor the actual application our little modules? Shouldn't it be MCV? Quote Link to comment Share on other sites More sharing options...
trq Posted March 2, 2008 Share Posted March 2, 2008 Shouldn't it be MCV? The way I look at it, it probably should be CMV. The controller is the entry point to the application, it is the file the client actually requests. Theres usually two controllers (as in my example). The front controller is the entry point and it takes the parameters passed to it and decides which action controller to execute. The action controller is then responsible for making requests to the model, the model then sends data back as a response. This data is then merged into the view then the view is sent back to the client as the finished product. Again I say, I am no expert in this field, and this really is my own interpretation of the pattern. It can be implemented in a few different ways I suppose, and I'm sure it could also be done without the action controller that I used in my example. I'll also say again that I think its a really good idea if you are interested in seeing the benefits of this pattern in action to download one of the already existing MVC frameworks and doing a few tutorials using it. I suggest code igniter because it is small, the code itself is very easy to follow and you set it up and read through there 'Getting Started' guide in a single afternoon. I've never actually used codeigniter for anything, but played around with it for a few days prior to starting to build my own framework. Of course, all this talk of frameworks.... you don't necessarily need any framework to implement the MVC pattern, you can use a simple MVC implementation in allot of small/simple web apps. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted March 2, 2008 Share Posted March 2, 2008 Model = Database Information or just database connection? Not necessarily a database, but just the data layer. You could be reading from an XML file or you could be parsing an RSS feed from an external source (well, that's actually reading from an XML file as well, but whatever) for instance. In the MVC pattern you'll never access the data directly from outside the model because it's encapsulated within the model. The front controller is actually not a part of the model-view-controller pattern, but rather another pattern itself. However, you'll often see that pattern used with the MVC pattern as you'll need something to call the controller in MVC, and I suppose the front controller is the most convenient way of doing it, at least in a web environment, so you'll often see the front controller acting as an intermediate between the user and the controller in MVC. Quote Link to comment Share on other sites More sharing options...
Cardale Posted March 8, 2008 Author Share Posted March 8, 2008 Now that I'm getting deeper into MVC it seems like a few basic classes are pretty helpful like a loader for models and controllers which is actually a controller if your using a framework to load them....its kind of confusing but its working pretty well although adding all this makes coding way more confusing. Quote Link to comment Share on other sites More sharing options...
Jenk Posted March 11, 2008 Share Posted March 11, 2008 You either use MVC, or you don't. You don't have to use anything. MVC is a design pattern, a guide for a commonly occuring situation or scenario. If you are setting out to design an application with MVC, you have already caused yourself problems as you do not yet know if MVC is right for your situation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.