SlideShare a Scribd company logo
Building API’s A.K.A. making your module extensible
Who Am I? Adam A. Gregory Drupal Developer, Themer, Consultant, and Trainer Using Drupal For 5+ years Built and maintain  numerous modules/themes on Drupal.org Been involved in Drupal projects large and small Recently released my first API module, Piecemaker API, & currently converting the Theme Editor module to more of an API in D7
What We’ll Cover What is an API How it applies to building modules How do I code an API module? Planning Proper structures (hooks, classes) Drupal Coding Standards Code, Test, Code, Test Give Examples (example.api.php) Release into the wild Real World Examples
What is an API? Application Programming Interface Allows other code/programs/modules/etc. to reutilize it’s utilities, resources, and/or services Provides a more efficient code base in Drupal (ussually) Drupal is essentially a big API, or rather a group of API’s
How do I code an API module? Code, Pray, Test,  Yell, Throw computer in pool, Give up, Become a monk.
Planning A good plan violently executed now is better than a perfect plan executed next week. 		- General George S. Patton Use a whiteboard, mindmap, pad of paper Think through possible uses, by both devs and end users Steal ideas! (It’s OK, that’s what Open Source is for)
Proper Structures Classes Drupal is moving slowly but surely to a more OOP approach so try to plan for that. In D7 there is auto loading of Classes so it makes for more efficient code. In order to utilize classes you must initialize classes dynamically, not statically. (May also apply to methods depending on your module use) Classes can easily be extended so they are preferable.
Proper Structures Hooks You can write an entire API that only utilizes hooks. Hooks will be needed even in API that are mostly OOP. The entire Drupal system was built as a hooker so it  is easily understood by most developers
Drupal Coding Standards In order for your module to be extensible it MUST, MUST, MUST conform to Drupal coding standards and practices. Common mistakes Not using a theme() function for ANY html output Not using drupal_alter() to allow other modules access Not Documenting properly: PHPDoc, example.api.php
Code, Test, Code, Test
Give Examples Document you code thoroughly Use your own hooks if possible Provide an example.api.php that shows some implementations of your hooks and classes Code the first module that implements the API and include it.
Release it into the wild! You’ve done it right? Not so fast my friend… No you have to support it. Provide documentation on Drupal.org Answer Issues Fix bugs Provide Support Make improvements Make new releases Lather, Rinse, Repeat
Lets Look At Some Code Views, Fields, Piecemaker
Q&A You ask. I answer. Lets keep it simple… Not the questions, just the subtitle.
Adam A. Gregory Web: Causecast.org NewhallWeb.com Twitter: @adamgregory Email: arcaneadam@gmail.com Adam@NewhallWeb.com Drupal: arcaneadam

More Related Content

What's hot

Building better WordPress applications
Building better WordPress applicationsBuilding better WordPress applications
Building better WordPress applications
Phill Brown
 
Opensources benefits
Opensources benefitsOpensources benefits
Opensources benefits
Beehexa
 
Opensources benefits withlogo phanvugiap_gurutheme.com
Opensources benefits withlogo phanvugiap_gurutheme.comOpensources benefits withlogo phanvugiap_gurutheme.com
Opensources benefits withlogo phanvugiap_gurutheme.com
Beehexa
 
Java and effective programming. Is it possible? - IAESTE Case Week 2016
Java and effective programming. Is it possible? - IAESTE Case Week 2016Java and effective programming. Is it possible? - IAESTE Case Week 2016
Java and effective programming. Is it possible? - IAESTE Case Week 2016
Łukasz Koniecki
 
Effective programming in Java - Kronospan Job Fair 2016
Effective programming in Java - Kronospan Job Fair 2016Effective programming in Java - Kronospan Job Fair 2016
Effective programming in Java - Kronospan Job Fair 2016
Łukasz Koniecki
 
Functional Programming Concept
Functional Programming ConceptFunctional Programming Concept
Functional Programming Concept
ailhanli
 
