Principles of MVC for PHP Developers

Edureka!
Edureka!Edureka!
Principles of MVC For
PHP Developers
View PHP & MYSQL Course at: http://www.edureka.co/php-mysql
For more details please contact us:
US : 1800 275 9730 (toll free)
INDIA : +91 88808 62004
Email Us : sales@edureka.co
For Queries:
Post on Twitter @edurekaIN: #askEdureka
Post on Facebook /edurekaIN
Slide 2 www.edureka.co/php-mysql
Objectives
At the end of this module, you will be able to understand:
 Challenges Faced when Designing an Application Without Framework
 MCV Design Patterns
 Logic Behind MVC
 DRY and Convention Over Configuration
 MVC Benefits
 Demo on MVC in PHP
Slide 3 www.edureka.co/php-mysql
Challenges Faced when Designing an Application without a Framework
 Complexity in Coding in straight PHP  Everything must be tested; which is difficult
 Difficult to re-use code
 Hard code everything from scratch
 Teamwork challenges - parallel
programming cannot be done
efficiently
Slide 4 www.edureka.co/php-mysql
 Leads to disorganization  Change one thing , break another
Challenges Faced when Designing an Application without a Framework
Slide 5 www.edureka.co/php-mysql
The Solution is to use Design Patterns
Design Patterns is the way to organize a program
in a proper manner
One such design pattern is MVC
Slide 6 www.edureka.co/php-mysql
Introduction – What is MVC
MVC Introduction
MVC is acronym for Model-View-Controller
A software design pattern for developing web and desktop applications
In simple words, a better way of separating the logic of your application from
the display.
Slide 7 www.edureka.co/php-mysql
 Originally described in terms of a design pattern for use with Smalltalk by Trygve Reenskaug in 1979.
 His paper was published under the title "Applications Programming in Smalltalk-80: How to use Model-View-
Controller", and paved the groundwork for most future MVC implementations.
 MVC design pattern is used to separate an application’s data, business logic, and presentation; doing so facilitates
the creation of more maintainable, reusable, and testable code.
• Model - Data Layer
• View - User Interface Layer
• Controller - Interacts with the Model
MVC Introduction
Slide 8 www.edureka.co/php-mysql
MVC - Illustration
Web
Browser/Client
HTTP Request
HTTP Response
CONTROLLER MODEL
VIEW
Data object
Request
Data Objects
Response
Render dataEvents
(GET/POST)
Handled by Framework
(Hidden from user)
Database
Database
Request
Raw Data
Response
MVC Container
Website User
http://www.mywebsite.com
Slide 9 www.edureka.co/php-mysql
Model
Data access routines and some business logic can be defined in the model.
Model is responsible for providing the data from the database and saving the data
into the data store.
Models are active representations of database tables: they can connect to your
database, query it (if instructed to do so by a controller) and save data to the
database.
No interaction between models and views: all the logic is handled by controllers.
MVC - Data Layer
Slide 10 www.edureka.co/php-mysql
View
Views define exactly what is presented to the user.
It collects data from the user and gives it to controller and controller invokes the
required model.
Controllers pass data to each view to render in some format.
Views can be described as template files that present their content to the user:
variables, arrays and objects that are used in views are registered through a
controller.
Views should not contain complex business logic; only the elementary control
structures necessary to perform particular operations, such as the iteration of
collected data through a foreach construct, should be contained within a view.
MVC - User Interface Layer
Slide 11 www.edureka.co/php-mysql
Controller
Controllers bind the whole pattern together.
Controller is intermediary between View and Model.
Controllers contain the logic of your application.
Each controller can offer different functionality; controllers retrieve and modify data by
accessing database tables through models; and they register variables and objects, which
can be used in views.
Once request is received from client it executes the appropriate business logic from the
model, decide which view to display based on the user's request and other factors, pass
along the data that each view will need, or hand off control to another controller entirely.
MVC - Interacting With Model
Slide 12 www.edureka.co/php-mysql
DRY
 DRY just means "Don't Repeat Yourself". Make sure that when you write code, you only write it one time.
 The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative
representation within a system."
Reference: https://maurits.wordpress.com
Slide 13 www.edureka.co/php-mysql
Convention Over Configuration
 Convention over configuration (also known as coding by convention) is a software design paradigm which seeks
to :
 For example, if there is a class Sale in the model, the corresponding table in the database is called "sales" by default.
