SlideShare ist ein Scribd-Unternehmen logo
1 von 72
Downloaden Sie, um offline zu lesen
Design for Scalability
with HMVC
Sam de Freyssinet




joind.in/talk/view/1557
whoami
Technical Team Lead, Ibuildings UK
sam@ibuildings.com




github.com/samsoir ••• @samsoir
also...
Kohana framework core developer since 2008




http://kohanaframework.org
What is
Hierarchical-MVC?
Controller




View                Model
Personalisation
       Controller
                                 Auth

                               Context

View                Model
“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.
C



                    V               M



    C
                                            C


V           M
                                        V           M




                C



        V               M


                                C                       C



                        V           M           V           M
C               Dashboard

                              V               M


Posts         C
                                                        C


        V             M                                                     Pages
                                                  V             M




        ACL               C



                  V               M


                                          C                         C
                                                                             Media
                  Users
                                  V           M             V           M
A long time ago in a galaxy
far,
far away....
http://www.javaworld.com/javaworld/jw-07-2000/jw-0721-
                       hmvc.html
C scope fa  lls short
   ...] the trad itional MV
“[                      the contr ol of GUI
     en  it comes to                    ot handle
wh
               widgets). M  VC does n
 elements (             of data ma nagement,
        com  plexities                    ion flows
 the
                 gement, a   nd applicat
 e  vent mana
  [...]” “HM
                VC provides a powe
                                      rful yet easy-to-
           understand layered
                                  design methodology
           for developing a com
                                   plete presentation
          layer. While MVC pro
                                  vides an efficient
          framework for devel
                                 oping GUI
          interaction, HMVC s
                                 cales it to the entire
          client tier.”
http://en.wikipedia.org/wiki/Presentation-abstraction-
                        control
HMVC   ≊   PAC
http://techportal.ibuildings.com/2010/02/22/scaling-web-applications-
                               with-hmvc/
“SOA separates functions into
distinct units, or services, whic
                                  h
developers make accessible
over a network in order to allo
                                w
users to combine and reuse
them in the production of
applications.”
             http://en.wikipedia.org/wiki/Service-
                     oriented_architecture
Request



                                C


        Request
                      V                  M
                                                 Request


    C
                                                     C
            Request

                               Request
V           M
                                             V               M




                C
                          Request
                                                             Request

        V                 M


                                    C                            C



                          V              M               V             M
Request



                                       C

Request
               Request
                             V                  M                   Request
                                                        Request


           C
                                                            C
                   Request

                                      Request
   V               M
                                                    V               M




 Request               C
                                                                              Request
                                 Request
                                                                      Request
                                                Request
               V                 M


                                           C                            C



                                 V              M               V               M
HMVC   ≊   PAC
SOA   ≊   HMVC   ≊   PAC
Available capacity          Users

100%                                              500,000

80%                                               400,000

60%                                               300,000

40%                                               200,000

20%                                               100,000

 0%                                                    0
       2010   2011      2012       2013   2014
epicFAIL
epicFAIL
Service-Orientated-
Architecture
Scaling SOA with HMVC in Kohana
Properties & methods
id          create
username    read (view/load)
password    update
full name   delete
nickname    find
email       find_all
[...]       [...]
// 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();
{
    id: 12345,
    username: 'sian',
    fullname: 'Siân de Freyssinet',
    shortname: 'pinkyde',
    ...,
    ...
}
// 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();
// Load an instance of sian user
   $user = User::instance()              FTW
            ->load('sian');




// Load an instance of sian user using HMVC
$user = Request::factory('user/load/sian.json')
            ->execute();
HTTP server          Handle client request

                      PHP initialisation   PHP runs, index.php executed

                                           Framework loads all required
                      Bootstrap            dependencies


                                           The server request is parsed
                      Request
Framework execution




                                           producing a request object

                                           The request is examined and
                      Routing              matched to a registered route




                                           The matched controller action is
                                           invoked.

                                           The business logic of the request
                      Application logic    takes place here, including
                                           loading of models and views,
                                           gathering data and rendering the
                                           result.
HTTP server          Handle client request

                      PHP initialisation   PHP runs, index.php executed

                                           Framework loads all required
                      Bootstrap            dependencies


                                           The server request is parsed
                      Request
Framework execution




                                           producing a request object

                                           The request is examined and
                      Routing              matched to a registered route




                                           The matched controller action is
                                           invoked.

                                           The business logic of the request
                      Application logic    takes place here, including
                                           loading of models and views,
                                           gathering data and rendering the
                                           result.
HTTP server          Handle client request

                      PHP initialisation   PHP runs, index.php executed

                                           Framework loads all required
                      Bootstrap            dependencies


                                           The server request is parsed
                      Request
Framework execution




                                           producing a request object

                                           The request is examined and
                      Routing              matched to a registered route




                                           The matched controller action is
                                           invoked.

                                           The business logic of the request
                      Application logic    takes place here, including
                                           loading of models and views,
                                           gathering data and rendering the
                                           result.
HTTP server          Handle client request

                      PHP initialisation   PHP runs, index.php executed

                                           Framework loads all required
                      Bootstrap            dependencies


                                           The server request is parsed
                      Request
Framework execution




                                           producing a request object

                                           The request is examined and
                      Routing              matched to a registered route




                                           The matched controller action is
                                           invoked.

                                           The business logic of the request
                      Application logic    takes place here, including
                                           loading of models and views,
                                           gathering data and rendering the
                                           result.
HTTP server          Handle client request

                      PHP initialisation   PHP runs, index.php executed

                                           Framework loads all required
                      Bootstrap            dependencies


                                           The server request is parsed
                      Request
Framework execution




                                           producing a request object

                                           The request is examined and
                      Routing              matched to a registered route




                                           The matched controller action is
                                           invoked.

                                           The business logic of the request
                      Application logic    takes place here, including
                                           loading of models and views,
                                           gathering data and rendering the
                                           result.
HTTP server          Handle client request

                      PHP initialisation   PHP runs, index.php executed

                                           Framework loads all required
                      Bootstrap            dependencies


                                           The server request is parsed
                      Request
Framework execution




                                           producing a request object

                                           The request is examined and
                      Routing              matched to a registered route




                                           The matched controller action is
                                           invoked.

                                           The business logic of the request
                      Application logic    takes place here, including
                                           loading of models and views,
                                           gathering data and rendering the
                                           result.
// 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();
}
// 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();
}
GET / HTTP/1.1
Status    Exception
Method    Action
Headers   Metadata
Content   Properties
Route::set('users',
    'user/<action>/<username>(<format>)',
    array('username' => 'w+', 'format' => '.w+'))
    ->defaults(array(
        'controller' => 'user',
        'action'      => 'load',
        'format'      => '.json',
    ));
