Share
Embed
Transcript
53 slides
-
“Thomas & Friends”, “The Fat Controller” © 2010 Gullane (Thomas)
Limited. The Thomas name and character and the Thomas & Friends logo are trademarks of Gullane (Thomas) Limited and its affiliates and are registered in many jurisdictions throughout the world. Friday, 25 May 12 -
C V M C V M C V M C
V M C V M C V M Dashboard Posts Pages ACL Users Media Friday, 25 May 12 -
A long time ago in a galaxy far, far away....
Friday, 25 May 12 -
“HMVC provides a powerful yet easy-to- understand layered design methodology
for developing a complete presentation layer. While MVC provides an efficient framework for developing GUI interaction, HMVC scales it to the entire client tier.” “[...] the traditional MVC scope falls short when it comes to the control of GUI elements (widgets). MVC does not handle the complexities of data management, event management, and application flows [...]” Friday, 25 May 12 -
“SOA separates functions into distinct units, or services, which developers
make accessible over a network in order to allow users to combine and reuse them in the production of applications.” http://en.wikipedia.org/wiki/Service-oriented_architecture Friday, 25 May 12 -
C V M C V M C V M C
V M C V M C V M Request Request Request Request Request Request Request Request Request Request Request Request C V M C V M C V M C V M C V M C V M Request Request Request Request Request Request Request Friday, 25 May 12 -
0% 20% 40% 60% 80% 100% 2010 2011 2012 2013
2014 0 100,000 200,000 300,000 400,000 500,000 Available capacity Users Friday, 25 May 12 -
Properties & methods create read (view/load) update delete find find_all
[...] id username password full name nickname email [...] Friday, 25 May 12 -
// Load an instance of sian user $user = User::instance()
->load('sian'); Friday, 25 May 12 -
// Load an instance of sian user using HMVC $user
= Request::factory('user/load/sian.json') ->execute(); Friday, 25 May 12 -
{ id: 12345, username: 'sian', fullname: 'Siân de Freyssinet', shortname:
'pinkyde', ..., ... } Friday, 25 May 12 -
// Load an instance of sian user $user = User::instance()
->load('sian'); // Load an instance of sian user using HMVC $user = Request::factory('user/load/sian.json') ->execute(); FTW Friday, 25 May 12 -
HTTP server Handle client request PHP initialisation PHP runs, index.php
executed Bootstrap Framework loads all required dependencies Request The server request is parsed producing a request object Routing The request is examined and matched to a registered route Application logic The matched controller action is invoked. The business logic of the request takes place here, including loading of models and views, gathering data and rendering the result. Framework execution Friday, 25 May 12 -
// If there is no cached user if ( !
$user = Cache::instance() ->load('sian12345')) { // Load an instance of sian // user using HMVC $user = Request::factory('user/sian') ->execute(); } Friday, 25 May 12 -
// If there is no cached user if ( !
$user = Cache::instance() ->load('sian12345')) { // Load an instance of sian user $user = User::instance() ->load('sian'); } // If there is no cached user if ( ! $user = Cache::instance() ->load('sian12345')) { // Load an instance of sian user using HMVC $user = Request::factory('user/sian') ->execute(); } Friday, 25 May 12 -
GET / HTTP/1.1 Status Method Headers Content Exception Action Metadata
Properties Friday, 25 May 12 -
Route::set('users', 'user/<action>/<username>(<format>)', array('username' => '\w+', 'format' => '\.\w+')) ->defaults(array( 'controller'
=> 'user', 'action' => 'load', 'format' => '.json', )); Friday, 25 May 12 -
Reverse Routing Generating internal and external URIs based on Route
definitions Friday, 25 May 12 -
Route::set('users', 'user/<action>/<username>(<format>)', array('username' => '\w+', 'format' => '\.\w+')) ->defaults(array( 'controller'
=> 'user', 'action' => 'load', 'format' => '.json', )); Friday, 25 May 12 -
// Create a URI for the user route $uri =
Route::get('users') ->uri(array('username' => 'sian')); // Load the URI with a request Request::factory($uri) ->execute(); $uri => /user/load/sian.json Friday, 25 May 12 -
Route::set('users', 'user/<action>/<username>(<format>)', array('username' => '\w+', 'format' => '\.\w+')) ->defaults(array( 'controller'
=> 'user', 'action' => 'load', 'format' => '.json', )); Route::set('users', 'user/<action>/<username>(<format>)', array('username' => '\w+', 'format' => '\.\w+')) ->defaults(array( 'controller' => 'user', 'action' => 'load', 'format' => '.json', 'host' => 'users.myhost.tld', )); Friday, 25 May 12 -
Security An additional consideration... Obfuscation (really?) IP restriction API Keys
HTTP Basic Auth SSL Certificates Friday, 25 May 12 -
+ - + mysite.com Home Archive Blog Web board About
us My Website Buy content login username password ******* Register | Forget password 12 - “RDX Wall Art: The Making Of” iand new short documentary iand new short isa new short - isa new short documentary - highlighting iand new sho documentary - some of the pioneers highlighting iand new sho more ... Foobar 12 - “RDX Wall Art: The Making Of” iand new short documentary iand new short isa new short - isa new short documentary - highlighting iand new sho documentary - some of the pioneers highlighting iand new sho more ... Foobar Friday, 25 May 12 -
+ - + mysite.com Home Archive Blog Web board About
us username siân password ******* Register | Forget password OK Login Friday, 25 May 12 -
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Login page</title> </head> <body>
<form action="/auth/login" method="post" accept-charset="utf-8"> <p> <label for "username">Username :</label> <br /> <input type="test" name="username" value="" id="username"> </p> <p> <label for "password">Password :</label> <br /> <input type="test" name="password" value="" id="password"> </p> <p> <input type="submit" value="Login →"> </p> </form> </body> </html> Friday, 25 May 12 -
+ - + mysite.com Home Archive Blog Web board About
us My Website Buy content login username password ******* Register | Forget password 12 - “RDX Wall Art: The Making Of” iand new short documentary iand new short isa new short - isa new short documentary - highlighting iand new sho documentary - some of the pioneers highlighting iand new sho more ... Foobar 12 - “RDX Wall Art: The Making Of” iand new short documentary iand new short isa new short - isa new short documentary - highlighting iand new sho documentary - some of the pioneers highlighting iand new sho more ... Foobar Friday, 25 May 12 -
<form action="/auth/login" method="post" accept-charset="utf-8"> <p> <label for "username">Username :</label> <br
/> <input type="test" name="username" value="" id="username"> </p> <p> <label for "password">Password :</label> <br /> <input type="test" name="password" value="" id="password"> </p> <p> <input type="submit" value="Login →"> </p> </form> Friday, 25 May 12 -
// Test the request for reduced style if ($this->request->header('X-Login-Style') ===
'reduced') { // Return the reduced login form $this->response->body = View::factory('login/reduced.phtml'); } else { // Return the full login form $this->response->body = View::factory('login/reduced.phtml'); } Friday, 25 May 12 -
Kohana 3 Website ~ http://kohanaframework.org Source ~ http://github.com/kohana Kohana 3.1
development ~ http://github.com/samsoir/core/tree/3.1 Friday, 25 May 12