SlideShare una empresa de Scribd logo
1 de 15
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

Más contenido relacionado

La actualidad más candente

Opensources benefits withlogo phanvugiap_gurutheme.com
Opensources benefits withlogo phanvugiap_gurutheme.comOpensources benefits withlogo phanvugiap_gurutheme.com
Opensources benefits withlogo phanvugiap_gurutheme.com
Beehexa
 

La actualidad más candente (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
 

Destacado (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 a Building API's

Contributing to Drupal
Contributing to DrupalContributing to Drupal
Contributing to Drupal
Chris Skene
 
Creating Drupal A Module
Creating Drupal A ModuleCreating Drupal A Module
Creating Drupal A Module
arcaneadam
 
Recipe of a rockstar developer
Recipe of a rockstar developerRecipe of a rockstar developer
Recipe of a rockstar developer
Topu Newaj
 
Hello Drupal!
Hello Drupal!Hello Drupal!
Hello Drupal!
Acquia
 

Similar a 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
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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...
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

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