SlideShare une entreprise Scribd logo
1  sur  36
MODULARIZING RESTFUL
WEB SERVICE MANAGEMENT
WITH
ASPECT ORIENTED PROGRAMMING
Authors
Widhian Bramantya Dana S. Kusumo Bayu Munajat
School of Computing
Informatics Engineering
Telkom University
widhian.bramantya@gmail.com
School of Computing
Informatics Engineering
Telkom University
danakusumo@telkomuniversity.ac.id
School of Computing
Informatics Engineering
Telkom University
bayu1887@gmail.com
1
2
3
4
Introduction
Outline
Proposed Construction
RESTful Web Service
How RESTful Web Service Works
Crosscutting Concern in RESTful Web
Service
Aspect Oriented Programming
Reusability Metric
Crosscutting Concern Identification
UML, ERD, API Design Conversion
RESTful Web Service Development
Result and Analysis
Conclusion
INTRODUCTION
Introduction
RESTful Web Service
Show all admin
GET /admin
Insert new admin
POST /admin
Show detail admin 1
GET /admin/1
Update admin 1
PUT /admin/1
Delete admin 1
DELETE /admin/1
<resource href="/admin">
<link href="{related link}" rel="{related rel}">
<resource href="/admin/1" rel="admin">
<id_admin>1</admin>
<name>bob</name>
</resource>
<resource href="/admin/2" rel="admin">
<id_admin>2</admin>
<name>alice</name>
</resource>
</resource>
API DB
request
response
Introduction
How RESTful Web Service Works
Browser /
Other
.htaccess
REST API
Get Request
Process API
Method I ()
Database
Method I () Method I ()
request
response
function processApi(){
$auth = $cache = $log = NULL;
$func = str_replace("/","" ,
$_REQUEST['request']);
$parameter = str_replace("/","",
$_REQUEST['attribute']);
$cache = new Cache();
$log = new Log();
$auth = new Auth();
$auth->auth_start($parameter);
$log->log_start($parameter);
$cache->cache_start($parameter);
$result = $this->$func($parameter);
$cache->cache_end($result);
$log->log_end($result);
}
Introduction
Crosscutting Concern in RESTful Web Service
Call Main Method
Cache Concern
Log Concern
Authentication Concern
class
Introduction
Aspect Oriented Programming
Authentication
First Logging
First Caching
Call Main Method
Last Caching
Last Logging
API
Class
API
Class
API
Class
Aspect
Authentication
Aspect Logging
Aspect Caching
class
Authentication
First Logging
First Caching
Call Main Method
Last Caching
Last Logging
class
Authentication
First Logging
First Caching
Call Main Method
Last Caching
Last Logging
class
advice
advice
advice
Introduction
Reusability Metrics
Reusability
Understandability
Flexibility
Separation of
Concerns
Size
Coupling
Cohesion
CDO, CDC, CDLOC
VS, LOC, NOA, WOC
CBC, DIT
LCOO
Qualities Factors Internal Attributes Metrices
Introduction
Reusability Metrics
No Metrics Definition
1 Concern Diffusion
over Components
(CDC)
Counts the number of primary components whose main
purpose is to contribute to the implementation of a
concern
2 Concern Diffusion
over Operations
(CDO)
Counts the number of primary operations whose main
purpose is to contribute to the implementation of a
concern
3 Concern Diffusion
over LOC (CDLOC)
Counts the number of transition points for each concern
through the lines of codes (concern switch)
7 Vocabulary Size (VS) Counts the number of system component, i.e. classes or
aspects.
8 Lines of Code (LOC) Counts the number of lines of codes.
Introduction
Reusability Metrics
No Metrics Definition
9 Number of
Attributes (NOA)
Counts the internal vocabulary of each component, i.e.
the number of attributes of each class or aspect
10 Weighted
Operations per
Component (WOC)
Measures the complexity of component in terms of its
operations.
4 Coupling Between
Components (CBC)
A component (class or aspect) as a tally number of other
components to which it is coupled.
5 Depth of Inheritance
Tree (DIT)
Counts the maximum length of a node to a root of the
tree
6 Lack of Cohesion in
Operations (LCOO)
Counts the lack of cohesion of a component. (inherited
class or aspect).
PROPOSED
CONSTRUCTION
Proposed Construction
1 2 3
Crosscutting
Concern
Identification
UML, ERD, and
API Design
Conversion
RESTful Web
Service
Development
Proposed Construction
Crosscutting Concern Identification
Identify & Describe Non-
Functional Concerns
Specify Functional
Requirements
Identify & Specify
Crosscutting Concern
Compose Crosscutting
Concerns into the UML
Models
Crosscutting Concern <Name>
Description <Executive description>
Priority <Priority can be Max, Med, and Min>
List of requirements <Requirements that describe the concern>
List of models <UML models influenced by the concern>
Proposed Construction
UML, ERD, and API Design Conversion
UML ERD API Design
{root}/
{resource 1}/
{…}/
{resource n}/
{id resource
1}/
{sub resource
1}/
{…}/
{sub resource
n}/
{id sub
resource 1}/
Proposed Construction
RESTful Web Service Development
OOPGet Request
Authentication
First Logging
First Caching
Process API
Last Caching
Last Logging
Method I Method II Method III
Class
Crosscutting
Concern
Proposed Construction
RESTful Web Service Development
OOP +
AOP
Get Request
Process API
Method I Method II Method III
Class
Aspect
Authentication
Aspect Logging
Aspect Caching
Proposed Construction
RESTful Web Service Development
<?php
class User {
function processApi(){
...
}
}
$api = new User();
$api->processApi();
?>
Proposed Construction
RESTful Web Service Development
<?php
class User {
function processApi() {
$func = str_replace("/","",$_REQUEST['request']);
$parameter = str_replace("/","",
$_REQUEST['attribute']);
$log = new Log($this);
$log->$func($parameter);
}
}
?>
<?php
class Log extend AOP {
function __construct($object){
AOP::__construct($object);
}
}
?>
<?php
class AOP {
$_inner = NULL;
function __construct($object){
$this->_inner = $object;
}
}
?>
Proposed Construction
RESTful Web Service Development
<?php
class Log extend AOP {
function __construct($object){
...
$this->inject_before_call(".*",
"before_advice");
$this->inject_after_call(".*",
"after_advice");
}
function before_advice(){. . .}
function after_advice(){. . .}
}
?>
<?php
class AOP {
$_before = array();
$_after = array();
function inject_before_call(){
$this->_before[] = array("/".$pattern."/",
$method_name);
}
function inject_after_call() {..}
}
?>
Proposed Construction
RESTful Web Service Development
<?php
class Log extend AOP {
function __construct() {
...
$this->inject_before_call(".*",
"before_advice");
$this->inject_after_call(".*",
"after_advice");
}
function before_advice(...) {...}
function after_advice(...) {...}
}
?>
<?php
class AOP {
$_before = array();
$_after = array();
function inject_before_call() {...}
function inject_after_call() {
$this->_after[] = array("/".$pattern."/",
$method_name);
}
}
?>
Proposed Construction
RESTful Web Service Development
<?php
class User {
function processApi() {
$func = str_replace("/","",
$_REQUEST['request']);
$parameter = str_replace("/","",
$_REQUEST['attribute']);
$log = new Log();
$log->$func($parameter);
}
}
?>
<?php
class Log extend AOP {
???
}
?>
<?php
class AOP {
???
}
?>
Proposed Construction
RESTful Web Service Development
<?php
class User {
function processApi() {
$func = str_replace("/","",
$_REQUEST['request']);
$parameter = str_replace("/","",
$_REQUEST['attribute']);
$log = new Log();
$log->$func($parameter);
}
}
?>
<?php
class AOP {
function __call($method_name,$params) {
...
}
}
?>
Proposed Construction
RESTful Web Service Development
<?php
class User {
function __call($method_name,$params) {
foreach($this->_before as $lookup) {
list($pattern,$before_method_name) = $lookup;
if(preg_match($pattern,$method_name)) {
call_user_func_array(array(
$this,$before_method_name),array(
$method_name,$params));
}
}
... // function to call $api->$func()
... // function to call after_advice()
}
}
?>
<?php
class Log extend AOP{
function before_advice($method_name,$params) {
// some code to save log start
}
}
?>
Proposed Construction
RESTful Web Service Development
<?php
class User {
function __call($method_name,$params) {
... // function to call before_advice()
$result = call_user_func_array(array($this->_inner,
$method_name),array($params);
... // function to call after_advice()
}
}
?>
<?php
class User{
function methodName($params) {
// main API code
}
}
?>
Proposed Construction
RESTful Web Service Development
<?php
class User {
function __call($method_name,$params) {
... // function to call before_advice()
... // function to call $api->$func()
foreach($this->_before as $lookup) {
list($pattern,$before_method_name) = $lookup;
if(preg_match($pattern,$method_name)) {
call_user_func_array(array($this,
$before_method_name),array($method_name,
$params,$result));
}
}
}
}
?>
<?php
class Log extend AOP {
function after_advice($method_name,$params,$result) {
// some code to save log start
}
}
?>
RESULT & ANALYSIS
Result and Analysis
PHP
E-commerce Authentication
Caching
Logging
Language Case Study Aspects
82
APIs
APIs
Result and Analysis
Separation of Concerns (SoC)
The Best:
OOP
45 47
0
50
Concern Diffusion over
Components (CDC)
CONCERNS
METRIC
Concern Diffusion over
Component (CDC)
OOP OOP + AOP
195
64
0
200
400
Concern Diffusion over
Operations (CDO)
CONCERNS
METRIC
Concern Diffusion over
Operation (CDO)
OOP OOP + AOP
453
266
0
500
Concern Diffusion over
Operations (CDO)
CONCERNS
METRIC
Concern Diffusion over LoC
(CDLoC)
OOP OOP + AOP
The Best:
OOP + AOP
The Best:
OOP + AOP
Result and Analysis
Size
44 44
0
20
40
60
Vocabulary Size
CLASSES
METRIC
Vocabulary Size (VS)
OOP OOP + AOP
36979 36531
0
20000
40000
Lines of Code
LINES
METRIC
Line of Code (LoC)
OOP OOP + AOP
158 163
0
100
200
Number of Attributes
ATTRIBUTES
METRIC
Number of Attributes (NoA)
OOP OOP + AOP
410 452
0
500
Weighted Operation per ComponentCOMPLEXITY
METRIC
Weighted Operations per
Component (WoC)
OOP OOP + AOP
The Best:
-
The Best:
OOP
The Best:
OOP + AOP
The Best:
OOP
Result and Analysis
Coupling
The Best:
OOP
198 201
0
200
400
Coupling Between
Components (CBC)
COUPLING
METRIC
Coupling Between
Component (CBC)
OOP OOP + AOP
39 39
0
50
Depth of Inheritance Tree
(DIT)
DEPTH
METRIC
Depth of Inheritance Tree
(DIT)
OOP OOP + AOP
The Best:
-
Result and Analysis
Cohesion
The Best:
OOP + AOP
181 155
0
100
200
Lack of Cohesion in
Operations (LCOO)
LACK
METRIC
Lack of Cohesion in
Operations (LCOO)
OOP OOP + AOP
Result and Analysis
Summary
Separation of Concerns (SoC) OOP+AOP
Size OOP
Coupling OOP
Cohesion OOP+AOP
The Best
CONCLUSION
Conclusion
The code of API class with OOP+AOP is still easier to be understood because of
separation between the functional requirement and aspects.1
The code of API class with OOP+AOP is more flexible than OOP if there is a significant
change in codes caused by grouping concerns.2
These finding have shown an evidence that REST-OOP+AOP is indicated more reusable
than REST-OOP.3
Thank You

Contenu connexe

Tendances

Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
Katrien Verbert
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
BG Java EE Course
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)
Oro Inc.
 