Reverse Routing
Generating internal and external URIs based on
Route definitions
Route::set('users',
    'user/<action>/<username>(<format>)',
    array('username' => 'w+', 'format' => '.w+'))
    ->defaults(array(
        'controller' => 'user',
        'action'      => 'load',
        'format'      => '.json',
    ));
// 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();
// Create a URI for the user route
$uri = Route::get('users')
    ->uri(array('username' => 'sian'));
       $uri => /user/load/
             sian.json

// Load the URI with a request
Request::factory($uri)
    ->execute();
epicFAIL
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',
    ));
Route::set('users',
    'user/<action>/<username>(<format>)',
    array('username' => 'w+', 'format' => '.w+'))
    ->defaults(array(
        'controller' => 'user',
        'action'      => 'load',
        'format'      => '.json',
        'host'        => 'users.myhost.tld',
    ));
Security
Security
An additional consideration...
Security
An additional consideration...

  Obfuscation (really?)
  IP restriction
  API Keys
  HTTP Basic Auth
  SSL Certificates
OAuth
Designed for HTTP
OAuth
Designed for HTTP
Presentation
Scaling presentation with HMVC
- +                                                   mysite.com                                                                  +


      Home    Archive     Blog    Web board      About us



                                                                                Buy content
           My Website




                                                                                              login username
             Foobar
      12                                                                                  password   *******
                                                                                                     Register | Forget password
             - “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 ...
GET /auth/login HTTP/1.1
- +                                          mysite.com            +


      Home   Archive   Blog   Web board   About us




      Login


                       username siân

                       password *******

                                      Register | Forget password

                                                          OK
<!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 &rarr;">
            </p>
        </form>
    </body>
</html>
- +                                                   mysite.com                                                                  +


      Home    Archive     Blog    Web board      About us



                                                                                Buy content
           My Website




                                                                                              login username
             Foobar
      12                                                                                  password   *******
                                                                                                     Register | Forget password
             - “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 ...