It is only if one deviates from this convention, such as calling the table "product sales", that one needs to write code
regarding these names.
Not losing
flexibility
Decrease
number of
decisions on
developers
Gain
Simplicity
Slide 14 www.edureka.co/php-mysql
MVC Benefits
Slide 15 www.edureka.co/php-mysql
Demo on
MVC in PHP
Questions
Slide 16 www.edureka.co/php-mysqlTwitter @edurekaIN, Facebook /edurekaIN, use #AskEdureka for Questions
Principles of MVC for PHP Developers
1 de 17

Recomendados

Introduction to Using PHP & MVC Frameworks por
Introduction to Using PHP & MVC FrameworksIntroduction to Using PHP & MVC Frameworks
Introduction to Using PHP & MVC FrameworksGerald Krishnan
2K visualizações89 slides
PHP MVC Tutorial por
PHP MVC TutorialPHP MVC Tutorial
PHP MVC TutorialYang Bruce
2.8K visualizações20 slides
MVC in PHP por
MVC in PHPMVC in PHP
MVC in PHPVineet Kumar Saini
5.3K visualizações3 slides
A Good PHP Framework For Beginners Like Me! por
A Good PHP Framework For Beginners Like Me!A Good PHP Framework For Beginners Like Me!
A Good PHP Framework For Beginners Like Me!Muhammad Ghazali
12.2K visualizações45 slides
MVC Frameworks for building PHP Web Applications por
MVC Frameworks for building PHP Web ApplicationsMVC Frameworks for building PHP Web Applications
MVC Frameworks for building PHP Web ApplicationsVforce Infotech
3.9K visualizações65 slides
CTTDNUG ASP.NET MVC por
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCBarry Gervin
7.2K visualizações48 slides

Mais conteúdo relacionado

Mais procurados

ASP.NET MVC 3 por
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3Buu Nguyen
6.2K visualizações48 slides
ASP .NET MVC por
ASP .NET MVC ASP .NET MVC
ASP .NET MVC eldorina
1K visualizações13 slides
MSDN - ASP.NET MVC por
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVCMaarten Balliauw
6K visualizações26 slides
MVC ppt presentation por
MVC ppt presentationMVC ppt presentation
MVC ppt presentationBhavin Shah
14K visualizações36 slides
3-TIER ARCHITECTURE IN ASP.NET MVC por
3-TIER ARCHITECTURE IN ASP.NET MVC3-TIER ARCHITECTURE IN ASP.NET MVC
3-TIER ARCHITECTURE IN ASP.NET MVCMohd Manzoor Ahmed
14.4K visualizações55 slides
Mvc4 por
Mvc4Mvc4
Mvc4Muhammad Younis
8.5K visualizações282 slides

Mais procurados(20)

ASP.NET MVC 3 por Buu Nguyen
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
Buu Nguyen6.2K visualizações
ASP .NET MVC por eldorina
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
eldorina1K visualizações
MSDN - ASP.NET MVC por Maarten Balliauw
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
Maarten Balliauw6K visualizações
MVC ppt presentation por Bhavin Shah
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah14K visualizações
3-TIER ARCHITECTURE IN ASP.NET MVC por Mohd Manzoor Ahmed
3-TIER ARCHITECTURE IN ASP.NET MVC3-TIER ARCHITECTURE IN ASP.NET MVC
3-TIER ARCHITECTURE IN ASP.NET MVC
Mohd Manzoor Ahmed14.4K visualizações
Mvc4 por Muhammad Younis
Mvc4Mvc4
Mvc4
Muhammad Younis8.5K visualizações
What's new in asp.net mvc 4 por Simone Chiaretta
What's new in asp.net mvc 4What's new in asp.net mvc 4
What's new in asp.net mvc 4
Simone Chiaretta8.5K visualizações
ASP .NET MVC Introduction & Guidelines por Dev Raj Gautam
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam1.2K visualizações
ASP .NET MVC - best practices por Bohdan Pashkovskyi
ASP .NET MVC - best practicesASP .NET MVC - best practices
ASP .NET MVC - best practices
Bohdan Pashkovskyi391 visualizações
Mvc architecture por Surbhi Panhalkar
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar44.5K visualizações
Asp.net mvc presentation by Nitin Sawant por Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
Nitin Sawant2.3K visualizações
Getting started with MVC 5 and Visual Studio 2013 por Thomas Robbins
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
Thomas Robbins14.9K visualizações
Asp.net MVC training session por Hrichi Mohamed
Asp.net MVC training sessionAsp.net MVC training session
Asp.net MVC training session
Hrichi Mohamed6.3K visualizações
ColdFusion framework comparison por VIkas Patel
ColdFusion framework comparisonColdFusion framework comparison
ColdFusion framework comparison
VIkas Patel5.7K visualizações
AngularJS 101 - Everything you need to know to get started por Stéphane Bégaudeau
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau55.5K visualizações
Introduction to ASP.NET MVC por LearnNowOnline
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
LearnNowOnline1.5K visualizações
Backbone.js por Omnia Helmi
Backbone.jsBackbone.js
Backbone.js
Omnia Helmi1.5K visualizações
Introduction to AngularJS por Jussi Pohjolainen
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Jussi Pohjolainen9.7K visualizações
Developing large scale JavaScript applications por Milan Korsos
Developing large scale JavaScript applicationsDeveloping large scale JavaScript applications
Developing large scale JavaScript applications
Milan Korsos2K visualizações