Working with oro crm entities
Working with oro crm entitiesWorking with oro crm entities
Working with oro crm entities
Oro Inc.
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
Guy Nir
 

Tendances (20)

Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
 
Using Java to implement SOAP Web Services: JAX-WS
Using Java to implement SOAP Web Services: JAX-WS�Using Java to implement SOAP Web Services: JAX-WS�
Using Java to implement SOAP Web Services: JAX-WS
 
Elefrant [ng-Poznan]
Elefrant [ng-Poznan]Elefrant [ng-Poznan]
Elefrant [ng-Poznan]
 
JAX-WS Basics
JAX-WS BasicsJAX-WS Basics
JAX-WS Basics
 
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - WisemblySymfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
Symfony2, Backbone.js &amp; socket.io - SfLive Paris 2k13 - Wisembly
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)
 
Slim Framework
Slim FrameworkSlim Framework
Slim Framework
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component Behaviors
 
Working with oro crm entities
Working with oro crm entitiesWorking with oro crm entities
Working with oro crm entities
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design Patterns
 
Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)Java API for XML Web Services (JAX-WS)
Java API for XML Web Services (JAX-WS)
 
Resting with OroCRM Webinar
Resting with OroCRM WebinarResting with OroCRM Webinar
Resting with OroCRM Webinar
 
OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
 
Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)
 
Angular genericforms2
Angular genericforms2Angular genericforms2
Angular genericforms2
 

En vedette

Rest presentation
Rest  presentationRest  presentation
Rest presentation
srividhyau
 
Architecture of a Modern Web App - SpringOne India
Architecture of a Modern Web App - SpringOne IndiaArchitecture of a Modern Web App - SpringOne India
Architecture of a Modern Web App - SpringOne India
Jeremy Grelle
 

En vedette (20)

Rest application
Rest applicationRest application
Rest application
 
Rest presentation
Rest  presentationRest  presentation
Rest presentation
 
Web components, so close!
Web components, so close!Web components, so close!
Web components, so close!
 
Implementation advantages of rest
Implementation advantages of restImplementation advantages of rest
Implementation advantages of rest
 
Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289
 
Architecture of a Modern Web App - SpringOne India
Architecture of a Modern Web App - SpringOne IndiaArchitecture of a Modern Web App - SpringOne India
Architecture of a Modern Web App - SpringOne India
 
Web services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGigWeb services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGig
 
Watson - a supercomputer
Watson - a supercomputerWatson - a supercomputer
Watson - a supercomputer
 
Chrome extensions
Chrome extensionsChrome extensions
Chrome extensions
 
A2 from soap to rest
A2 from soap to restA2 from soap to rest
A2 from soap to rest
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
 