Static site best practices
Static site best practicesStatic site best practices
Static site best practices
Allanki Srinivas
 
Not All Heroes Wear Capes: Skills and Tools Helpful in Becoming a Support Sup...
Not All Heroes Wear Capes: Skills and Tools Helpful in Becoming a Support Sup...Not All Heroes Wear Capes: Skills and Tools Helpful in Becoming a Support Sup...
Not All Heroes Wear Capes: Skills and Tools Helpful in Becoming a Support Sup...
Atlassian
 
Selenium and Cucumber Automation Services
Selenium and Cucumber Automation ServicesSelenium and Cucumber Automation Services
Selenium and Cucumber Automation Services
LMS Solutions (India) Pvt.Ltd.
 
Appex technologies
Appex technologiesAppex technologies
Appex technologies
NIVETHAS52
 

What's hot (10)

Building better WordPress applications
Building better WordPress applicationsBuilding better WordPress applications
Building better WordPress applications
 
Opensources benefits
Opensources benefitsOpensources benefits
Opensources benefits
 
Opensources benefits withlogo phanvugiap_gurutheme.com
Opensources benefits withlogo phanvugiap_gurutheme.comOpensources benefits withlogo phanvugiap_gurutheme.com
Opensources benefits withlogo phanvugiap_gurutheme.com
 
Java and effective programming. Is it possible? - IAESTE Case Week 2016
Java and effective programming. Is it possible? - IAESTE Case Week 2016Java and effective programming. Is it possible? - IAESTE Case Week 2016
Java and effective programming. Is it possible? - IAESTE Case Week 2016
 
Effective programming in Java - Kronospan Job Fair 2016
Effective programming in Java - Kronospan Job Fair 2016Effective programming in Java - Kronospan Job Fair 2016
Effective programming in Java - Kronospan Job Fair 2016
 
Functional Programming Concept
Functional Programming ConceptFunctional Programming Concept
Functional Programming Concept
 
Static site best practices
Static site best practicesStatic site best practices
Static site best practices
 
Not All Heroes Wear Capes: Skills and Tools Helpful in Becoming a Support Sup...
Not All Heroes Wear Capes: Skills and Tools Helpful in Becoming a Support Sup...Not All Heroes Wear Capes: Skills and Tools Helpful in Becoming a Support Sup...
Not All Heroes Wear Capes: Skills and Tools Helpful in Becoming a Support Sup...
 
Selenium and Cucumber Automation Services
Selenium and Cucumber Automation ServicesSelenium and Cucumber Automation Services
Selenium and Cucumber Automation Services
 
Appex technologies
Appex technologiesAppex technologies
Appex technologies
 

Viewers also liked

Flexible site building with Fields and Views
Flexible site building with Fields and ViewsFlexible site building with Fields and Views
Flexible site building with Fields and Views
arcaneadam
 
Advanced Theming
Advanced ThemingAdvanced Theming
Advanced Theming
arcaneadam
 
Creating an API with Expressive
Creating an API with ExpressiveCreating an API with Expressive
Creating an API with Expressive
Elton Minetto
 
A Random Walk Down Wall Street
A Random Walk Down Wall StreetA Random Walk Down Wall Street
A Random Walk Down Wall Street
arcaneadam
 
Test api
Test apiTest api
Test api
Ivo Manolov
 
Testing Plan Test Case
Testing Plan Test CaseTesting Plan Test Case
Testing Plan Test Case
guest4c6fd6
 
Amazon search test case document
Amazon search test case documentAmazon search test case document
Amazon search test case document
Sunil Kumar Gunasekaran
 

Viewers also liked (7)

Flexible site building with Fields and Views
Flexible site building with Fields and ViewsFlexible site building with Fields and Views
Flexible site building with Fields and Views
 
Advanced Theming
Advanced ThemingAdvanced Theming
Advanced Theming
 
Creating an API with Expressive
Creating an API with ExpressiveCreating an API with Expressive
Creating an API with Expressive
 
