SlideShare uma empresa Scribd logo
1 de 57
Baixar para ler offline
Engr. Ranel O. Padon	

 	
ranel.padon@gmail.com | https://github.com/ranelpadon	 	
Switchable Map APIs with Drupal
About Me
•  Software Engineer at Kite Systems (Hong Kong-based company)	
–  full-time Drupal developer for CNN Travel (our client)	
•  part-time Python lecturer in University of the Philippines	
•  involved with programming for 9 years (Python, Java, etc)	
•  involved in Drupal for the last 4 years	
•  projects: http://github.com/ranelpadon	
•  plays competitive football/futsal
Topics
•  Background	
– Use Case	
– Mapstraction JS Library and Drupal Module	
– Design Patterns	
•  Strategy Design Pattern	
•  CNN Travel Maps System	
– APIs: Google Maps, HERE Maps, MapBox	
– Map Widget	
– Service Info
Background
•  we want to inject maps and custom texts in our	
	node pages (via CKEditor) 	
	and term pages (via Drupal blocks)	
•  we will need to have a modular/flexible architecture	
	for integrating maps since our partners will vary	
	from time to time.
Mapstraction JS Library
Mapstraction JS Library
Mapstraction JS Library
Mapstraction Drupal Module
Mapstraction Drupal Module
Mapstraction
•  “Mapstraction is a Javascript library that provides a
single, common interface for a wide variety of
Javascript map APIs.”	
		
•  “It’s designed to enable a developer to switch from
one maps API to another as smoothly and as quickly
as possible.”
Mapstraction
•  codebase is huge/heavy and complex	
		
•  outdated or not well-maintained	
•  we decided to create a custom library/module 	
	for our needs
Design Patterns
Design Patterns
•  “I’ve been struck by one of the underlying principles	
	that leads to better designs: remove duplication. 	
	So, avoiding repetition is a simple principle 	
	that leads to good design.”	
–  Martin Fowler	
–  http://martinfowler.com/ieeeSoftware/repetition.pdf
Design Patterns
•  “Identify what is common and what varies, 	
	find a way to isolate the common stuff from the	
	variations, then remove the redundancy in the	
	common stuff.”
Design Patterns
•  Software design patterns are proven/reusable
solutions for usual programming problems	
•  “.. are formalized best practices that the programmer
can use to solve common problems when designing
an application or system.”	
•  “.. can speed up the development process 	
	by providing tested, proven development paradigms.”
Design Patterns
•  they are language-agnostic (Java, PHP, Python, …)	
•  usually in the context of OOP	
	(Object-Oriented Programming)