Destaque

Scrum sprint structure workshop by Nermina Durmić por
Scrum sprint structure workshop by Nermina DurmićScrum sprint structure workshop by Nermina Durmić
Scrum sprint structure workshop by Nermina DurmićBosnia Agile
2.4K visualizações17 slides
Css naming conventions por
Css naming conventionsCss naming conventions
Css naming conventionsvisual28
1.4K visualizações28 slides
Scrum In 15 Minutes por
Scrum In 15 MinutesScrum In 15 Minutes
Scrum In 15 MinutesSrikanth Shreenivas
91.9K visualizações15 slides
PHP Frameworks and CodeIgniter por
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterKHALID C
2.8K visualizações53 slides
Don't Fear the Regex - Northeast PHP 2015 por
Don't Fear the Regex - Northeast PHP 2015Don't Fear the Regex - Northeast PHP 2015
Don't Fear the Regex - Northeast PHP 2015Sandy Smith
1.3K visualizações36 slides
PHP Templating Systems por
PHP Templating SystemsPHP Templating Systems
PHP Templating SystemsChris Tankersley
2.3K visualizações33 slides

Destaque(20)

Scrum sprint structure workshop by Nermina Durmić por Bosnia Agile
Scrum sprint structure workshop by Nermina DurmićScrum sprint structure workshop by Nermina Durmić
Scrum sprint structure workshop by Nermina Durmić
Bosnia Agile2.4K visualizações
Css naming conventions por visual28
Css naming conventionsCss naming conventions
Css naming conventions
visual281.4K visualizações
Scrum In 15 Minutes por Srikanth Shreenivas
Scrum In 15 MinutesScrum In 15 Minutes
Scrum In 15 Minutes
Srikanth Shreenivas91.9K visualizações
PHP Frameworks and CodeIgniter por KHALID C
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
KHALID C2.8K visualizações
Don't Fear the Regex - Northeast PHP 2015 por Sandy Smith
Don't Fear the Regex - Northeast PHP 2015Don't Fear the Regex - Northeast PHP 2015
Don't Fear the Regex - Northeast PHP 2015
Sandy Smith1.3K visualizações
PHP Templating Systems por Chris Tankersley
PHP Templating SystemsPHP Templating Systems
PHP Templating Systems
Chris Tankersley2.3K visualizações
Introduction to PHP H/MVC Frameworks by www.silicongulf.com por Christopher Cubos
Introduction to PHP H/MVC Frameworks by www.silicongulf.comIntroduction to PHP H/MVC Frameworks by www.silicongulf.com
Introduction to PHP H/MVC Frameworks by www.silicongulf.com
Christopher Cubos2.7K visualizações
Grokking regex por David Stockton
Grokking regexGrokking regex
Grokking regex
David Stockton1.7K visualizações
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i por brettflorio
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i
/Regex makes me want to (weep|give up|(╯°□°)╯︵ ┻━┻)\.?/i
brettflorio1.9K visualizações
PHP Framework por celeroo
PHP FrameworkPHP Framework
PHP Framework
celeroo906 visualizações
Parsing JSON with a single regex por brian d foy
Parsing JSON with a single regexParsing JSON with a single regex
Parsing JSON with a single regex
brian d foy34.7K visualizações
Regular Expression (Regex) Fundamentals por Mesut Günes
Regular Expression (Regex) FundamentalsRegular Expression (Regex) Fundamentals
Regular Expression (Regex) Fundamentals
Mesut Günes6.2K visualizações
Php 2 - Approfondissement MySQL, PDO et MVC por Pierre Faure
Php 2 - Approfondissement MySQL, PDO et MVCPhp 2 - Approfondissement MySQL, PDO et MVC
Php 2 - Approfondissement MySQL, PDO et MVC
Pierre Faure3.9K visualizações
Hospital information systems - HIS por KHALID C
Hospital information systems - HISHospital information systems - HIS
Hospital information systems - HIS
KHALID C14.3K visualizações
Why MVC? por Wayne Tun Myint
Why MVC?Why MVC?
Why MVC?
Wayne Tun Myint10.5K visualizações
2 08 client-server architecture por jit_123
2 08 client-server architecture2 08 client-server architecture
2 08 client-server architecture
jit_1237.9K visualizações
Client server architecture por Bhargav Amin
Client server architectureClient server architecture
Client server architecture
Bhargav Amin30.6K visualizações
Client Server Architecture por suks_87
Client Server ArchitectureClient Server Architecture
Client Server Architecture
suks_8781.3K visualizações
Client server architecture por Whitireia New Zealand
Client server architectureClient server architecture
Client server architecture
Whitireia New Zealand 28.9K visualizações