A Random Walk Down Wall Street
A Random Walk Down Wall StreetA Random Walk Down Wall Street
A Random Walk Down Wall Street
 
Test api
Test apiTest api
Test api
 
Testing Plan Test Case
Testing Plan Test CaseTesting Plan Test Case
Testing Plan Test Case
 
Amazon search test case document
Amazon search test case documentAmazon search test case document
Amazon search test case document
 

Similar to Building API's

Contributing to Drupal
Contributing to DrupalContributing to Drupal
Contributing to Drupal
Chris Skene
 
Domas monkus drupal module development
Domas monkus drupal module developmentDomas monkus drupal module development
Domas monkus drupal module development
Domas Monkus
 
Adapter design-pattern2015
Adapter design-pattern2015Adapter design-pattern2015
Adapter design-pattern2015
Vic Tarchenko
 
Intro to drupal
Intro to drupalIntro to drupal
Intro to drupal
arcaneadam
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
rupeshchanchal
 
Drupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutionsDrupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutions
php2ranjan
 
Creating Drupal A Module
Creating Drupal A ModuleCreating Drupal A Module
Creating Drupal A Module
arcaneadam
 
Bending the odoo learning curve - Odoo Experience 2015
Bending the odoo learning curve - Odoo Experience 2015Bending the odoo learning curve - Odoo Experience 2015
Bending the odoo learning curve - Odoo Experience 2015
Daniel Reis
 
Enterprise PHP
Enterprise PHPEnterprise PHP
Enterprise PHP
John Coggeshall
 
Introducing drupal
Introducing  drupalIntroducing  drupal
Introducing drupal
Gokul Muralidharan
 
Making The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowMaking The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To Swallow
Philip Norton
 
Recipe of a rockstar developer
Recipe of a rockstar developerRecipe of a rockstar developer
Recipe of a rockstar developer
Topu Newaj
 
Drupal
DrupalDrupal
Making the Most of Modern PHP in Drupal 7
Making the Most of Modern PHP in Drupal 7Making the Most of Modern PHP in Drupal 7
Making the Most of Modern PHP in Drupal 7
Ryan Szrama
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Mack Hardy
 
Drupal: blog and beyond
Drupal: blog and beyondDrupal: blog and beyond
Drupal: blog and beyond
Sugree Phatanapherom
 
REPL-driven development with pry
REPL-driven development with pry  REPL-driven development with pry
REPL-driven development with pry
Stephen Mariano Cabrera
 
MVC Frameworks for building PHP Web Applications
MVC Frameworks for building PHP Web ApplicationsMVC Frameworks for building PHP Web Applications
MVC Frameworks for building PHP Web Applications
Vforce Infotech
 
Hello Drupal!
Hello Drupal!Hello Drupal!
Hello Drupal!
Acquia
 
The Drupal Way
The Drupal WayThe Drupal Way
The Drupal Way
Barcamp Kerala
 

Similar to Building API's (20)

Contributing to Drupal
Contributing to DrupalContributing to Drupal
Contributing to Drupal
 
Domas monkus drupal module development
Domas monkus drupal module developmentDomas monkus drupal module development
Domas monkus drupal module development
 
Adapter design-pattern2015
Adapter design-pattern2015Adapter design-pattern2015
Adapter design-pattern2015
 
Intro to drupal
Intro to drupalIntro to drupal
Intro to drupal
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
Drupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutionsDrupal training-by-ruchiwebsolutions
Drupal training-by-ruchiwebsolutions
 
Creating Drupal A Module
Creating Drupal A ModuleCreating Drupal A Module
Creating Drupal A Module
 
Bending the odoo learning curve - Odoo Experience 2015
Bending the odoo learning curve - Odoo Experience 2015Bending the odoo learning curve - Odoo Experience 2015
Bending the odoo learning curve - Odoo Experience 2015
 
Enterprise PHP
Enterprise PHPEnterprise PHP
Enterprise PHP
 
Introducing drupal
Introducing  drupalIntroducing  drupal
Introducing drupal
 