IBM Watson & Open Source Software - LinuxCon 2012
IBM Watson & Open Source Software - LinuxCon 2012IBM Watson & Open Source Software - LinuxCon 2012
IBM Watson & Open Source Software - LinuxCon 2012
 
Soap vs rest
Soap vs restSoap vs rest
Soap vs rest
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 
Soap vs. rest - which is right web service protocol for your need?
Soap vs. rest -  which is right web service protocol for your need?Soap vs. rest -  which is right web service protocol for your need?
Soap vs. rest - which is right web service protocol for your need?
 
REST vs. SOAP
REST vs. SOAPREST vs. SOAP
REST vs. SOAP
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
REST beyond CRUD
REST beyond CRUDREST beyond CRUD
REST beyond CRUD
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
 

Similaire à Modularizing RESTful Web Service Management with Aspect Oriented Programming

Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptxTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
kmani5
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).pptTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
HusseinWassof
 
ebs-adapter-webcast12345678900000000.pdf
ebs-adapter-webcast12345678900000000.pdfebs-adapter-webcast12345678900000000.pdf
ebs-adapter-webcast12345678900000000.pdf
Brighton26
 
Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecture
rahmed_sct
 

Similaire à Modularizing RESTful Web Service Management with Aspect Oriented Programming (20)

Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptxTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).pptTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
 
ebs-adapter-webcast12345678900000000.pdf
ebs-adapter-webcast12345678900000000.pdfebs-adapter-webcast12345678900000000.pdf
ebs-adapter-webcast12345678900000000.pdf
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
 
O365 Saturday - Deepdive SharePoint Client Side Rendering
O365 Saturday - Deepdive SharePoint Client Side RenderingO365 Saturday - Deepdive SharePoint Client Side Rendering
O365 Saturday - Deepdive SharePoint Client Side Rendering
 
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful  Protocol BuffersJavaOne 2009 - TS-5276 - RESTful  Protocol Buffers
JavaOne 2009 - TS-5276 - RESTful Protocol Buffers
 