Similar a Principles of MVC for PHP Developers

Principles of MVC for Rails Developers por
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails DevelopersEdureka!
1.6K visualizações22 slides
Mvc por
MvcMvc
Mvcabhigad
581 visualizações14 slides
Building Restful Web App Rapidly in CakePHP por
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPEdureka!
843 visualizações21 slides
IntroductionToMVC por
IntroductionToMVCIntroductionToMVC
IntroductionToMVCAkhil Mittal
214 visualizações3 slides
Building Web Application Using Spring Framework por
Building Web Application Using Spring FrameworkBuilding Web Application Using Spring Framework
Building Web Application Using Spring FrameworkEdureka!
5.4K visualizações21 slides
Ppt of Basic MVC Structure por
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC StructureDipika Wadhvani
676 visualizações27 slides

Similar a Principles of MVC for PHP Developers(20)

Principles of MVC for Rails Developers por Edureka!
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
Edureka!1.6K visualizações
Mvc por abhigad
MvcMvc
Mvc
abhigad581 visualizações
Building Restful Web App Rapidly in CakePHP por Edureka!
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHP
Edureka!843 visualizações
IntroductionToMVC por Akhil Mittal
IntroductionToMVCIntroductionToMVC
IntroductionToMVC
Akhil Mittal214 visualizações
Building Web Application Using Spring Framework por Edureka!
Building Web Application Using Spring FrameworkBuilding Web Application Using Spring Framework
Building Web Application Using Spring Framework
Edureka!5.4K visualizações
Ppt of Basic MVC Structure por Dipika Wadhvani
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC Structure
Dipika Wadhvani676 visualizações
Rapid Development With CakePHP por Edureka!
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHP
Edureka!1.6K visualizações
Introduction to mvc architecture por ravindraquicsolv
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv1.3K visualizações
IRJET- Lightweight MVC Framework in PHP por IRJET Journal
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHP
IRJET Journal19 visualizações
Intro ASP MVC por KrishnaPPatel
Intro ASP MVCIntro ASP MVC
Intro ASP MVC
KrishnaPPatel424 visualizações
Spring Framework-II por People Strategists
Spring Framework-IISpring Framework-II
Spring Framework-II
People Strategists1.3K visualizações
MVC & backbone.js por Mohammed Arif
MVC & backbone.jsMVC & backbone.js
MVC & backbone.js
Mohammed Arif4K visualizações
MVC(Model View Controller),Web,Enterprise,Mobile por naral
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobile
naral3.7K visualizações
Top 40 MVC Interview Questions and Answers | Edureka por Edureka!
Top 40 MVC Interview Questions and Answers | EdurekaTop 40 MVC Interview Questions and Answers | Edureka
Top 40 MVC Interview Questions and Answers | Edureka
Edureka!251 visualizações
Asp.net c# MVC-5 Training-Day-1 of Day-9 por AHM Pervej Kabir
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir923 visualizações
MVC Pattern. Flex implementation of MVC por Anton Krasnoshchok
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
Anton Krasnoshchok4.4K visualizações
Php Framework por cncwebworld
Php FrameworkPhp Framework
Php Framework
cncwebworld473 visualizações
Php framework por cncwebworld
Php frameworkPhp framework
Php framework
cncwebworld85 visualizações
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData por Edureka!
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData
Webinar: Spring Framework - Introduction to Spring WebMVC & Spring with BigData
Edureka!5.7K visualizações

