SlideShare a Scribd company logo
1 of 76
Download to read offline
A resource orientated framework
using the DI /AOP/REST Triangle
About Us
• Akihito Koriyama
• A Tokyo based freelance PHP architect
• BEAR.Sunday lead, Aura PHP member
• Richard McIntyre
• Manchester / leeds based freelance PHP
developer
• BEAR.Sunday contributor, Lithium member
About Us
• Akihito Koriyama
• A Tokyo based freelance PHP architect
• BEAR.Sunday lead, Aura PHP member
• Richard McIntyre
• Manchester / Leeds based freelance PHP
developer
• BEAR.Sunday contributor, Lithium member
BEAR.Sunday is an application framework.
But it offers no libraries.
(We have good stuff)
instead, it offers three object frameworks.
What is a framework ?
“imposes a set of design constraints on end-user code.”
3.hypermedia framework
DI
AOP
REST
DI Benefits
• Dependency Inversion Principle
• Clear separation of object instantiation and object
usage
• Object delivery
DIP
• Code should depend on
things that are at the same
or higher level of
abstraction
• High level policy should not
depend on low level details
“The principle of dependency inversion is at the
root of many of the benefits claimed for object-
oriented technology.
Its proper application is necessary for the creation
of reusable frameworks”
Ray.DI
Dependency Injection Framework
/**
* @Inject
*/
public function __construct(RenderInterface $renderer)
{
...
1.annotate at injection point
class RendererModule extends AbstractModule
{
protected function configure()
{
$this->bind('RenderInterface')
->to('HalRenderer')
->in(Scope::SINGLETON);
}
$injector = Inject::create([new RendererModule]];
2 bind abstraction to concretion
3.create an injector
/**
* @Inject
*/
public function __construct(RenderInterface $renderer)
{
...
1.annotate at injection point
class RendererModule extends AbstractModule
{
protected function configure()
{
$this->bind('RenderInterface')
->to('HalRenderer')
->in(Scope::SINGLETON);
}
$injector = Inject::create([new RendererModule]];
2. bind abstraction to concretion
3.create an injector
/**
* @Inject
*/
public function __construct(RenderInterface $renderer)
{
...
1.annotate at injection point
class RendererModule extends AbstractModule
{
protected function configure()
{
$this->bind('RenderInterface')
->to('HalRenderer')
->in(Scope::SINGLETON);
}
$injector = Inject::create([new RendererModule]];
2 bind abstraction to concretion
3.create an injector
$user = $injector->getInstance('UserInterface');
4. Get an object graph from the $injector
User Renderer
Renderer Interface
depends
A
B
procedural
object orietned
compilation
runtime
Implement the structure, not a procedure
class RendererModule extends AbstractModule
{
protected function configure()
{
$this
->bind('RenderInterface')
->to('HalRenderer')
->in(Scope::SINGLETON);
}
}
Only use concrete classes in compilation
Only abstraction in runtime
/**
* @Inject
*/
public function __construct(RenderInterface $renderer)
{
DI Best practice
“Your code should deal directly with the Injector
as little as possible. Instead, you want to bootstrap
your application by injecting one root object.”
Application = one root object
Application class
Application is root object
retrieved with injector:
$injector = Inject::create([new AppModule($context)]];
$app = $injector->getInstance(‘AppInterface’);
Application has dependency.
Dependencies have other dependencies
Each object either contains or belongs to.
You get a application object graph.
huge, but can be stored one single root value $app
Application can be serialized.
$app can be serialized and stored
Injection is reused beyond requests.
$app
Object
i/f
i/f
Object
i/f i/f
ObjectRouter
Response
JSON
XM
L
1st framework: DI Framework
• annotations based DI framework w/ binding DSL
• compilation / runtime separation
• use only “plug/abstraction” at runtime
• application a single large cached object
• focus on structure not behavior
Aspect Oriented Programing
What is AOP?
Cache
Log
Auth
A programming paradigm that aims to increase modularity
by allowing the separation of cross-cutting concerns
/**
* @Cache
*/
public function onGet($id)
{
// ...
$this->body = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $this;
}
class Post extends AppModel {
public function newest() {
$result = Cache::read('newest_posts', 'longterm');
if (!$result) {
$result = $this->find('all');
Cache::write('newest_posts', $result, 'longterm');
}
return $result;
}
}
MC
I I
AOP
MC
Cache
Cache is called by method invocation,
If the cache is warm the model is never called.
$obj->read(2);
Miss !
Aspects
Core Concern Cross Cutting Concern
Separation
Rock Concert Example
interface MethodInterceptor
{
public function invoke(MethodInvocation $invocation);
}
$invocation->proceed(); // invoked method
$object = $invocation->getThis(); // get source object
$args = $invocation->getArgs(); // get arguments
class Transactional implements MethodInterceptor
{
public function invoke(MethodInvocation $invocation)
{
$object = $invocation->getThis();
$ref = new ReflectionProperty($object, 'db');
$ref->setAccessible(true);
$db = $ref->getValue($object);
$db->beginTransaction();
try {
$invocation->proceed();
$db->commit();
} catch (Exception $e) {
$db->rollback();
}
}
}
`Transactional`interceptor
Core Concern
Cross Cutting Concern
class CacheInterceptor implements MethodInterceptor
{
public function invoke(MethodInvocation $invocation)
{
$obj = $invocation->getThis();
$args = $invocation->getArguments();
$id = get_class($obj) . serialize($args);
$saved = $this->cache->fetch($id);
if ($saved) {
return $saved;
}
$result = $invocation->proceed();
$this->cache->save($id, $result);
return $result;
}
}
`Cache`interceptor
Core Concern
Cross Cutting Concern
Simply annotate,
then create your binding
Bind
Layering by context
• MVC, Is 3 enough ?
APIClient
API LogClient Valid Auth
API Log
@Valid
/admin DELETE
Client Valid Auth
Aspect layering by context
Model
Cache
Form
Transaction
Auth
Validation
<?php
class SandboxResourcePageIndexRay0000000071f9ab280000000033fb446fAop extends
SandboxResourcePageIndex implements RayAopWeavedInterface
{
private $rayAopIntercept = true;
public $rayAopBind;
public function onGet()
{
// native call
if (!isset($this->rayAopBind[__FUNCTION__])) {
return call_user_func_array('parent::' . __FUNCTION__, func_get_args());
}
// proceed source method from interceptor
if (!$this->rayAopIntercept) {
$this->rayAopIntercept = true;
return call_user_func_array('parent::' . __FUNCTION__, func_get_args());
}
// proceed next interceptor
$this->rayAopIntercept = false;
$interceptors = $this->rayAopBind[__FUNCTION__];
$annotation = isset($this->rayAopBind->annotation[__FUNCTION__]) ? $this->rayAopBind
>annotation[__FUNCTION__] : null;
$invocation = new RayAopReflectiveMethodInvocation(array($this, __FUNCTION__),
func_get_args(), $interceptors, $annotation);
return $invocation->proceed();
}
Under the hood: Method interception sub class is created
in order enable this interception and keep type safety.
Runtime injection by aspect
• method / parameter lookup
• test friendly
2nd framework: Aspect Oriented Framework
• AOP alliance standard
• Layering by context
• Type safe
• Runtime injection
Hypermedia framework for object as a service
It allows objects to have RESTful web service benefits
such as client-server, uniform interface, statelessness,
resource expression with mutual connectivity and
layered components.
class Author extends ResourceObject
{
public $code = 200;
public $headers = [];
public $body = [];
/**
* @Link(rel="blog", href="app://self/blog/post?author_id={id}")
*/
public function onGet($id)
{
... // change own state
return $this;
}
public function onPost($name)
{
$this->code = 201; // created
return $this;
}
public function onPut($id, $name)
$user = $resource
->get
->uri('app://self/user')
->withQuery(['id' => 1])
->eager
->request();
var_dump($user->body);
// Array
// (
// [name] => John
// [age] => 15
//)
echo $user;
// <div id=”name”>John</div>
// <div id=”age”>15</div>
public function onGet($id)
{
$this[‘name’] = ‘John’;
$this[‘age’] = 15;
return $this;
}
User
Profile
Friend
$order = $resource
->post
->uri('app://self/order')
->withQuery(['drink' => 'latte'])
->eager
->request();
$payment = [
'credit_card_number' => '123456789',
'expires' => '07/07',
'name' => 'Koriym',
'amount' => '4.00'
];
// Now use a hyperlink to pay
$response = $resource->href('pay', $payment);
echo $response->code; // 201
Hypermedia as the Engine of Application State
class Order extends ResourceObject
{
/**
*
* @Link(rel="pay", method="put",
href="app://self/payment{?order_id,card_number,amount}")
*/
public function onPost($drink)
{
// data store here
$this['drink'] = $drink;
$this['order_id'] = $orderId;
// created
$this->code = 201;
return $this;
}
Hypermedia as the Engine of Application State
Order Payment
hyper reference: pay
HyperMedia Driven API
The key of success of web
• URI
• Unified Interface
• Hyperlink
• API is hub
• API is core value
API driven development
DB Mobil
e
Web
API
Cloud
Moc
k
URI
API
API
http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html
Layered Resource
UI
Mobile
Web
Page Resource
App script
App Resource
Entity
Performance
• annotation ? dependency injection ?
method interception ? DSL ? named parameter ?
• Fast
• cache all compiled object
• http friendly architecture
Scale
• “model proxy” pattern
• ‘app://self/blog/entry’ can be anything.
• contextual injection makes db scale easy
Hard spot / Soft spot
• DI configure hardspot. per system
• Aop configure softspot, change on request
Connecting frameworks
• DI - object as dependency
• AOP - domain logic to application logic
• Hypermedia - resource to resource
Abstraction frameworks
• DSL
• Annotation
• URI
• Interface
• Aspects
• Hypermedia
“Zen” framework
Thanks.
Arigato
http://www.flickr.com/photos/stevehoad/4678289858/
@mackstar@koriym

More Related Content

What's hot

Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
Design Patterns in PHP5
Design Patterns in PHP5 Design Patterns in PHP5
Design Patterns in PHP5 Wildan Maulana
 
Rich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 ApplicationRich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 ApplicationKirill Chebunin
 
DrupalJam 2018 - Maintaining a Drupal Module: Keep It Small and Simple
DrupalJam 2018 - Maintaining a Drupal Module: Keep It Small and SimpleDrupalJam 2018 - Maintaining a Drupal Module: Keep It Small and Simple
DrupalJam 2018 - Maintaining a Drupal Module: Keep It Small and SimpleAlexander Varwijk
 
Symfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteSymfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteLeonardo Proietti
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionNate Abele
 
How I started to love design patterns
How I started to love design patternsHow I started to love design patterns
How I started to love design patternsSamuel ROZE
 
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)Javier Eguiluz
 
Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Colin O'Dell
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Fabien Potencier
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of LithiumNate Abele
 
What's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field APIWhat's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field APIDrupalize.Me
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & RESTHugo Hamon
 
Drupal 8: Entities
Drupal 8: EntitiesDrupal 8: Entities
Drupal 8: Entitiesdrubb
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of LithiumNate Abele
 
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleDesign Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleHugo Hamon
 

What's hot (20)

Min-Maxing Software Costs
Min-Maxing Software CostsMin-Maxing Software Costs
Min-Maxing Software Costs
 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
Design Patterns in PHP5
Design Patterns in PHP5 Design Patterns in PHP5
Design Patterns in PHP5
 
Rich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 ApplicationRich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 Application
 
DrupalJam 2018 - Maintaining a Drupal Module: Keep It Small and Simple
DrupalJam 2018 - Maintaining a Drupal Module: Keep It Small and SimpleDrupalJam 2018 - Maintaining a Drupal Module: Keep It Small and Simple
DrupalJam 2018 - Maintaining a Drupal Module: Keep It Small and Simple
 
Symfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteSymfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il cliente
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
 
How I started to love design patterns
How I started to love design patternsHow I started to love design patterns
How I started to love design patterns
 
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)New Symfony Tips & Tricks (SymfonyCon Paris 2015)
New Symfony Tips & Tricks (SymfonyCon Paris 2015)
 
Symfony tips and tricks
Symfony tips and tricksSymfony tips and tricks
Symfony tips and tricks
 
Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 
What's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field APIWhat's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field API
 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
 
Drupal 8: Entities
Drupal 8: EntitiesDrupal 8: Entities
Drupal 8: Entities
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleDesign Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
 

Viewers also liked

Microscopic structure of retina dr paresh varsat
Microscopic structure of retina dr paresh varsat Microscopic structure of retina dr paresh varsat
Microscopic structure of retina dr paresh varsat DrParesh Varsat
 
Dr.s.veni priya 18.2.16 deg cyst tumors
Dr.s.veni priya 18.2.16  deg cyst  tumorsDr.s.veni priya 18.2.16  deg cyst  tumors
Dr.s.veni priya 18.2.16 deg cyst tumorsophthalmgmcri
 
Pinguecula y pterigion
Pinguecula y pterigionPinguecula y pterigion
Pinguecula y pterigionElias Farfan
 
Conjuntivitis, pterigion y pinguecula
Conjuntivitis, pterigion y pingueculaConjuntivitis, pterigion y pinguecula
Conjuntivitis, pterigion y pingueculaNabile Zuñiga
 
Pterygium and its management
Pterygium and its managementPterygium and its management
Pterygium and its managementDr-Anjali Hiroli
 
Visual field testing and interpretation
Visual field testing and interpretationVisual field testing and interpretation
Visual field testing and interpretationRaman Gupta
 
Lacrimal apparatus
Lacrimal apparatusLacrimal apparatus
Lacrimal apparatusAmr Mehrez
 
anatomy and physiology of lacrimal apparatus ppt
anatomy and physiology of lacrimal apparatus  pptanatomy and physiology of lacrimal apparatus  ppt
anatomy and physiology of lacrimal apparatus pptRohit Rao
 
Glaucoma & target iop
Glaucoma & target iopGlaucoma & target iop
Glaucoma & target iopdoseiha5
 

Viewers also liked (16)

Cornea
CorneaCornea
Cornea
 
PHP Coding in BEAR.Sunday
PHP Coding in BEAR.SundayPHP Coding in BEAR.Sunday
PHP Coding in BEAR.Sunday
 
Microscopic structure of retina dr paresh varsat
Microscopic structure of retina dr paresh varsat Microscopic structure of retina dr paresh varsat
Microscopic structure of retina dr paresh varsat
 
Dr.s.veni priya 18.2.16 deg cyst tumors
Dr.s.veni priya 18.2.16  deg cyst  tumorsDr.s.veni priya 18.2.16  deg cyst  tumors
Dr.s.veni priya 18.2.16 deg cyst tumors
 
Diseases of ocular motility with an emphasis on squint
Diseases of ocular motility with an emphasis on squintDiseases of ocular motility with an emphasis on squint
Diseases of ocular motility with an emphasis on squint
 
Pinguecula y pterigion
Pinguecula y pterigionPinguecula y pterigion
Pinguecula y pterigion
 
Pterigion
PterigionPterigion
Pterigion
 
Keratoconus
KeratoconusKeratoconus
Keratoconus
 
Conjuntivitis, pterigion y pinguecula
Conjuntivitis, pterigion y pingueculaConjuntivitis, pterigion y pinguecula
Conjuntivitis, pterigion y pinguecula
 
Pterygium and its management
Pterygium and its managementPterygium and its management
Pterygium and its management
 
Strabismus-Clinical Examinations
Strabismus-Clinical ExaminationsStrabismus-Clinical Examinations
Strabismus-Clinical Examinations
 
Visual field testing and interpretation
Visual field testing and interpretationVisual field testing and interpretation
Visual field testing and interpretation
 
Lacrimal apparatus
Lacrimal apparatusLacrimal apparatus
Lacrimal apparatus
 
anatomy and physiology of lacrimal apparatus ppt
anatomy and physiology of lacrimal apparatus  pptanatomy and physiology of lacrimal apparatus  ppt
anatomy and physiology of lacrimal apparatus ppt
 
Glaucoma & target iop
Glaucoma & target iopGlaucoma & target iop
Glaucoma & target iop
 
Pinguecula - An overview
Pinguecula - An overviewPinguecula - An overview
Pinguecula - An overview
 

Similar to A resource orientated framework using the DI/AOP/REST Triangle

Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)James Titcumb
 
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)James Titcumb
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications Juliana Lucena
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016Kacper Gunia
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf Conference
 
Multilingualism makes better programmers
Multilingualism makes better programmersMultilingualism makes better programmers
Multilingualism makes better programmersAlexander Varwijk
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony AppsKris Wallsmith
 
Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805LearningTech
 
Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805LearningTech
 
Embracing the Lollipop
Embracing the LollipopEmbracing the Lollipop
Embracing the LollipopSonja Kesic
 
TYPO3 Flow 2.0 (T3CON13 San Francisco)
TYPO3 Flow 2.0 (T3CON13 San Francisco)TYPO3 Flow 2.0 (T3CON13 San Francisco)
TYPO3 Flow 2.0 (T3CON13 San Francisco)Robert Lemke
 
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)James Titcumb
 
Web automation with #d8rules (European Drupal Days 2015)
Web automation with #d8rules (European Drupal Days 2015)Web automation with #d8rules (European Drupal Days 2015)
Web automation with #d8rules (European Drupal Days 2015)Eugenio Minardi
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationAbdul Malik Ikhsan
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowVrann Tulika
 
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.SundaySpout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.SundayRichard McIntyre
 

Similar to A resource orientated framework using the DI/AOP/REST Triangle (20)

Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
 
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
 
Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++
 
Multilingualism makes better programmers
Multilingualism makes better programmersMultilingualism makes better programmers
Multilingualism makes better programmers
 
Spout
SpoutSpout
Spout
 
Spout
SpoutSpout
Spout
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805
 
Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805Design pattern proxy介紹 20130805
Design pattern proxy介紹 20130805
 
Embracing the Lollipop
Embracing the LollipopEmbracing the Lollipop
Embracing the Lollipop
 
TYPO3 Flow 2.0 (T3CON13 San Francisco)
TYPO3 Flow 2.0 (T3CON13 San Francisco)TYPO3 Flow 2.0 (T3CON13 San Francisco)
TYPO3 Flow 2.0 (T3CON13 San Francisco)
 
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
 
Web automation with #d8rules (European Drupal Days 2015)
Web automation with #d8rules (European Drupal Days 2015)Web automation with #d8rules (European Drupal Days 2015)
Web automation with #d8rules (European Drupal Days 2015)
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request Flow
 
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.SundaySpout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
 

More from Akihito Koriyama

More from Akihito Koriyama (14)

PHPカンファレンス関西2014 「全てを結ぶ力」
PHPカンファレンス関西2014 「全てを結ぶ力」PHPカンファレンス関西2014 「全てを結ぶ力」
PHPカンファレンス関西2014 「全てを結ぶ力」
 
BEAR.Sunday 1.X
BEAR.Sunday 1.XBEAR.Sunday 1.X
BEAR.Sunday 1.X
 
BEAR.Sunday $app
BEAR.Sunday $appBEAR.Sunday $app
BEAR.Sunday $app
 
BEAR.Sunday@phpcon2012
BEAR.Sunday@phpcon2012BEAR.Sunday@phpcon2012
BEAR.Sunday@phpcon2012
 
An object graph visualizer for PHP - print_o
An object graph visualizer for PHP - print_oAn object graph visualizer for PHP - print_o
An object graph visualizer for PHP - print_o
 
BEAR.Sunday.meetup #0
BEAR.Sunday.meetup #0BEAR.Sunday.meetup #0
BEAR.Sunday.meetup #0
 
BEAR.Sunday Offline Talk
BEAR.Sunday Offline TalkBEAR.Sunday Offline Talk
BEAR.Sunday Offline Talk
 
BEAR.Sunday Note
BEAR.Sunday NoteBEAR.Sunday Note
BEAR.Sunday Note
 
PHP: Dis Is It
PHP: Dis Is ItPHP: Dis Is It
PHP: Dis Is It
 
The new era of PHP web development.
The new era of PHP web development.The new era of PHP web development.
The new era of PHP web development.
 
BEAR (Suday) design
BEAR (Suday) designBEAR (Suday) design
BEAR (Suday) design
 
BEAR DI
BEAR DIBEAR DI
BEAR DI
 
BEAR Architecture
BEAR ArchitectureBEAR Architecture
BEAR Architecture
 
BEAR v0.9 (Saturday)
BEAR v0.9 (Saturday)BEAR v0.9 (Saturday)
BEAR v0.9 (Saturday)
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

A resource orientated framework using the DI/AOP/REST Triangle

  • 1. A resource orientated framework using the DI /AOP/REST Triangle
  • 2. About Us • Akihito Koriyama • A Tokyo based freelance PHP architect • BEAR.Sunday lead, Aura PHP member • Richard McIntyre • Manchester / leeds based freelance PHP developer • BEAR.Sunday contributor, Lithium member
  • 3. About Us • Akihito Koriyama • A Tokyo based freelance PHP architect • BEAR.Sunday lead, Aura PHP member • Richard McIntyre • Manchester / Leeds based freelance PHP developer • BEAR.Sunday contributor, Lithium member
  • 4.
  • 5. BEAR.Sunday is an application framework. But it offers no libraries. (We have good stuff)
  • 6. instead, it offers three object frameworks.
  • 7. What is a framework ?
  • 8. “imposes a set of design constraints on end-user code.”
  • 9.
  • 10.
  • 13. DI Benefits • Dependency Inversion Principle • Clear separation of object instantiation and object usage • Object delivery
  • 14. DIP • Code should depend on things that are at the same or higher level of abstraction • High level policy should not depend on low level details
  • 15. “The principle of dependency inversion is at the root of many of the benefits claimed for object- oriented technology. Its proper application is necessary for the creation of reusable frameworks”
  • 17. /** * @Inject */ public function __construct(RenderInterface $renderer) { ... 1.annotate at injection point class RendererModule extends AbstractModule { protected function configure() { $this->bind('RenderInterface') ->to('HalRenderer') ->in(Scope::SINGLETON); } $injector = Inject::create([new RendererModule]]; 2 bind abstraction to concretion 3.create an injector
  • 18. /** * @Inject */ public function __construct(RenderInterface $renderer) { ... 1.annotate at injection point class RendererModule extends AbstractModule { protected function configure() { $this->bind('RenderInterface') ->to('HalRenderer') ->in(Scope::SINGLETON); } $injector = Inject::create([new RendererModule]]; 2. bind abstraction to concretion 3.create an injector
  • 19. /** * @Inject */ public function __construct(RenderInterface $renderer) { ... 1.annotate at injection point class RendererModule extends AbstractModule { protected function configure() { $this->bind('RenderInterface') ->to('HalRenderer') ->in(Scope::SINGLETON); } $injector = Inject::create([new RendererModule]]; 2 bind abstraction to concretion 3.create an injector
  • 20. $user = $injector->getInstance('UserInterface'); 4. Get an object graph from the $injector User Renderer Renderer Interface depends A B
  • 22. class RendererModule extends AbstractModule { protected function configure() { $this ->bind('RenderInterface') ->to('HalRenderer') ->in(Scope::SINGLETON); } } Only use concrete classes in compilation
  • 23. Only abstraction in runtime /** * @Inject */ public function __construct(RenderInterface $renderer) {
  • 24. DI Best practice “Your code should deal directly with the Injector as little as possible. Instead, you want to bootstrap your application by injecting one root object.”
  • 25. Application = one root object
  • 27.
  • 28. Application is root object retrieved with injector: $injector = Inject::create([new AppModule($context)]]; $app = $injector->getInstance(‘AppInterface’);
  • 30.
  • 31. Dependencies have other dependencies Each object either contains or belongs to.
  • 32. You get a application object graph. huge, but can be stored one single root value $app
  • 33. Application can be serialized. $app can be serialized and stored Injection is reused beyond requests.
  • 34. $app Object i/f i/f Object i/f i/f ObjectRouter Response JSON XM L 1st framework: DI Framework • annotations based DI framework w/ binding DSL • compilation / runtime separation • use only “plug/abstraction” at runtime • application a single large cached object • focus on structure not behavior
  • 36. What is AOP? Cache Log Auth A programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns
  • 37. /** * @Cache */ public function onGet($id) { // ... $this->body = $stmt->fetchAll(PDO::FETCH_ASSOC); return $this; } class Post extends AppModel { public function newest() { $result = Cache::read('newest_posts', 'longterm'); if (!$result) { $result = $this->find('all'); Cache::write('newest_posts', $result, 'longterm'); } return $result; } }
  • 39. MC Cache Cache is called by method invocation, If the cache is warm the model is never called. $obj->read(2); Miss !
  • 40. Aspects Core Concern Cross Cutting Concern Separation
  • 42. interface MethodInterceptor { public function invoke(MethodInvocation $invocation); } $invocation->proceed(); // invoked method $object = $invocation->getThis(); // get source object $args = $invocation->getArgs(); // get arguments
  • 43. class Transactional implements MethodInterceptor { public function invoke(MethodInvocation $invocation) { $object = $invocation->getThis(); $ref = new ReflectionProperty($object, 'db'); $ref->setAccessible(true); $db = $ref->getValue($object); $db->beginTransaction(); try { $invocation->proceed(); $db->commit(); } catch (Exception $e) { $db->rollback(); } } } `Transactional`interceptor Core Concern Cross Cutting Concern
  • 44. class CacheInterceptor implements MethodInterceptor { public function invoke(MethodInvocation $invocation) { $obj = $invocation->getThis(); $args = $invocation->getArguments(); $id = get_class($obj) . serialize($args); $saved = $this->cache->fetch($id); if ($saved) { return $saved; } $result = $invocation->proceed(); $this->cache->save($id, $result); return $result; } } `Cache`interceptor Core Concern Cross Cutting Concern
  • 45. Simply annotate, then create your binding Bind
  • 46. Layering by context • MVC, Is 3 enough ?
  • 50. Aspect layering by context Model Cache Form Transaction Auth Validation
  • 51. <?php class SandboxResourcePageIndexRay0000000071f9ab280000000033fb446fAop extends SandboxResourcePageIndex implements RayAopWeavedInterface { private $rayAopIntercept = true; public $rayAopBind; public function onGet() { // native call if (!isset($this->rayAopBind[__FUNCTION__])) { return call_user_func_array('parent::' . __FUNCTION__, func_get_args()); } // proceed source method from interceptor if (!$this->rayAopIntercept) { $this->rayAopIntercept = true; return call_user_func_array('parent::' . __FUNCTION__, func_get_args()); } // proceed next interceptor $this->rayAopIntercept = false; $interceptors = $this->rayAopBind[__FUNCTION__]; $annotation = isset($this->rayAopBind->annotation[__FUNCTION__]) ? $this->rayAopBind >annotation[__FUNCTION__] : null; $invocation = new RayAopReflectiveMethodInvocation(array($this, __FUNCTION__), func_get_args(), $interceptors, $annotation); return $invocation->proceed(); } Under the hood: Method interception sub class is created in order enable this interception and keep type safety.
  • 52. Runtime injection by aspect • method / parameter lookup • test friendly
  • 53. 2nd framework: Aspect Oriented Framework • AOP alliance standard • Layering by context • Type safe • Runtime injection
  • 54.
  • 55. Hypermedia framework for object as a service It allows objects to have RESTful web service benefits such as client-server, uniform interface, statelessness, resource expression with mutual connectivity and layered components.
  • 56. class Author extends ResourceObject { public $code = 200; public $headers = []; public $body = []; /** * @Link(rel="blog", href="app://self/blog/post?author_id={id}") */ public function onGet($id) { ... // change own state return $this; } public function onPost($name) { $this->code = 201; // created return $this; } public function onPut($id, $name)
  • 57. $user = $resource ->get ->uri('app://self/user') ->withQuery(['id' => 1]) ->eager ->request(); var_dump($user->body); // Array // ( // [name] => John // [age] => 15 //) echo $user; // <div id=”name”>John</div> // <div id=”age”>15</div> public function onGet($id) { $this[‘name’] = ‘John’; $this[‘age’] = 15; return $this; } User Profile Friend
  • 58. $order = $resource ->post ->uri('app://self/order') ->withQuery(['drink' => 'latte']) ->eager ->request(); $payment = [ 'credit_card_number' => '123456789', 'expires' => '07/07', 'name' => 'Koriym', 'amount' => '4.00' ]; // Now use a hyperlink to pay $response = $resource->href('pay', $payment); echo $response->code; // 201 Hypermedia as the Engine of Application State
  • 59. class Order extends ResourceObject { /** * * @Link(rel="pay", method="put", href="app://self/payment{?order_id,card_number,amount}") */ public function onPost($drink) { // data store here $this['drink'] = $drink; $this['order_id'] = $orderId; // created $this->code = 201; return $this; } Hypermedia as the Engine of Application State
  • 60. Order Payment hyper reference: pay HyperMedia Driven API
  • 61. The key of success of web • URI • Unified Interface • Hyperlink
  • 62. • API is hub • API is core value API driven development DB Mobil e Web API Cloud Moc k URI API API
  • 65.
  • 66.
  • 67.
  • 68.
  • 69. Performance • annotation ? dependency injection ? method interception ? DSL ? named parameter ? • Fast • cache all compiled object • http friendly architecture
  • 70. Scale • “model proxy” pattern • ‘app://self/blog/entry’ can be anything. • contextual injection makes db scale easy
  • 71. Hard spot / Soft spot • DI configure hardspot. per system • Aop configure softspot, change on request
  • 72. Connecting frameworks • DI - object as dependency • AOP - domain logic to application logic • Hypermedia - resource to resource
  • 73. Abstraction frameworks • DSL • Annotation • URI • Interface • Aspects • Hypermedia
  • 74.