Professional Documents
Culture Documents
A Primer in 10 Slides
dominique.cimafranca@gmail.com
http://villageidiotsavant.com
Model-View-Controller
an architectural
Without MVC
delete.php
update.php
read.php
presentation
database
database
create.php
application
Client
http://myapp/create.php
http://myapp/read.php
http://myapp/update.php
http://myapp/delete.php
db=connect(database);
var1=$_POST[data1];
var2=$_POST[data2];
db.query(insert into db values var1,var2);
print <HTML><H1>Success</H1></HTML>;
Client
function delete() {
:
:
}
http://myapp/customer/create
http://myapp/customer/read
http://myapp/customer/update
http://myapp/customer/delete
function read($id) {
Customer->get($id);
$data=Customer->read();
:
:
render($data,template.tpl);
}
Client
function delete() {
:
:
}
http://myapp/customer/create
http://myapp/customer/read
http://myapp/customer/update
http://myapp/customer/delete
name
category
quantity
:
read()
save()
:
function read($id) {
Customer->get($id);
$data=Customer->read();
:
:
render($data,template.tpl);
}
Charlie Brown
Lucy Van Pelt
Linus Van Pelt
customer (controller)
function create() {
:
:
}
function read() {
:
:
}
function update() {
:
:
}
Client
name
category
quantity
:
read()
save()
:
function read($id) {
Customer->get($id);
$data=Customer->read();
:
:
render($data,template.tpl);
}
function delete() {
:
:
}
http://myapp/customer/create
http://myapp/customer/read
http://myapp/customer/update
http://myapp/customer/delete
$header
$sidebar
::::
Our Customers
for($item in $data) {
echo $item;
}
JavaScript
C / C++
Java
Whatever...
Customer
customer (controller)
function create() {
:
:
}
XML request
XML response
Client
function read() {
:
:
}
function update() {
:
:
}
name
category
quantity
:
read()
save()
:
function read($id) {
Customer->get($id);
$data=Customer->read();
:
:
render($data,template.tpl);
}
function delete() {
:
:
}
$xml->serialize($data)
CakePHP (www.cakephp.org)
CodeIgniter (www.codeigniter.org)
Yii (www.yiiframework.com)
Django (www.djangoproject.org)
CherryPy (www.cherrypy.org)
Catalyst (www.catalyst.org)
Mojolicious (www.mojolicio.us)
Frameworks
make things
easier
BUT
you don't need
to use them to
practice MVC
License
Waiver: Any of the above conditions can be waived if you get permission from the copyright holder.
Public Domain: Where the work or any of its elements is in the public domain under applicable law, that
status is in no way affected by the license.
Other Rights: In no way are any of the following rights affected by the license:
Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
Share Alike: If you alter, transform, or build upon this work, you may distribute the resulting work only under
the same or similar license to this one.
Attribution: You must attribute the work in the manner specified by the author or licensor (but not in any way
that suggests that they endorse you or your use of the work).
Rights other persons may have either in the work itself or in how the work is used, such as publicity or
privacy rights.
Notice: For any reuse or distribution, you must make clear to others the license terms of this work.
The best way to do this is with a link to this web page.