Mais de Edureka!

What to learn during the 21 days Lockdown | Edureka por
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaEdureka!
46K visualizações42 slides
Top 10 Dying Programming Languages in 2020 | Edureka por
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaEdureka!
7.3K visualizações37 slides
Top 5 Trending Business Intelligence Tools | Edureka por
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaEdureka!
4.9K visualizações27 slides
Tableau Tutorial for Data Science | Edureka por
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaEdureka!
3.9K visualizações18 slides
Python Programming Tutorial | Edureka por
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaEdureka!
5.3K visualizações40 slides
Top 5 PMP Certifications | Edureka por
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaEdureka!
1.9K visualizações60 slides

Mais de Edureka!(20)

What to learn during the 21 days Lockdown | Edureka por Edureka!
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!46K visualizações
Top 10 Dying Programming Languages in 2020 | Edureka por Edureka!
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!7.3K visualizações
Top 5 Trending Business Intelligence Tools | Edureka por Edureka!
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!4.9K visualizações
Tableau Tutorial for Data Science | Edureka por Edureka!
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!3.9K visualizações
Python Programming Tutorial | Edureka por Edureka!
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!5.3K visualizações
Top 5 PMP Certifications | Edureka por Edureka!
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!1.9K visualizações
Top Maven Interview Questions in 2020 | Edureka por Edureka!
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!1.3K visualizações
Linux Mint Tutorial | Edureka por Edureka!
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!1.1K visualizações
How to Deploy Java Web App in AWS| Edureka por Edureka!
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!1.1K visualizações
Importance of Digital Marketing | Edureka por Edureka!
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!1.1K visualizações
RPA in 2020 | Edureka por Edureka!
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!987 visualizações
Email Notifications in Jenkins | Edureka por Edureka!
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!867 visualizações
EA Algorithm in Machine Learning | Edureka por Edureka!
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!985 visualizações
Cognitive AI Tutorial | Edureka por Edureka!
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!1.1K visualizações
AWS Cloud Practitioner Tutorial | Edureka por Edureka!
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!3.5K visualizações
Blue Prism Top Interview Questions | Edureka por Edureka!
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!530 visualizações
Big Data on AWS Tutorial | Edureka por Edureka!
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!485 visualizações
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka por Edureka!
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!1.1K visualizações
Kubernetes Installation on Ubuntu | Edureka por Edureka!
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!592 visualizações
Introduction to DevOps | Edureka por Edureka!
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!1.5K visualizações

Último

Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... por
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...ShapeBlue
138 visualizações18 slides
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... por
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...ShapeBlue
85 visualizações10 slides
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... por
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...ShapeBlue
123 visualizações28 slides
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... por
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...James Anderson
156 visualizações32 slides
DRBD Deep Dive - Philipp Reisner - LINBIT por
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBITShapeBlue
140 visualizações21 slides
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... por
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...ShapeBlue
120 visualizações13 slides

Último(20)

Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... por ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue138 visualizações
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... por ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue85 visualizações
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... por ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue123 visualizações
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... por James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson156 visualizações
DRBD Deep Dive - Philipp Reisner - LINBIT por ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue140 visualizações
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... por ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue120 visualizações
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online por ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue181 visualizações
State of the Union - Rohit Yadav - Apache CloudStack por ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue253 visualizações
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool por ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue84 visualizações
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT por ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue166 visualizações
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... por ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue154 visualizações
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... por Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 visualizações
Why and How CloudStack at weSystems - Stephan Bienek - weSystems por ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue197 visualizações
Network Source of Truth and Infrastructure as Code revisited por Network Automation Forum
Network Source of Truth and Infrastructure as Code revisitedNetwork Source of Truth and Infrastructure as Code revisited
Network Source of Truth and Infrastructure as Code revisited
Network Automation Forum52 visualizações
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... por ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue117 visualizações
Digital Personal Data Protection (DPDP) Practical Approach For CISOs por Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash153 visualizações
Data Integrity for Banking and Financial Services por Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely78 visualizações
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue por ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue163 visualizações
Business Analyst Series 2023 - Week 4 Session 7 por DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10126 visualizações
Uni Systems for Power Platform.pptx por Uni Systems S.M.S.A.
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptx
Uni Systems S.M.S.A.61 visualizações