- +                                                   mysite.com                                                                  +


      Home    Archive     Blog    Web board      About us



                                                                                Buy content
           My Website




                                                                                              login username
             Foobar
      12                                                                                  password   *******
                                                                                                     Register | Forget password
             - “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 ...
<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 &rarr;">
    </p>
</form>
$login_form = Request::factory('/auth/login')
   ->header('X-Login-Style', 'reduced')
   ->execute();
GET /auth/login HTTP/1.1
X-Login-Style: reduced
// 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');
}
Kohana 3
Website ~ http://kohanaframework.org
Source ~ http://github.com/kohana

Kohana 3.1 development ~
http://github.com/samsoir/core/tree/3.1
Photo credits
http://www.flickr.com/photos/kimpierro/182720032/
http://www.flickr.com/photos/filmingilman/5882785/
http://www.flickr.com/photos/ntr23/730371240
http://www.flickr.com/photos/tanaka/3212373419
http://www.flickr.com/photos/m0php/2426528590
http://www.flickr.com/photos/muehlinghaus/241755891
Thank you...
joind.in/talk/view/1557




      http://creativecommons.org/licenses/by-nc-sa/2.0/uk/

Weitere ähnliche Inhalte

Kürzlich hochgeladen

UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Kürzlich hochgeladen (20)

UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Design for scalability with hmvc

  • 1. Design for Scalability with HMVC Sam de Freyssinet joind.in/talk/view/1557
  • 2. whoami Technical Team Lead, Ibuildings UK sam@ibuildings.com github.com/samsoir ••• @samsoir
  • 3. also... Kohana framework core developer since 2008 http://kohanaframework.org
  • 6. Personalisation Controller Auth Context View Model
  • 7. “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.
  • 8. C V M C C V M V M C V M C C V M V M
  • 9. C Dashboard V M Posts C C V M Pages V M ACL C V M C C Media Users V M V M
  • 10.
  • 11. A long time ago in a galaxy far, far away....
  • 13. C scope fa lls short ...] the trad itional MV “[ the contr ol of GUI en it comes to ot handle wh widgets). M VC does n elements ( of data ma nagement, com plexities ion flows the gement, a nd applicat e vent mana [...]” “HM VC provides a powe rful yet easy-to- understand layered design methodology for developing a com plete presentation layer. While MVC pro vides an efficient framework for devel oping GUI interaction, HMVC s cales it to the entire client tier.”
  • 15. HMVC ≊ PAC
  • 17. “SOA separates functions into distinct units, or services, whic h developers make accessible over a network in order to allo w users to combine and reuse them in the production of applications.” http://en.wikipedia.org/wiki/Service- oriented_architecture
  • 18. Request C Request V M Request C C Request Request V M V M C Request Request V M C C V M V M
  • 19. Request C Request Request V M Request Request C C Request Request V M V M Request C Request Request Request Request V M C C V M V M
  • 20. HMVC ≊ PAC
  • 21. SOA ≊ HMVC ≊ PAC
  • 22.
  • 23. Available capacity Users 100% 500,000 80% 400,000 60% 300,000 40% 200,000 20% 100,000 0% 0 2010 2011 2012 2013 2014
  • 27.
  • 28. Properties & methods id create username read (view/load) password update full name delete nickname find email find_all [...] [...]
  • 29. // Load an instance of sian user $user = User::instance() ->load('sian');
  • 30. // Load an instance of sian user using HMVC $user = Request::factory('user/load/sian.json') ->execute();
  • 31. { id: 12345, username: 'sian', fullname: 'Siân de Freyssinet', shortname: 'pinkyde', ..., ... }
  • 32. // 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();
  • 33. // Load an instance of sian user $user = User::instance() FTW ->load('sian'); // Load an instance of sian user using HMVC $user = Request::factory('user/load/sian.json') ->execute();
  • 34. HTTP server Handle client request PHP initialisation PHP runs, index.php executed Framework loads all required Bootstrap dependencies The server request is parsed Request Framework execution producing a request object The request is examined and Routing matched to a registered route The matched controller action is invoked. The business logic of the request Application logic takes place here, including loading of models and views, gathering data and rendering the result.
  • 35. HTTP server Handle client request PHP initialisation PHP runs, index.php executed Framework loads all required Bootstrap dependencies The server request is parsed Request Framework execution producing a request object The request is examined and Routing matched to a registered route The matched controller action is invoked. The business logic of the request Application logic takes place here, including loading of models and views, gathering data and rendering the result.
  • 36. HTTP server Handle client request PHP initialisation PHP runs, index.php executed Framework loads all required Bootstrap dependencies The server request is parsed Request Framework execution producing a request object The request is examined and Routing matched to a registered route The matched controller action is invoked. The business logic of the request Application logic takes place here, including loading of models and views, gathering data and rendering the result.
  • 37. HTTP server Handle client request PHP initialisation PHP runs, index.php executed Framework loads all required Bootstrap dependencies The server request is parsed Request Framework execution producing a request object The request is examined and Routing matched to a registered route The matched controller action is invoked. The business logic of the request Application logic takes place here, including loading of models and views, gathering data and rendering the result.
  • 38. HTTP server Handle client request PHP initialisation PHP runs, index.php executed Framework loads all required Bootstrap dependencies The server request is parsed Request Framework execution producing a request object The request is examined and Routing matched to a registered route The matched controller action is invoked. The business logic of the request Application logic takes place here, including loading of models and views, gathering data and rendering the result.
  • 39. HTTP server Handle client request PHP initialisation PHP runs, index.php executed Framework loads all required Bootstrap dependencies The server request is parsed Request Framework execution producing a request object The request is examined and Routing matched to a registered route The matched controller action is invoked. The business logic of the request Application logic takes place here, including loading of models and views, gathering data and rendering the result.
  • 40. // 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(); }
  • 41. // 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(); }
  • 42.
  • 43. GET / HTTP/1.1 Status Exception Method Action Headers Metadata Content Properties
  • 44.
  • 45. Route::set('users', 'user/<action>/<username>(<format>)', array('username' => 'w+', 'format' => '.w+')) ->defaults(array( 'controller' => 'user', 'action' => 'load', 'format' => '.json', ));
  • 46. Reverse Routing Generating internal and external URIs based on Route definitions
  • 47. Route::set('users', 'user/<action>/<username>(<format>)', array('username' => 'w+', 'format' => '.w+')) ->defaults(array( 'controller' => 'user', 'action' => 'load', 'format' => '.json', ));
  • 48. // 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();
  • 49. // Create a URI for the user route $uri = Route::get('users') ->uri(array('username' => 'sian')); $uri => /user/load/ sian.json // Load the URI with a request Request::factory($uri) ->execute();
  • 51. Route::set('users', 'user/<action>/<username>(<format>)', array('username' => 'w+', 'format' => '.w+')) ->defaults(array( 'controller' => 'user', 'action' => 'load', 'format' => '.json', ));
  • 52. Route::set('users', 'user/<action>/<username>(<format>)', array('username' => 'w+', 'format' => '.w+')) ->defaults(array( 'controller' => 'user', 'action' => 'load', 'format' => '.json', 'host' => 'users.myhost.tld', ));
  • 53. Route::set('users', 'user/<action>/<username>(<format>)', array('username' => 'w+', 'format' => '.w+')) ->defaults(array( 'controller' => 'user', 'action' => 'load', 'format' => '.json', 'host' => 'users.myhost.tld', ));
  • 56. Security An additional consideration... Obfuscation (really?) IP restriction API Keys HTTP Basic Auth SSL Certificates
  • 60. - + mysite.com + Home Archive Blog Web board About us Buy content My Website login username Foobar 12 password ******* Register | Forget password - “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 ...
  • 62. - + mysite.com + Home Archive Blog Web board About us Login username siân password ******* Register | Forget password OK
  • 63. <!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 &rarr;"> </p> </form> </body> </html>
  • 64. - + mysite.com + Home Archive Blog Web board About us Buy content My Website login username Foobar 12 password ******* Register | Forget password - “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 ...
  • 65. - + mysite.com + Home Archive Blog Web board About us Buy content My Website login username Foobar 12 password ******* Register | Forget password - “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 ...
  • 66. <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 &rarr;"> </p> </form>
  • 67. $login_form = Request::factory('/auth/login') ->header('X-Login-Style', 'reduced') ->execute();
  • 69. // 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'); }
  • 70. Kohana 3 Website ~ http://kohanaframework.org Source ~ http://github.com/kohana Kohana 3.1 development ~ http://github.com/samsoir/core/tree/3.1
  • 72. Thank you... joind.in/talk/view/1557 http://creativecommons.org/licenses/by-nc-sa/2.0/uk/

Hinweis der Redaktion

  1. Introduce yourself and the talk...
  2. One of the core developers since 2008 Currently working on the 3.1 release (any Kohana users in the audience?)
  3. Another pattern? No. Hierarchical MVC is an extension of MVC Solves the mixed domain usage of the MVC paradigm Based entirely on MVC, so easy to implement with existing knowledge
  4. Traditional MVC usually does not fit the modern web app implementation Features add additional complexity Multiple features are packed into each MVC triad
  5. Traditional MVC usually does not fit the modern web app implementation Features add additional complexity Multiple features are packed into each MVC triad
  6. Traditional MVC usually does not fit the modern web app implementation Features add additional complexity Multiple features are packed into each MVC triad
  7. Traditional MVC usually does not fit the modern web app implementation Features add additional complexity Multiple features are packed into each MVC triad
  8. Controllers (and Models) become bloated - &amp;#x2018;fat&amp;#x2019; Application features become tightly coupled to controller code Increasingly harder to scale as features grow
  9. Hierarchical MVC is an architecture of multiple MVC instances - or &amp;#x2018;triads&amp;#x2019; Each triad is accessed exclusively through the controller Ensures application logic is enclosed within domain specific triads
  10. Hierarchical MVC is an architecture of multiple MVC instances - or &amp;#x2018;triads&amp;#x2019; Each triad is accessed exclusively through the controller Ensures application logic is enclosed within domain specific triads
  11. Hierarchical MVC is an architecture of multiple MVC instances - or &amp;#x2018;triads&amp;#x2019; Each triad is accessed exclusively through the controller Ensures application logic is enclosed within domain specific triads
  12. Hierarchical MVC is an architecture of multiple MVC instances - or &amp;#x2018;triads&amp;#x2019; Each triad is accessed exclusively through the controller Ensures application logic is enclosed within domain specific triads
  13. Hierarchical MVC is an architecture of multiple MVC instances - or &amp;#x2018;triads&amp;#x2019; Each triad is accessed exclusively through the controller Ensures application logic is enclosed within domain specific triads
  14. Hierarchical MVC is an architecture of multiple MVC instances - or &amp;#x2018;triads&amp;#x2019; Each triad is accessed exclusively through the controller Ensures application logic is enclosed within domain specific triads
  15. So where did HMVC come from? You may be surprised..!
  16. First reference to HMVC in Javaworld - July 2000 Article described how to structure Java based GUI interfaces Creates a solid separation between presentation and application logic
  17. Although the context is different, the themes apply to web application HMVC does encourage logical separation of domain specific code However...
  18. A reader letter to the editor pointed out HMVC is actually an implementation of PAC, Presentation-Abstraction-Control PAC as a design pattern dates back to 1970&amp;#x2019;s
  19. So Hierarchical-MVC is approximately equal to PAC! Done. I can go home. Not the whole story...
  20. In February this year I published an article on HMVC A reader [correctly] pointed out that HMVC is remarkably similar to Service-Orientated-Architecture
  21. When you look at the definition of SOA, it has many similarities with HMVC Applications built out of reusable components separated into distinct units HMVC triads are effectively services...
  22. Diagram I included in the TechPortal article is actually incorrect Each HMVC triad should be able to operate independently Each triad is certainly a service Therefore HMVC is an implementation of SOA
  23. Diagram I included in the TechPortal article is actually incorrect Each HMVC triad should be able to operate independently Each triad is certainly a service Therefore HMVC is an implementation of SOA
  24. So HMVC is approximately equal to Presentation-Abstraction-Control and Service-Orientated-Architecture...
  25. So HMVC is approximately equal to Presentation-Abstraction-Control and Service-Orientated-Architecture...
  26. So HMVC is approximately equal to Presentation-Abstraction-Control and Service-Orientated-Architecture...
  27. So HMVC is approximately equal to Presentation-Abstraction-Control and Service-Orientated-Architecture...
  28. ... I like to think it is the glue between the two, bring SOA and PAC together coherently. The rest of this talk will look at using HMVC to aid designing scalable applications Focus on scalable architecture and scalable presentation implementation
  29. (reference Lorenzo scalability talk) - My experience is scalability is a secondary consideration - Most apps grow in popularity exponentially. Hard to respond to until it&amp;#x2019;s too late - Response must be quick and decisive
  30. Failure to implement a solid scalable architecture can lead to disaster Twitter has famously and publicly fallen victim to this
  31. I will demonstrate how an SOA can be scaled relatively simply with Kohana 3 Lets look at implementing a very common web application feature. Ask: Which is the most ubiquitous web app feature?
  32. It is fair to say users are a pretty standard feature. They also present a good example as they contain many properties and methods.
  33. Example of some traditional user properties and methods, adopting a CRUD like pattern for user models
  34. An example of User instance using the traditional method - nothing revolutionary
  35. User loaded using an HMVC request. This creates an HTTP-like request so what is $user?
  36. Successful user request response will look like this [note] no password transmitted for what should be obvious reasons This can be wrapped into a model of course
  37. If we ran these requests in parallel, which method would be faster? The top one! Lets investigate the reason why?
  38. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  39. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  40. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  41. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  42. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  43. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  44. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  45. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  46. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  47. Traditional PHP Framework Request lifetime &gt; Server &gt; PHP &gt; Framework Bootstrap &gt; Request parse &gt; Routing &gt; Controller Execution Kohana does it&amp;#x2019;s best to mitigate, others don&amp;#x2019;t do so well
  48. We can mitigate further by adding a cache This severely reduces the load time for subsequent requests.
  49. If we look again at our previous comparison, with cache, which is faster? [neither] There is no advantage between MVC and HMVC methods. HTTP like interaction limits the functionality? No!
  50. Tim Berners-Lee defined HTTP in 1991 from his work at Cern HTTP can provide a lot of functionality...
  51. HTTP provides status, headers, content and verbs (methods) All of the functionality we need. How do we manage this in a scalable manner?
  52. Routes are equivalent to a network patch panel, they define mapping of URI to controller actions Managing application requests in a single location.
  53. This is the route for the applications users Creates a single place (bootstrap) where application functionality is defined Good Routing provides additional functionality
  54. Reverse routing! Reverse routing is the generation of a route URI based on a route definition and specific parameters
  55. We have parameters required for the action, username and return format The route provides defaults and filters
  56. Creating a new URI based on the Route definition with the required parameters Parameters that have defaults do not need to be supplied with default definitions
  57. Our application has failed Profiling has shown that the user operations are not scaling New server provisioned
  58. Traditionally new servers and code require provisioning, full QA, testing - not agile! HMVC allows rapid deployment of new services, very little change to the code (show new host definition) - Creation of API&amp;#x2019;s for free
  59. Traditionally new servers and code require provisioning, full QA, testing - not agile! HMVC allows rapid deployment of new services, very little change to the code (show new host definition) - Creation of API&amp;#x2019;s for free
  60. Traditionally new servers and code require provisioning, full QA, testing - not agile! HMVC allows rapid deployment of new services, very little change to the code (show new host definition) - Creation of API&amp;#x2019;s for free
  61. Exposing a lot of application logic, needs to be secured Most traditional methods are undesirable, either through complexity or performance
  62. Exposing a lot of application logic, needs to be secured Most traditional methods are undesirable, either through complexity or performance
  63. OAuth is designed to allow web services to access resources elsewhere. OAuth 1.0 is OK and could work. OAuth 2.0 is specifically designed for this paradigm, increasing performance
  64. OAuth is designed to allow web services to access resources elsewhere. OAuth 1.0 is OK and could work. OAuth 2.0 is specifically designed for this paradigm, increasing performance
  65. Turning attention to presentation and HMVC Similar to the Javaworld article, we want to handle the presentation of domain specific logic internally - scalable code management and reuse
  66. A typical web site. Content, Menus and User Authentication Normally partials and snippets are used in construction (this is fine) Traditionally pulled together in a fat controller
  67. HTTP request basic
  68. Login authentication usually has its own endpoint within a triad All of the login logic is kept within this domain Final view is handled here as well
  69. Full HTML5 version of a login page
  70. On other pages, we want to use the same logic within other contexts many methods for pulling login box (GET parameters etc) We can use HTTP headers
  71. Controller code to generate a request
  72. HTTP request with login style header
  73. Controller code to handle request and return correct view Keeps all login business logic within the authentication domain far easier to maintain