Making The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowMaking The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To Swallow
 
Recipe of a rockstar developer
Recipe of a rockstar developerRecipe of a rockstar developer
Recipe of a rockstar developer
 
Drupal
DrupalDrupal
Drupal
 
Making the Most of Modern PHP in Drupal 7
Making the Most of Modern PHP in Drupal 7Making the Most of Modern PHP in Drupal 7
Making the Most of Modern PHP in Drupal 7
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Drupal: blog and beyond
Drupal: blog and beyondDrupal: blog and beyond
Drupal: blog and beyond
 
REPL-driven development with pry
REPL-driven development with pry  REPL-driven development with pry
REPL-driven development with pry
 
MVC Frameworks for building PHP Web Applications
MVC Frameworks for building PHP Web ApplicationsMVC Frameworks for building PHP Web Applications
MVC Frameworks for building PHP Web Applications
 
Hello Drupal!
Hello Drupal!Hello Drupal!
Hello Drupal!
 
The Drupal Way
The Drupal WayThe Drupal Way
The Drupal Way
 

Recently uploaded

Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 

Recently uploaded (20)

Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 

Building API's

  • 1. Building API’s A.K.A. making your module extensible
  • 2. Who Am I? Adam A. Gregory Drupal Developer, Themer, Consultant, and Trainer Using Drupal For 5+ years Built and maintain numerous modules/themes on Drupal.org Been involved in Drupal projects large and small Recently released my first API module, Piecemaker API, & currently converting the Theme Editor module to more of an API in D7
  • 3. What We’ll Cover What is an API How it applies to building modules How do I code an API module? Planning Proper structures (hooks, classes) Drupal Coding Standards Code, Test, Code, Test Give Examples (example.api.php) Release into the wild Real World Examples
  • 4. What is an API? Application Programming Interface Allows other code/programs/modules/etc. to reutilize it’s utilities, resources, and/or services Provides a more efficient code base in Drupal (ussually) Drupal is essentially a big API, or rather a group of API’s
  • 5. How do I code an API module? Code, Pray, Test, Yell, Throw computer in pool, Give up, Become a monk.
  • 6. Planning A good plan violently executed now is better than a perfect plan executed next week. - General George S. Patton Use a whiteboard, mindmap, pad of paper Think through possible uses, by both devs and end users Steal ideas! (It’s OK, that’s what Open Source is for)
  • 7. Proper Structures Classes Drupal is moving slowly but surely to a more OOP approach so try to plan for that. In D7 there is auto loading of Classes so it makes for more efficient code. In order to utilize classes you must initialize classes dynamically, not statically. (May also apply to methods depending on your module use) Classes can easily be extended so they are preferable.
  • 8. Proper Structures Hooks You can write an entire API that only utilizes hooks. Hooks will be needed even in API that are mostly OOP. The entire Drupal system was built as a hooker so it is easily understood by most developers
  • 9. Drupal Coding Standards In order for your module to be extensible it MUST, MUST, MUST conform to Drupal coding standards and practices. Common mistakes Not using a theme() function for ANY html output Not using drupal_alter() to allow other modules access Not Documenting properly: PHPDoc, example.api.php
  • 11. Give Examples Document you code thoroughly Use your own hooks if possible Provide an example.api.php that shows some implementations of your hooks and classes Code the first module that implements the API and include it.
  • 12. Release it into the wild! You’ve done it right? Not so fast my friend… No you have to support it. Provide documentation on Drupal.org Answer Issues Fix bugs Provide Support Make improvements Make new releases Lather, Rinse, Repeat
  • 13. Lets Look At Some Code Views, Fields, Piecemaker
  • 14. Q&A You ask. I answer. Lets keep it simple… Not the questions, just the subtitle.
  • 15. Adam A. Gregory Web: Causecast.org NewhallWeb.com Twitter: @adamgregory Email: arcaneadam@gmail.com Adam@NewhallWeb.com Drupal: arcaneadam