tags:

views:

82

answers:

8

I used to develop websites using php . I like to learn some framework using php.

So I like to know how effective MVC is ?

Is this easy to learn ?

A: 

MVC is a very good design pattern for developing applications. It allows you clear separation between the views, the data access and processing logic which will result into more maintainable code.

Darin Dimitrov
A: 

Obviously learning MVC is going to be different for each person. My recommendations would be to read everything you can on MVC/PHP-MVC/PHP OOP that you can and then try to write your own framework. Then rewrite it using the things you learned the first time. Repeat.

Galen
+1  A: 

MVC is a way of organizing code that seems uniquely well suited for web applications. You'll have to organize your code in some particular way, try MVC and see if you like it. It's also the de-facto standard in web app design, so it makes your code easier to understand for other programmers.

It helps me minimize mixing languages -- views contain all the HTML, models all the SQL, and controllers describe and handle the API and support code (like authentication).

Pies
A: 

Few of the major PHP frameworks implement MVC. Most use some variant of "Passive-MVC" or "Model-View-Presenter". They're following the concept, not the actual MVC pattern (which is a runtime organization for graphical apps, not for generating page output).

That's not to say the PHP interpretation of the concept doesn't bring any benefits. It's commonly believed to provide a better structure for large or growing web apps. It's less useful for implementing simple tasks.

mario
A: 

I guess everything that was to be said about MVC was said already... so I'd like to point you to a good PHP framework to start with, should you decide to go with MVC - CodeIgniter. It's probably the easiest one to start with if you never used MVC before.

Smejko
A: 

I have to say that when I first tried to get my head around MVC I had a great deal of difficulty (especially being someone who is self-taught and started with PHP). Put most simply, and most valuably for me, MVC is a good way to organize your code. It provides a template for separating the different layers of your application, which again sounds confusing, but actually isn't. (Again, this is meant to be an explanation of why MVC is useful and how to get started with it, not how it functions ... which I don't totally understand.)

First off, one really simple way to think about it is to compare it Wordpress (this is assuming you've played with Wordpress). Views function in much the same way as "themes": They are a simple way to combine presentation markup with whatever data is being pushed out to the page.

Models describe (and can interact with) the database.

Controllers do everything in between. (Calling functions in models, loading data into views.)

But it's also important to note that you can use MVC in any way you want to. While the idea is to get you to use a specific organizing pattern, no one is going to stop you from doing it in whatever way works best. I know quite a few folks who forgo models altogether and just use Controllers/Views to do everything they need. I found CodeIgniter to be pretty easy to get up to speed on, and now that I've got the hang of it I find it incredibly useful for both the functions the framework provides, but more importantly, the organizing that MVC forces me in to.

Hope that's helpful.

Noah
It's really help me .
gowri
A: 

Just to add to all the wonderful answers given about MVCs, an MVC framework will do all the basic work for you and it helps save time. You'd be working on things custom to a particular project like its business logic intead of the basic Create, Read, Update and Delete functions.

Nigel
A: 

@gowri

You can try with any php frame work. You are at initial stage so start learning codignator or cakephp. Both have good documentation and support. I recommend you codignator. Easy and good mvc.

Jai
what's difference between codignator and cakephp
gowri