Dear all,

I am new to mvc architecture Programming concepts.I have doubt that why peoples are using MVC Architecture?.What are the core benefits of using this architecture.

Thank you,

Regards,
prem2

Recommended Answers

All 6 Replies

Have you tried looking here yet?

please anyone suggest me online materials or resources, which is required to understand about MVC , i want to know about this architecture.

M - Model . Has the Data. For example a database.
V - View . Takes care of how the data should be shown.
C - Controller . Makes the data available to the view from the model.

There are many frameworks that use the MVC architecture. I can give you some examples of javascript frameworks.

1) Backbone.js
2) Ember.js
3) Node.js

The benefits is that you can build a core where all of the classes needed by your applications are included. In this core, you would have : database CRUD class, content management class, javascript class, templating class, form generator class, and many other classes that are known to be reusable by targeted applications big and small e.g. blog, cms, forum, and many others.

Having those classes in the core, we can easily build an application based on what those classes does.

Fore example, if we have a class to make all kinds of fruit juices, and we want to make an orange juices from a fresh orange, then our controller file can be something like this

 class MakeOrangeJuice extends juices_controller{
   ## since we want fresh orange and not the type of juices in our fruit juices class, we can add it here.
   private $freshOrangeOnly;

      public function __construct(){

      ## since making fruit juices are all alike.. there are always similarities on how to squeeze them, putting them in a glass, and chilling them.
      ## parent construct will be the basic methods on how to create fruit juices as defined in the juices_controller
      parent::__construct();
      $this->freshOrangeOnly = "valencia orange";
      ## we send this thing to our model page
      $this->load->model('orangejuice_model');

      }

Our model page will be the processes or procedures of making the actual orange juice

   ## this is the model

   class OrangeJuice_model extends juices_Model {
    private $quantity;
    private $quality;
    public function __construct()
    {
        $this->load->squeezer();
        $this->quantity = $quantity;
        $this->quality = null;
    }
     public function get_juiceAmount($empty = FALSE)
{
    if ($empty === FALSE)
    {
        $this->quantity = "ok";
        return $this->quantity;
    }
    else{
    ## the orange is not fresh and it is dry
    $this->quality = "bad";

    return $this->quality;

}

The view will be the actual output and result available for viewing..

    echo "This jucice has: ".$quality;
    echo "Sorry this orange has: ".$quantity."There is no orange juice for you this time. Try grape juice.";

I hope I am making even a miniscule sense out of a simple orange juice class that I made up, in order to explain this somewhat complex subject, using example in layman's terms.

Good luck and happy MVC'ing.

Thanks to all.What are coding patterns available like mvc.?

M- Model is your database layer
V- View is your front end i.i. displayed to the user
C- Controller acts as an intermediatry layer between Model and View

Further you can google it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.