Getting Started with API Management
Getting Started with API ManagementGetting Started with API Management
Getting Started with API Management
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
 
Customizing Oracle EBS OA Framework
Customizing Oracle EBS OA FrameworkCustomizing Oracle EBS OA Framework
Customizing Oracle EBS OA Framework
 
Primavera integration possibilities Technical overview - Oracle Primavera Col...
Primavera integration possibilities Technical overview - Oracle Primavera Col...Primavera integration possibilities Technical overview - Oracle Primavera Col...
Primavera integration possibilities Technical overview - Oracle Primavera Col...
 
Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecture
 
Oracle World 2002 Leverage Web Services in E-Business Applications
Oracle World 2002 Leverage Web Services in E-Business ApplicationsOracle World 2002 Leverage Web Services in E-Business Applications
Oracle World 2002 Leverage Web Services in E-Business Applications
 
Olap
OlapOlap
Olap
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
Mashups
MashupsMashups
Mashups
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web Application
 
Oracle SOA Suite 12c 1z0-434 Day 1/3
Oracle SOA Suite 12c 1z0-434 Day 1/3Oracle SOA Suite 12c 1z0-434 Day 1/3
Oracle SOA Suite 12c 1z0-434 Day 1/3
 
Services Stanford 2012
Services Stanford 2012Services Stanford 2012
Services Stanford 2012
 
Drupalcon Mumbai
Drupalcon MumbaiDrupalcon Mumbai
Drupalcon Mumbai
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