Design Patterns
Design Patterns
Design Patterns
Design Patterns
Strategy Design Pattern
•  We used the Strategy Design Pattern before using
PHP in our advertisement blocks rendering. 		
•  Advertisement content changes dynamically
depending on its region info/context in the page.	
•  This design pattern is used in some parts of jQuery
core components and in the Controller components/
mechanisms of MVC JavaScript frameworks like
AngularJS.
Strategy Design Pattern
•  enables an algorithm's behavior to be selected at
runtime:	
–  defines a family of algorithms,	
–  encapsulates each algorithm, and	
–  makes the algorithms interchangeable within that family.
Strategy Design Pattern
Strategy Design Pattern
Strategy Design Pattern
•  test the performance of different sorting algorithms
to an array of numbers: shell sort, heap sort, bubble
sort, quicksort, etc. 	
•  Strategy pattern allows the test program to loop
through all algorithms, simply by changing them at
runtime and test each of these against the array. 	
•  All method signatures must be the same so that they
can vary without the client program knowing about
it.
Strategy Design Pattern
•  product order that needs to be shipped from a
warehouse to a customer. 	
•  Shipping is the Context and the 3 shipping companies
UPS, USPS, and Fedex are the Strategies.
Strategy Design Pattern
•  The map code logic will not not be tightly coupled to
the TripAdvisor/Booking.com data for better
modularity.	
•  We could easily switch between HERE Maps API and
Google Maps API and other APIs.	
•  We could add/remove Map APIs as needed with
minimal code adjustments.
Strategy Design Pattern
•  Likewise, the same Strategy Design Pattern could be
applied when we expand later our data/content
partners/providers (TripAdvisor, Booking.com, etc).
Typical Use Case/Construct
Strategy Design Pattern
better, extendable solution
Strategy Design Pattern
OOP solution
Strategy Design Pattern
Strategy Design Pattern
Strategy Design Pattern
CNN Travel Maps System
CNN Travel Maps | Markup
CNN Travel Maps | HERE Maps
CNN Travel Maps | GMaps
CNN Travel Maps | Mapbox
CNN Travel Maps | Service Info
CNN Travel Maps | Service Info
CNN Travel Maps | Service Info
Partner Hotel
CNN Travel Maps | Service Info
Partner Hotel
CNN Travel Maps | Service Info
TripAdvisor Reviews
CNN Travel Maps | Service Info
TripAdvisor Photos
CNN Travel Maps JS
CNN Travel Maps | Form API
CNN Travel Maps System
CNN Travel Maps System
CNN Travel Maps System
CNN Travel Maps System
Recommendation
•  One of the best resources about Design Patterns:	
•  https://sourcemaking.com/design_patterns	
•  https://sourcemaking.com/design-patterns-book
Special Thanks
•  CNN Travel (http://travel.cnn.com) for the
ideas and inspiration for this presentation.
Switchable Map APIs with Drupal

Mais conteúdo relacionado

Destaque (9)

Python Programming - III. Controlling the Flow
Python Programming - III. Controlling the FlowPython Programming - III. Controlling the Flow
Python Programming - III. Controlling the Flow
 
Python Programming - XII. File Processing
Python Programming - XII. File ProcessingPython Programming - XII. File Processing
Python Programming - XII. File Processing
 
Python Programming - V. Sequences (List and Tuples) and Dictionaries
Python Programming - V. Sequences (List and Tuples) and DictionariesPython Programming - V. Sequences (List and Tuples) and Dictionaries
Python Programming - V. Sequences (List and Tuples) and Dictionaries
 
Python Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator OverloadingPython Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator Overloading
 
Python Programming - IX. On Randomness
Python Programming - IX. On RandomnessPython Programming - IX. On Randomness
Python Programming - IX. On Randomness
 
Python Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingPython Programming - XIII. GUI Programming
Python Programming - XIII. GUI Programming
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
 
Python Programming - VI. Classes and Objects
Python Programming - VI. Classes and ObjectsPython Programming - VI. Classes and Objects
Python Programming - VI. Classes and Objects
 
Python Programming - I. Introduction
Python Programming - I. IntroductionPython Programming - I. Introduction
Python Programming - I. Introduction
 

Semelhante a Switchable Map APIs with Drupal

DesignExamplesGordonCohen-lowres
DesignExamplesGordonCohen-lowresDesignExamplesGordonCohen-lowres
DesignExamplesGordonCohen-lowres
Gordon Cohen
 

Semelhante a Switchable Map APIs with Drupal (20)

Reconnect17 PeopleSoft Supply Chain Management SIG Meeting
Reconnect17 PeopleSoft Supply Chain Management SIG MeetingReconnect17 PeopleSoft Supply Chain Management SIG Meeting
Reconnect17 PeopleSoft Supply Chain Management SIG Meeting
 
Continuous delivery for machine learning
Continuous delivery for machine learningContinuous delivery for machine learning
Continuous delivery for machine learning
 
Recruiting for Drupal #Hiring
Recruiting for Drupal #HiringRecruiting for Drupal #Hiring
Recruiting for Drupal #Hiring
 
Maruti gollapudi cv
Maruti gollapudi cvMaruti gollapudi cv
Maruti gollapudi cv
 
Using graphs for recommendations
Using graphs for recommendationsUsing graphs for recommendations
Using graphs for recommendations
 
Viva slides_secured objective programming
Viva slides_secured objective programmingViva slides_secured objective programming
Viva slides_secured objective programming
 
Aakanksha_Agnani_j2016
Aakanksha_Agnani_j2016Aakanksha_Agnani_j2016
Aakanksha_Agnani_j2016
 
Alex mang patterns for scalability in microsoft azure application
Alex mang   patterns for scalability in microsoft azure applicationAlex mang   patterns for scalability in microsoft azure application
Alex mang patterns for scalability in microsoft azure application
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android Devices
 
planning-and-costing2.pptx
planning-and-costing2.pptxplanning-and-costing2.pptx
planning-and-costing2.pptx
 
SEF 2014 - Responsive Design in SharePoint 2013
SEF 2014 - Responsive Design in SharePoint 2013SEF 2014 - Responsive Design in SharePoint 2013
SEF 2014 - Responsive Design in SharePoint 2013
 
A Case for Outside-In Design
A Case for Outside-In DesignA Case for Outside-In Design
A Case for Outside-In Design
 
Eurostars MODELS Project, System modeling and design exploration of applicati...
Eurostars MODELS Project, System modeling and design exploration of applicati...Eurostars MODELS Project, System modeling and design exploration of applicati...
Eurostars MODELS Project, System modeling and design exploration of applicati...
 
MODELS, a unified environment for the design of system applications on parall...
MODELS, a unified environment for the design of system applications on parall...MODELS, a unified environment for the design of system applications on parall...
MODELS, a unified environment for the design of system applications on parall...
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
 
Magnolia 6 release walkthrough
Magnolia 6 release walkthroughMagnolia 6 release walkthrough
Magnolia 6 release walkthrough
 
DesignExamplesGordonCohen-lowres
DesignExamplesGordonCohen-lowresDesignExamplesGordonCohen-lowres
DesignExamplesGordonCohen-lowres
 
Architecturing the software stack at a small business
Architecturing the software stack at a small businessArchitecturing the software stack at a small business
Architecturing the software stack at a small business
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
 

Mais de Ranel Padon

Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Ranel Padon
 
PyCon PH 2014 - GeoComputation
PyCon PH 2014 - GeoComputationPyCon PH 2014 - GeoComputation
PyCon PH 2014 - GeoComputation
Ranel Padon
 
Web Mapping with Drupal
Web Mapping with DrupalWeb Mapping with Drupal
Web Mapping with Drupal
Ranel Padon
 

Mais de Ranel Padon (8)

CKEditor Widgets with Drupal
CKEditor Widgets with DrupalCKEditor Widgets with Drupal
CKEditor Widgets with Drupal
 
Views Unlimited: Unleashing the Power of Drupal's Views Module
Views Unlimited: Unleashing the Power of Drupal's Views ModuleViews Unlimited: Unleashing the Power of Drupal's Views Module
Views Unlimited: Unleashing the Power of Drupal's Views Module
 
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
Batch Scripting with Drupal (Featuring the EntityFieldQuery API)
 
PyCon PH 2014 - GeoComputation
PyCon PH 2014 - GeoComputationPyCon PH 2014 - GeoComputation
PyCon PH 2014 - GeoComputation
 
Power and Elegance - Leaflet + jQuery
Power and Elegance - Leaflet + jQueryPower and Elegance - Leaflet + jQuery
Power and Elegance - Leaflet + jQuery
 
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
Python Programming - IV. Program Components (Functions, Classes, Modules, Pac...
 
Of Nodes and Maps (Web Mapping with Drupal - Part II)
Of Nodes and Maps (Web Mapping with Drupal - Part II)Of Nodes and Maps (Web Mapping with Drupal - Part II)
Of Nodes and Maps (Web Mapping with Drupal - Part II)
 
Web Mapping with Drupal
Web Mapping with DrupalWeb Mapping with Drupal
Web Mapping with Drupal
 

Último

Último (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
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
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Switchable Map APIs with Drupal