Principles of MVC for PHP Developers

  • 1. Principles of MVC For PHP Developers View PHP & MYSQL Course at: http://www.edureka.co/php-mysql For more details please contact us: US : 1800 275 9730 (toll free) INDIA : +91 88808 62004 Email Us : sales@edureka.co For Queries: Post on Twitter @edurekaIN: #askEdureka Post on Facebook /edurekaIN
  • 2. Slide 2 www.edureka.co/php-mysql Objectives At the end of this module, you will be able to understand:  Challenges Faced when Designing an Application Without Framework  MCV Design Patterns  Logic Behind MVC  DRY and Convention Over Configuration  MVC Benefits  Demo on MVC in PHP
  • 3. Slide 3 www.edureka.co/php-mysql Challenges Faced when Designing an Application without a Framework  Complexity in Coding in straight PHP  Everything must be tested; which is difficult  Difficult to re-use code  Hard code everything from scratch  Teamwork challenges - parallel programming cannot be done efficiently
  • 4. Slide 4 www.edureka.co/php-mysql  Leads to disorganization  Change one thing , break another Challenges Faced when Designing an Application without a Framework
  • 5. Slide 5 www.edureka.co/php-mysql The Solution is to use Design Patterns Design Patterns is the way to organize a program in a proper manner One such design pattern is MVC
  • 6. Slide 6 www.edureka.co/php-mysql Introduction – What is MVC MVC Introduction MVC is acronym for Model-View-Controller A software design pattern for developing web and desktop applications In simple words, a better way of separating the logic of your application from the display.
  • 7. Slide 7 www.edureka.co/php-mysql  Originally described in terms of a design pattern for use with Smalltalk by Trygve Reenskaug in 1979.  His paper was published under the title "Applications Programming in Smalltalk-80: How to use Model-View- Controller", and paved the groundwork for most future MVC implementations.  MVC design pattern is used to separate an application’s data, business logic, and presentation; doing so facilitates the creation of more maintainable, reusable, and testable code. • Model - Data Layer • View - User Interface Layer • Controller - Interacts with the Model MVC Introduction
  • 8. Slide 8 www.edureka.co/php-mysql MVC - Illustration Web Browser/Client HTTP Request HTTP Response CONTROLLER MODEL VIEW Data object Request Data Objects Response Render dataEvents (GET/POST) Handled by Framework (Hidden from user) Database Database Request Raw Data Response MVC Container Website User http://www.mywebsite.com
  • 9. Slide 9 www.edureka.co/php-mysql Model Data access routines and some business logic can be defined in the model. Model is responsible for providing the data from the database and saving the data into the data store. Models are active representations of database tables: they can connect to your database, query it (if instructed to do so by a controller) and save data to the database. No interaction between models and views: all the logic is handled by controllers. MVC - Data Layer
  • 10. Slide 10 www.edureka.co/php-mysql View Views define exactly what is presented to the user. It collects data from the user and gives it to controller and controller invokes the required model. Controllers pass data to each view to render in some format. Views can be described as template files that present their content to the user: variables, arrays and objects that are used in views are registered through a controller. Views should not contain complex business logic; only the elementary control structures necessary to perform particular operations, such as the iteration of collected data through a foreach construct, should be contained within a view. MVC - User Interface Layer
  • 11. Slide 11 www.edureka.co/php-mysql Controller Controllers bind the whole pattern together. Controller is intermediary between View and Model. Controllers contain the logic of your application. Each controller can offer different functionality; controllers retrieve and modify data by accessing database tables through models; and they register variables and objects, which can be used in views. Once request is received from client it executes the appropriate business logic from the model, decide which view to display based on the user's request and other factors, pass along the data that each view will need, or hand off control to another controller entirely. MVC - Interacting With Model
  • 12. Slide 12 www.edureka.co/php-mysql DRY  DRY just means "Don't Repeat Yourself". Make sure that when you write code, you only write it one time.  The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." Reference: https://maurits.wordpress.com
  • 13. Slide 13 www.edureka.co/php-mysql Convention Over Configuration  Convention over configuration (also known as coding by convention) is a software design paradigm which seeks to :  For example, if there is a class Sale in the model, the corresponding table in the database is called "sales" by default. It is only if one deviates from this convention, such as calling the table "product sales", that one needs to write code regarding these names. Not losing flexibility Decrease number of decisions on developers Gain Simplicity
  • 16. Questions Slide 16 www.edureka.co/php-mysqlTwitter @edurekaIN, Facebook /edurekaIN, use #AskEdureka for Questions