Modularizing RESTful Web Service Management with Aspect Oriented Programming

  • 1. MODULARIZING RESTFUL WEB SERVICE MANAGEMENT WITH ASPECT ORIENTED PROGRAMMING
  • 2. Authors Widhian Bramantya Dana S. Kusumo Bayu Munajat School of Computing Informatics Engineering Telkom University widhian.bramantya@gmail.com School of Computing Informatics Engineering Telkom University danakusumo@telkomuniversity.ac.id School of Computing Informatics Engineering Telkom University bayu1887@gmail.com
  • 3. 1 2 3 4 Introduction Outline Proposed Construction RESTful Web Service How RESTful Web Service Works Crosscutting Concern in RESTful Web Service Aspect Oriented Programming Reusability Metric Crosscutting Concern Identification UML, ERD, API Design Conversion RESTful Web Service Development Result and Analysis Conclusion
  • 5. Introduction RESTful Web Service Show all admin GET /admin Insert new admin POST /admin Show detail admin 1 GET /admin/1 Update admin 1 PUT /admin/1 Delete admin 1 DELETE /admin/1 <resource href="/admin"> <link href="{related link}" rel="{related rel}"> <resource href="/admin/1" rel="admin"> <id_admin>1</admin> <name>bob</name> </resource> <resource href="/admin/2" rel="admin"> <id_admin>2</admin> <name>alice</name> </resource> </resource> API DB request response
  • 6. Introduction How RESTful Web Service Works Browser / Other .htaccess REST API Get Request Process API Method I () Database Method I () Method I () request response
  • 7. function processApi(){ $auth = $cache = $log = NULL; $func = str_replace("/","" , $_REQUEST['request']); $parameter = str_replace("/","", $_REQUEST['attribute']); $cache = new Cache(); $log = new Log(); $auth = new Auth(); $auth->auth_start($parameter); $log->log_start($parameter); $cache->cache_start($parameter); $result = $this->$func($parameter); $cache->cache_end($result); $log->log_end($result); } Introduction Crosscutting Concern in RESTful Web Service Call Main Method Cache Concern Log Concern Authentication Concern class
  • 8. Introduction Aspect Oriented Programming Authentication First Logging First Caching Call Main Method Last Caching Last Logging API Class API Class API Class Aspect Authentication Aspect Logging Aspect Caching class Authentication First Logging First Caching Call Main Method Last Caching Last Logging class Authentication First Logging First Caching Call Main Method Last Caching Last Logging class advice advice advice
  • 9. Introduction Reusability Metrics Reusability Understandability Flexibility Separation of Concerns Size Coupling Cohesion CDO, CDC, CDLOC VS, LOC, NOA, WOC CBC, DIT LCOO Qualities Factors Internal Attributes Metrices
  • 10. Introduction Reusability Metrics No Metrics Definition 1 Concern Diffusion over Components (CDC) Counts the number of primary components whose main purpose is to contribute to the implementation of a concern 2 Concern Diffusion over Operations (CDO) Counts the number of primary operations whose main purpose is to contribute to the implementation of a concern 3 Concern Diffusion over LOC (CDLOC) Counts the number of transition points for each concern through the lines of codes (concern switch) 7 Vocabulary Size (VS) Counts the number of system component, i.e. classes or aspects. 8 Lines of Code (LOC) Counts the number of lines of codes.
  • 11. Introduction Reusability Metrics No Metrics Definition 9 Number of Attributes (NOA) Counts the internal vocabulary of each component, i.e. the number of attributes of each class or aspect 10 Weighted Operations per Component (WOC) Measures the complexity of component in terms of its operations. 4 Coupling Between Components (CBC) A component (class or aspect) as a tally number of other components to which it is coupled. 5 Depth of Inheritance Tree (DIT) Counts the maximum length of a node to a root of the tree 6 Lack of Cohesion in Operations (LCOO) Counts the lack of cohesion of a component. (inherited class or aspect).
  • 13. Proposed Construction 1 2 3 Crosscutting Concern Identification UML, ERD, and API Design Conversion RESTful Web Service Development
  • 14. Proposed Construction Crosscutting Concern Identification Identify & Describe Non- Functional Concerns Specify Functional Requirements Identify & Specify Crosscutting Concern Compose Crosscutting Concerns into the UML Models Crosscutting Concern <Name> Description <Executive description> Priority <Priority can be Max, Med, and Min> List of requirements <Requirements that describe the concern> List of models <UML models influenced by the concern>
  • 15. Proposed Construction UML, ERD, and API Design Conversion UML ERD API Design {root}/ {resource 1}/ {…}/ {resource n}/ {id resource 1}/ {sub resource 1}/ {…}/ {sub resource n}/ {id sub resource 1}/
  • 16. Proposed Construction RESTful Web Service Development OOPGet Request Authentication First Logging First Caching Process API Last Caching Last Logging Method I Method II Method III Class Crosscutting Concern
  • 17. Proposed Construction RESTful Web Service Development OOP + AOP Get Request Process API Method I Method II Method III Class Aspect Authentication Aspect Logging Aspect Caching
  • 18. Proposed Construction RESTful Web Service Development <?php class User { function processApi(){ ... } } $api = new User(); $api->processApi(); ?>
  • 19. Proposed Construction RESTful Web Service Development <?php class User { function processApi() { $func = str_replace("/","",$_REQUEST['request']); $parameter = str_replace("/","", $_REQUEST['attribute']); $log = new Log($this); $log->$func($parameter); } } ?> <?php class Log extend AOP { function __construct($object){ AOP::__construct($object); } } ?> <?php class AOP { $_inner = NULL; function __construct($object){ $this->_inner = $object; } } ?>
  • 20. Proposed Construction RESTful Web Service Development <?php class Log extend AOP { function __construct($object){ ... $this->inject_before_call(".*", "before_advice"); $this->inject_after_call(".*", "after_advice"); } function before_advice(){. . .} function after_advice(){. . .} } ?> <?php class AOP { $_before = array(); $_after = array(); function inject_before_call(){ $this->_before[] = array("/".$pattern."/", $method_name); } function inject_after_call() {..} } ?>
  • 21. Proposed Construction RESTful Web Service Development <?php class Log extend AOP { function __construct() { ... $this->inject_before_call(".*", "before_advice"); $this->inject_after_call(".*", "after_advice"); } function before_advice(...) {...} function after_advice(...) {...} } ?> <?php class AOP { $_before = array(); $_after = array(); function inject_before_call() {...} function inject_after_call() { $this->_after[] = array("/".$pattern."/", $method_name); } } ?>
  • 22. Proposed Construction RESTful Web Service Development <?php class User { function processApi() { $func = str_replace("/","", $_REQUEST['request']); $parameter = str_replace("/","", $_REQUEST['attribute']); $log = new Log(); $log->$func($parameter); } } ?> <?php class Log extend AOP { ??? } ?> <?php class AOP { ??? } ?>
  • 23. Proposed Construction RESTful Web Service Development <?php class User { function processApi() { $func = str_replace("/","", $_REQUEST['request']); $parameter = str_replace("/","", $_REQUEST['attribute']); $log = new Log(); $log->$func($parameter); } } ?> <?php class AOP { function __call($method_name,$params) { ... } } ?>
  • 24. Proposed Construction RESTful Web Service Development <?php class User { function __call($method_name,$params) { foreach($this->_before as $lookup) { list($pattern,$before_method_name) = $lookup; if(preg_match($pattern,$method_name)) { call_user_func_array(array( $this,$before_method_name),array( $method_name,$params)); } } ... // function to call $api->$func() ... // function to call after_advice() } } ?> <?php class Log extend AOP{ function before_advice($method_name,$params) { // some code to save log start } } ?>
  • 25. Proposed Construction RESTful Web Service Development <?php class User { function __call($method_name,$params) { ... // function to call before_advice() $result = call_user_func_array(array($this->_inner, $method_name),array($params); ... // function to call after_advice() } } ?> <?php class User{ function methodName($params) { // main API code } } ?>
  • 26. Proposed Construction RESTful Web Service Development <?php class User { function __call($method_name,$params) { ... // function to call before_advice() ... // function to call $api->$func() foreach($this->_before as $lookup) { list($pattern,$before_method_name) = $lookup; if(preg_match($pattern,$method_name)) { call_user_func_array(array($this, $before_method_name),array($method_name, $params,$result)); } } } } ?> <?php class Log extend AOP { function after_advice($method_name,$params,$result) { // some code to save log start } } ?>
  • 28. Result and Analysis PHP E-commerce Authentication Caching Logging Language Case Study Aspects 82 APIs APIs
  • 29. Result and Analysis Separation of Concerns (SoC) The Best: OOP 45 47 0 50 Concern Diffusion over Components (CDC) CONCERNS METRIC Concern Diffusion over Component (CDC) OOP OOP + AOP 195 64 0 200 400 Concern Diffusion over Operations (CDO) CONCERNS METRIC Concern Diffusion over Operation (CDO) OOP OOP + AOP 453 266 0 500 Concern Diffusion over Operations (CDO) CONCERNS METRIC Concern Diffusion over LoC (CDLoC) OOP OOP + AOP The Best: OOP + AOP The Best: OOP + AOP
  • 30. Result and Analysis Size 44 44 0 20 40 60 Vocabulary Size CLASSES METRIC Vocabulary Size (VS) OOP OOP + AOP 36979 36531 0 20000 40000 Lines of Code LINES METRIC Line of Code (LoC) OOP OOP + AOP 158 163 0 100 200 Number of Attributes ATTRIBUTES METRIC Number of Attributes (NoA) OOP OOP + AOP 410 452 0 500 Weighted Operation per ComponentCOMPLEXITY METRIC Weighted Operations per Component (WoC) OOP OOP + AOP The Best: - The Best: OOP The Best: OOP + AOP The Best: OOP
  • 31. Result and Analysis Coupling The Best: OOP 198 201 0 200 400 Coupling Between Components (CBC) COUPLING METRIC Coupling Between Component (CBC) OOP OOP + AOP 39 39 0 50 Depth of Inheritance Tree (DIT) DEPTH METRIC Depth of Inheritance Tree (DIT) OOP OOP + AOP The Best: -
  • 32. Result and Analysis Cohesion The Best: OOP + AOP 181 155 0 100 200 Lack of Cohesion in Operations (LCOO) LACK METRIC Lack of Cohesion in Operations (LCOO) OOP OOP + AOP
  • 33. Result and Analysis Summary Separation of Concerns (SoC) OOP+AOP Size OOP Coupling OOP Cohesion OOP+AOP The Best
  • 35. Conclusion The code of API class with OOP+AOP is still easier to be understood because of separation between the functional requirement and aspects.1 The code of API class with OOP+AOP is more flexible than OOP if there is a significant change in codes caused by grouping concerns.2 These finding have shown an evidence that REST-OOP+AOP is indicated more reusable than REST-OOP.3