SlideShare a Scribd company logo
1 of 73
Architecting Drupal Modules
           Report from the Frontlines
Ronald Ashri
                   Directory of Technology




t: @ronald_istos
Ronald Ashri
                   Directory of Technology




t: @ronald_istos
Ronald Ashri
                   Directory of Technology




t: @ronald_istos
Ronald Ashri
                   Directory of Technology




                           actSMART


t: @ronald_istos
building modules
                                                        path not always clear




  drupal




                                                 you
http://www.flickr.com/photos/hesketh/2249658529
example 1
I want my module to use a javascript library
example 1
                                      I want my module to use a javascript library



http://drupal.org/node/304255



The PHP function drupal_add_js() lets you add a JavaScript file,
setting or inline code to the page and it takes 5 parameters (see
the api reference).
example 1
                                      I want my module to use a javascript library



http://drupal.org/node/304255
                                                            http://drupal.org/node/304255

The PHP function drupal_add_js() lets you add a JavaScript file,
setting or inline code to the page and it takes 5 parameters (see
the api reference).
example 1
I want my module to use a javascript library
example 1
I want my module to use a javascript library
example 1
I want my module to use a javascript library
http://www.flickr.com/photos/42302655@N02/4064741545
let’s take a step back
                                                 what are we trying to do here



                APIs (FAPI, DBTNG, ...)

                    Hooks (Events)
DRUPAL
          Library Functions (e.g. check_plain)

         Systems (Menu, Search, Node Access)


                                                           MY
                                                         MODULE
Building Software
Methodology, Framework, Patterns, Architecture
Building Software
                             Methodology, Framework, Patterns, Architecture



    Methodology
    A set of guidelines /
 processes that accompany
you from problem definition
        to solution
Building Software
                             Methodology, Framework, Patterns, Architecture



    Methodology                                Framework
    A set of guidelines /                 Provides reusable elements
 processes that accompany                and underlying structure you
you from problem definition                         plug into
        to solution
Building Software
                             Methodology, Framework, Patterns, Architecture



    Methodology                                  Framework
    A set of guidelines /                 Provides reusable elements
 processes that accompany                and underlying structure you
you from problem definition                         plug into
        to solution



                             Patterns
                     Proven reusable solutions
Building Software
                             Methodology, Framework, Patterns, Architecture



    Methodology                                   Framework
    A set of guidelines /                  Provides reusable elements
 processes that accompany                 and underlying structure you
you from problem definition                          plug into
        to solution



                             Patterns
                     Proven reusable solutions




                      Your Architecture
                     Elements and relationships
                          between them
Building Software
                             Methodology, Framework, Patterns, Architecture



    Methodology                                   Framework
    A set of guidelines /                  Provides reusable elements
 processes that accompany                 and underlying structure you
you from problem definition                          plug into
        to solution



                             Patterns
                     Proven reusable solutions




                      Your Architecture
                     Elements and relationships
                          between them
Building Software
                             Methodology, Framework, Patterns, Architecture



    Methodology                                   Framework
    A set of guidelines /                  Provides reusable elements
 processes that accompany                 and underlying structure you
you from problem definition                          plug into
        to solution



                             Patterns
                     Proven reusable solutions




                      Your Architecture
                     Elements and relationships
                          between them
Building Software
                             Methodology, Framework, Patterns, Architecture



    Methodology                                   Framework
    A set of guidelines /                  Provides reusable elements
 processes that accompany                 and underlying structure you
you from problem definition                          plug into
        to solution



                             Patterns
                     Proven reusable solutions




                      Your Architecture
                     Elements and relationships
                          between them
Building Drupal Modules
                             Methodology, Framework, Patterns, Architecture


                                                  Drupal
    Methodology      ?
    A set of guidelines /
                                                  Framework
                                             Provides reusable elements
 processes that accompany                   and underlying structure you
you from problem definition                            plug into
        to solution



                             Patterns   ?
                     Proven reusable solutions




                    Your Drupal Module
                       Architecture
                    Elements and relationships
example 2
how should I structure my files?
example 2
                     how should I structure my files?



everything in the root of your module
directory
example 2
                      how should I structure my files?



everything in the root of your module
directory

.module, .info in root, images in images, js
in js, inc in includes, views in views
example 2
                      how should I structure my files?



everything in the root of your module
directory

.module, .info in root, images in images, js
in js, inc in includes, views in views

some in root, some in directories based on
history, module evolution, style changes,
etc
example 3
how should I name my files
example 3
                             how should I name my files



.module, .info, .inc, .install, .test
example 3
                             how should I name my files



.module, .info, .inc, .install, .test

occasionaly throw in: .theme, .install.inc
example 3
                             how should I name my files



.module, .info, .inc, .install, .test

occasionaly throw in: .theme, .install.inc

sometimes: .<modulename>.<thing>.inc,
ClassName.inc
example 3
                             how should I name my files



.module, .info, .inc, .install, .test

occasionaly throw in: .theme, .install.inc

sometimes: .<modulename>.<thing>.inc,
ClassName.inc

myconventionisbetter.me
example 3
                             how should I name my files



.module, .info, .inc, .install, .test

occasionaly throw in: .theme, .install.inc

sometimes: .<modulename>.<thing>.inc,
ClassName.inc

myconventionisbetter.me

no! MyConventionIsBetter.class.inc
example 4
I need to store data
example 4
                         I need to store data



my table via hook_schema + DBTNG
example 4
                             I need to store data



my table via hook_schema + DBTNG

entities are the way to go - always!
(maybe?)
example 4
                             I need to store data



my table via hook_schema + DBTNG

entities are the way to go - always!
(maybe?)

fields, then a fieldgroup entity (or node)
to add what you are missing
example 4
                             I need to store data



my table via hook_schema + DBTNG

entities are the way to go - always!
(maybe?)

fields, then a fieldgroup entity (or node)
to add what you are missing

is your data content or configuration?
Guidelines
what is important in general
Guidelines
                                   what is important in general


Drupal is a complex system of many interlinked parts

There are always many ways to skin a cat...
Guidelines
                                   what is important in general


Drupal is a complex system of many interlinked parts
                                                        what the...?
There are always many ways to skin a cat...
Guidelines
                                   what is important in general


Drupal is a complex system of many interlinked parts
                                                        what the...?
There are always many ways to skin a cat...



    It’s not about the recipes
    - it’s about the principles

      Guidelines + Patterns
Guidelines
what is important in general
Guidelines
                          what is important in general



Separation of concerns - (e.g. logic in
modules, presentation that can fully by
managed by themes, flexible admin)
Guidelines
                          what is important in general



Separation of concerns - (e.g. logic in
modules, presentation that can fully by
managed by themes, flexible admin)

Decoupled - more smaller modules that
incrementally add functionality, OO where
possible
Guidelines
                          what is important in general



Separation of concerns - (e.g. logic in
modules, presentation that can fully by
managed by themes, flexible admin)

Decoupled - more smaller modules that
incrementally add functionality, OO where
possible

Consistent - similar things always happen and
are described in the same way
Define Problem and Design
     not in a Drupal specific way
Define Problem and Design
                       not in a Drupal specific way


You module solves a problem - you should be
able to describe that in generic terms.
Define Problem and Design
                         not in a Drupal specific way


You module solves a problem - you should be
able to describe that in generic terms.

  A hotel owner needs to be able to display a
  list of available rooms with their associated
  descriptions given an arrival and departure
  date
Define Problem and Design
                         not in a Drupal specific way


You module solves a problem - you should be
able to describe that in generic terms.

  A hotel owner needs to be able to display a
  list of available rooms with their associated
  descriptions given an arrival and departure
  date

  Vs: I need to get all bookable unit entities
  and attach a field entity reference to them
  pointing to Room Description nodes that I
  can then render in Rooms view mode
Define Problem and Design
     not in a Drupal specific way
Define Problem and Design
                         not in a Drupal specific way



Describe your architecture in generic terms
first and then in specific Drupal terms
Define Problem and Design
                         not in a Drupal specific way



Describe your architecture in generic terms
first and then in specific Drupal terms

  Allows you to focus on what’s important
  and not get distracted by how Drupal does
  things
Define Problem and Design
                         not in a Drupal specific way



Describe your architecture in generic terms
first and then in specific Drupal terms

  Allows you to focus on what’s important
  and not get distracted by how Drupal does
  things

  Enables you to better choose what Drupal
  way to use subsequently
Patterns - OO Patterns
     Entity API, Subdomain
Patterns - OO Patterns
                                    Entity API, Subdomain



Entity API offers interfaces and implementation of
those interfaces as well as helper “procedural” style
functions
Patterns - OO Patterns
                                    Entity API, Subdomain



Entity API offers interfaces and implementation of
those interfaces as well as helper “procedural” style
functions

Subdomain offers all of its core functionality via a
class - you can extend/replace via your own module
Patterns - OO Patterns
                                    Entity API, Subdomain



Entity API offers interfaces and implementation of
those interfaces as well as helper “procedural” style
functions

Subdomain offers all of its core functionality via a
class - you can extend/replace via your own module

  Allows us to plug into “known” generic ways of
  doing things - reduces the burden of Drupal to
  define new styles
Patterns - Drupal Patterns
            Views, Commerce
Patterns - Drupal Patterns
                                    Views, Commerce



Separate UI from core module functionality
Patterns - Drupal Patterns
                                    Views, Commerce



Separate UI from core module functionality

  Allows us to focus on each and replace
Patterns - Drupal Patterns
                                     Views, Commerce



Separate UI from core module functionality

  Allows us to focus on each and replace

  Form submit handlers, etc should use you
  “core engine” functions - avoid stuffing a lot of
  logic there
Patterns - Drupal Patterns
                                     Views, Commerce



Separate UI from core module functionality

  Allows us to focus on each and replace

  Form submit handlers, etc should use you
  “core engine” functions - avoid stuffing a lot of
  logic there

  Can switch UI off for performace gains
Patterns - Service Patterns
                     Rooms
Patterns - Service Patterns
                                             Rooms

Where possible decouple interaction points
within same module
Patterns - Service Patterns
                                             Rooms

Where possible decouple interaction points
within same module

  Rooms produces all availability data in JSON
  following a callback
Patterns - Service Patterns
                                             Rooms

Where possible decouple interaction points
within same module

  Rooms produces all availability data in JSON
  following a callback

  Allows us to use any number of display
  techinques such as the FullCalendar JS
  library
Patterns - Service Patterns
                                             Rooms

Where possible decouple interaction points
within same module

  Rooms produces all availability data in JSON
  following a callback

  Allows us to use any number of display
  techinques such as the FullCalendar JS
  library

  Can easily abstract and connect to non-
  Drupal site
in conclusion
in conclusion



need to work on methodology
in conclusion



need to work on methodology

start collecting and documenting
patterns
in conclusion



need to work on methodology

start collecting and documenting
patterns

discuss conventions
in conclusion



need to work on methodology

start collecting and documenting
patterns

discuss conventions

talk to me if interested - @ronald_istos

More Related Content

Viewers also liked

Viewers also liked (20)

Workplace Ethics
Workplace EthicsWorkplace Ethics
Workplace Ethics
 
Virtue and vice 7
Virtue and vice 7Virtue and vice 7
Virtue and vice 7
 
Workplace ethics
Workplace  ethicsWorkplace  ethics
Workplace ethics
 
Ethics in workplace
Ethics in workplaceEthics in workplace
Ethics in workplace
 
Professional ethical conduct
Professional ethical conductProfessional ethical conduct
Professional ethical conduct
 
Business ethics and ethics in workplace
Business ethics and ethics in workplaceBusiness ethics and ethics in workplace
Business ethics and ethics in workplace
 
Presentations tips
Presentations tipsPresentations tips
Presentations tips
 
Workplace ethics
Workplace ethicsWorkplace ethics
Workplace ethics
 
Ethics and Organizations
Ethics and OrganizationsEthics and Organizations
Ethics and Organizations
 
Workplace Ethics
Workplace EthicsWorkplace Ethics
Workplace Ethics
 
Business Ethics Class Presentation - Racism in Workplace
Business Ethics Class Presentation - Racism in WorkplaceBusiness Ethics Class Presentation - Racism in Workplace
Business Ethics Class Presentation - Racism in Workplace
 
Business ethics and spirituality at work place
Business ethics and spirituality at work placeBusiness ethics and spirituality at work place
Business ethics and spirituality at work place
 
Work Ethic
Work EthicWork Ethic
Work Ethic
 
Ethics in workplace
Ethics in workplaceEthics in workplace
Ethics in workplace
 
Ethics in the Workplace!
Ethics in the Workplace!Ethics in the Workplace!
Ethics in the Workplace!
 
Business Ethics an Introduction
Business Ethics an IntroductionBusiness Ethics an Introduction
Business Ethics an Introduction
 
Unethical Business by Cocacola
Unethical Business by CocacolaUnethical Business by Cocacola
Unethical Business by Cocacola
 
Business Ethics
Business EthicsBusiness Ethics
Business Ethics
 
What is ethics
What is ethicsWhat is ethics
What is ethics
 
Introduction to ethics first class ppt
Introduction to ethics first class pptIntroduction to ethics first class ppt
Introduction to ethics first class ppt
 

Similar to Architecting Drupal Modules - Report from the frontlines

Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design PatternSanae BEKKAR
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General IntroductionAsma CHERIF
 
Drupal Roadmap 2010
Drupal Roadmap 2010Drupal Roadmap 2010
Drupal Roadmap 2010kathyhh
 
Code Craftsmanship Checklist
Code Craftsmanship ChecklistCode Craftsmanship Checklist
Code Craftsmanship ChecklistRyan Polk
 
4+1view architecture
4+1view architecture4+1view architecture
4+1view architecturedrewz lin
 
4+1view architecture
4+1view architecture4+1view architecture
4+1view architectureTot Bob
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patternsAmit Kabra
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design patternMindfire Solutions
 
Growing Drupal Organisations - Drupal Business Days 2012
Growing Drupal Organisations - Drupal Business Days 2012Growing Drupal Organisations - Drupal Business Days 2012
Growing Drupal Organisations - Drupal Business Days 2012Exove
 
Software engineering: design for reuse
Software engineering: design for reuseSoftware engineering: design for reuse
Software engineering: design for reuseMarco Brambilla
 
Contributing to Drupal
Contributing to DrupalContributing to Drupal
Contributing to DrupalChris Skene
 
Oose unit 4 ppt
Oose unit 4 pptOose unit 4 ppt
Oose unit 4 pptDr VISU P
 
Cse 6007 fall2012
Cse 6007 fall2012Cse 6007 fall2012
Cse 6007 fall2012rhrashel
 
CS8494 SOFTWARE ENGINEERING Unit-3
CS8494 SOFTWARE ENGINEERING Unit-3CS8494 SOFTWARE ENGINEERING Unit-3
CS8494 SOFTWARE ENGINEERING Unit-3SIMONTHOMAS S
 
OOSE Unit 4 PPT.ppt
OOSE Unit 4 PPT.pptOOSE Unit 4 PPT.ppt
OOSE Unit 4 PPT.pptitadmin33
 

Similar to Architecting Drupal Modules - Report from the frontlines (20)

Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design Pattern
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
Drupal Roadmap 2010
Drupal Roadmap 2010Drupal Roadmap 2010
Drupal Roadmap 2010
 
Code Craftsmanship Checklist
Code Craftsmanship ChecklistCode Craftsmanship Checklist
Code Craftsmanship Checklist
 
4+1view architecture
4+1view architecture4+1view architecture
4+1view architecture
 
4+1view architecture
4+1view architecture4+1view architecture
4+1view architecture
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
 
Slides chapter 9
Slides chapter 9Slides chapter 9
Slides chapter 9
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
 
Growing Drupal Organisations - Drupal Business Days 2012
Growing Drupal Organisations - Drupal Business Days 2012Growing Drupal Organisations - Drupal Business Days 2012
Growing Drupal Organisations - Drupal Business Days 2012
 
Software engineering: design for reuse
Software engineering: design for reuseSoftware engineering: design for reuse
Software engineering: design for reuse
 
Contributing to Drupal
Contributing to DrupalContributing to Drupal
Contributing to Drupal
 
Oose unit 4 ppt
Oose unit 4 pptOose unit 4 ppt
Oose unit 4 ppt
 
CHAPTER12.ppt
CHAPTER12.pptCHAPTER12.ppt
CHAPTER12.ppt
 
Cse 6007 fall2012
Cse 6007 fall2012Cse 6007 fall2012
Cse 6007 fall2012
 
CS8494 SOFTWARE ENGINEERING Unit-3
CS8494 SOFTWARE ENGINEERING Unit-3CS8494 SOFTWARE ENGINEERING Unit-3
CS8494 SOFTWARE ENGINEERING Unit-3
 
Ch09
Ch09Ch09
Ch09
 
Ch09
Ch09Ch09
Ch09
 
OOSE Unit 4 PPT.ppt
OOSE Unit 4 PPT.pptOOSE Unit 4 PPT.ppt
OOSE Unit 4 PPT.ppt
 

More from Ronald Ashri

An AI Bot will Build and Run your next site… eventually
An AI Bot will Build and Run your next site… eventuallyAn AI Bot will Build and Run your next site… eventually
An AI Bot will Build and Run your next site… eventuallyRonald Ashri
 
The Why and How of Applications with APIs and microservices
The Why and How of Applications with APIs and microservicesThe Why and How of Applications with APIs and microservices
The Why and How of Applications with APIs and microservicesRonald Ashri
 
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsFrom Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsRonald Ashri
 
Drupal Entities - Emerging Patterns of Usage
Drupal Entities - Emerging Patterns of UsageDrupal Entities - Emerging Patterns of Usage
Drupal Entities - Emerging Patterns of UsageRonald Ashri
 
Linking Open, Big Data Using Semantic Web Technologies - An Introduction
Linking Open, Big Data Using Semantic Web Technologies - An IntroductionLinking Open, Big Data Using Semantic Web Technologies - An Introduction
Linking Open, Big Data Using Semantic Web Technologies - An IntroductionRonald Ashri
 
How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...
How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...
How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...Ronald Ashri
 

More from Ronald Ashri (6)

An AI Bot will Build and Run your next site… eventually
An AI Bot will Build and Run your next site… eventuallyAn AI Bot will Build and Run your next site… eventually
An AI Bot will Build and Run your next site… eventually
 
The Why and How of Applications with APIs and microservices
The Why and How of Applications with APIs and microservicesThe Why and How of Applications with APIs and microservices
The Why and How of Applications with APIs and microservices
 
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsFrom Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the Dots
 
Drupal Entities - Emerging Patterns of Usage
Drupal Entities - Emerging Patterns of UsageDrupal Entities - Emerging Patterns of Usage
Drupal Entities - Emerging Patterns of Usage
 
Linking Open, Big Data Using Semantic Web Technologies - An Introduction
Linking Open, Big Data Using Semantic Web Technologies - An IntroductionLinking Open, Big Data Using Semantic Web Technologies - An Introduction
Linking Open, Big Data Using Semantic Web Technologies - An Introduction
 
How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...
How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...
How to Make Entities and Influence Drupal - Emerging Patterns from Drupal Con...
 

Recently uploaded

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Architecting Drupal Modules - Report from the frontlines

  • 1. Architecting Drupal Modules Report from the Frontlines
  • 2. Ronald Ashri Directory of Technology t: @ronald_istos
  • 3. Ronald Ashri Directory of Technology t: @ronald_istos
  • 4. Ronald Ashri Directory of Technology t: @ronald_istos
  • 5. Ronald Ashri Directory of Technology actSMART t: @ronald_istos
  • 6. building modules path not always clear drupal you http://www.flickr.com/photos/hesketh/2249658529
  • 7. example 1 I want my module to use a javascript library
  • 8. example 1 I want my module to use a javascript library http://drupal.org/node/304255 The PHP function drupal_add_js() lets you add a JavaScript file, setting or inline code to the page and it takes 5 parameters (see the api reference).
  • 9. example 1 I want my module to use a javascript library http://drupal.org/node/304255 http://drupal.org/node/304255 The PHP function drupal_add_js() lets you add a JavaScript file, setting or inline code to the page and it takes 5 parameters (see the api reference).
  • 10. example 1 I want my module to use a javascript library
  • 11. example 1 I want my module to use a javascript library
  • 12. example 1 I want my module to use a javascript library
  • 14. let’s take a step back what are we trying to do here APIs (FAPI, DBTNG, ...) Hooks (Events) DRUPAL Library Functions (e.g. check_plain) Systems (Menu, Search, Node Access) MY MODULE
  • 16. Building Software Methodology, Framework, Patterns, Architecture Methodology A set of guidelines / processes that accompany you from problem definition to solution
  • 17. Building Software Methodology, Framework, Patterns, Architecture Methodology Framework A set of guidelines / Provides reusable elements processes that accompany and underlying structure you you from problem definition plug into to solution
  • 18. Building Software Methodology, Framework, Patterns, Architecture Methodology Framework A set of guidelines / Provides reusable elements processes that accompany and underlying structure you you from problem definition plug into to solution Patterns Proven reusable solutions
  • 19. Building Software Methodology, Framework, Patterns, Architecture Methodology Framework A set of guidelines / Provides reusable elements processes that accompany and underlying structure you you from problem definition plug into to solution Patterns Proven reusable solutions Your Architecture Elements and relationships between them
  • 20. Building Software Methodology, Framework, Patterns, Architecture Methodology Framework A set of guidelines / Provides reusable elements processes that accompany and underlying structure you you from problem definition plug into to solution Patterns Proven reusable solutions Your Architecture Elements and relationships between them
  • 21. Building Software Methodology, Framework, Patterns, Architecture Methodology Framework A set of guidelines / Provides reusable elements processes that accompany and underlying structure you you from problem definition plug into to solution Patterns Proven reusable solutions Your Architecture Elements and relationships between them
  • 22. Building Software Methodology, Framework, Patterns, Architecture Methodology Framework A set of guidelines / Provides reusable elements processes that accompany and underlying structure you you from problem definition plug into to solution Patterns Proven reusable solutions Your Architecture Elements and relationships between them
  • 23. Building Drupal Modules Methodology, Framework, Patterns, Architecture Drupal Methodology ? A set of guidelines / Framework Provides reusable elements processes that accompany and underlying structure you you from problem definition plug into to solution Patterns ? Proven reusable solutions Your Drupal Module Architecture Elements and relationships
  • 24. example 2 how should I structure my files?
  • 25. example 2 how should I structure my files? everything in the root of your module directory
  • 26. example 2 how should I structure my files? everything in the root of your module directory .module, .info in root, images in images, js in js, inc in includes, views in views
  • 27. example 2 how should I structure my files? everything in the root of your module directory .module, .info in root, images in images, js in js, inc in includes, views in views some in root, some in directories based on history, module evolution, style changes, etc
  • 28. example 3 how should I name my files
  • 29. example 3 how should I name my files .module, .info, .inc, .install, .test
  • 30. example 3 how should I name my files .module, .info, .inc, .install, .test occasionaly throw in: .theme, .install.inc
  • 31. example 3 how should I name my files .module, .info, .inc, .install, .test occasionaly throw in: .theme, .install.inc sometimes: .<modulename>.<thing>.inc, ClassName.inc
  • 32. example 3 how should I name my files .module, .info, .inc, .install, .test occasionaly throw in: .theme, .install.inc sometimes: .<modulename>.<thing>.inc, ClassName.inc myconventionisbetter.me
  • 33. example 3 how should I name my files .module, .info, .inc, .install, .test occasionaly throw in: .theme, .install.inc sometimes: .<modulename>.<thing>.inc, ClassName.inc myconventionisbetter.me no! MyConventionIsBetter.class.inc
  • 34. example 4 I need to store data
  • 35. example 4 I need to store data my table via hook_schema + DBTNG
  • 36. example 4 I need to store data my table via hook_schema + DBTNG entities are the way to go - always! (maybe?)
  • 37. example 4 I need to store data my table via hook_schema + DBTNG entities are the way to go - always! (maybe?) fields, then a fieldgroup entity (or node) to add what you are missing
  • 38. example 4 I need to store data my table via hook_schema + DBTNG entities are the way to go - always! (maybe?) fields, then a fieldgroup entity (or node) to add what you are missing is your data content or configuration?
  • 40. Guidelines what is important in general Drupal is a complex system of many interlinked parts There are always many ways to skin a cat...
  • 41. Guidelines what is important in general Drupal is a complex system of many interlinked parts what the...? There are always many ways to skin a cat...
  • 42. Guidelines what is important in general Drupal is a complex system of many interlinked parts what the...? There are always many ways to skin a cat... It’s not about the recipes - it’s about the principles Guidelines + Patterns
  • 44. Guidelines what is important in general Separation of concerns - (e.g. logic in modules, presentation that can fully by managed by themes, flexible admin)
  • 45. Guidelines what is important in general Separation of concerns - (e.g. logic in modules, presentation that can fully by managed by themes, flexible admin) Decoupled - more smaller modules that incrementally add functionality, OO where possible
  • 46. Guidelines what is important in general Separation of concerns - (e.g. logic in modules, presentation that can fully by managed by themes, flexible admin) Decoupled - more smaller modules that incrementally add functionality, OO where possible Consistent - similar things always happen and are described in the same way
  • 47. Define Problem and Design not in a Drupal specific way
  • 48. Define Problem and Design not in a Drupal specific way You module solves a problem - you should be able to describe that in generic terms.
  • 49. Define Problem and Design not in a Drupal specific way You module solves a problem - you should be able to describe that in generic terms. A hotel owner needs to be able to display a list of available rooms with their associated descriptions given an arrival and departure date
  • 50. Define Problem and Design not in a Drupal specific way You module solves a problem - you should be able to describe that in generic terms. A hotel owner needs to be able to display a list of available rooms with their associated descriptions given an arrival and departure date Vs: I need to get all bookable unit entities and attach a field entity reference to them pointing to Room Description nodes that I can then render in Rooms view mode
  • 51. Define Problem and Design not in a Drupal specific way
  • 52. Define Problem and Design not in a Drupal specific way Describe your architecture in generic terms first and then in specific Drupal terms
  • 53. Define Problem and Design not in a Drupal specific way Describe your architecture in generic terms first and then in specific Drupal terms Allows you to focus on what’s important and not get distracted by how Drupal does things
  • 54. Define Problem and Design not in a Drupal specific way Describe your architecture in generic terms first and then in specific Drupal terms Allows you to focus on what’s important and not get distracted by how Drupal does things Enables you to better choose what Drupal way to use subsequently
  • 55. Patterns - OO Patterns Entity API, Subdomain
  • 56. Patterns - OO Patterns Entity API, Subdomain Entity API offers interfaces and implementation of those interfaces as well as helper “procedural” style functions
  • 57. Patterns - OO Patterns Entity API, Subdomain Entity API offers interfaces and implementation of those interfaces as well as helper “procedural” style functions Subdomain offers all of its core functionality via a class - you can extend/replace via your own module
  • 58. Patterns - OO Patterns Entity API, Subdomain Entity API offers interfaces and implementation of those interfaces as well as helper “procedural” style functions Subdomain offers all of its core functionality via a class - you can extend/replace via your own module Allows us to plug into “known” generic ways of doing things - reduces the burden of Drupal to define new styles
  • 59. Patterns - Drupal Patterns Views, Commerce
  • 60. Patterns - Drupal Patterns Views, Commerce Separate UI from core module functionality
  • 61. Patterns - Drupal Patterns Views, Commerce Separate UI from core module functionality Allows us to focus on each and replace
  • 62. Patterns - Drupal Patterns Views, Commerce Separate UI from core module functionality Allows us to focus on each and replace Form submit handlers, etc should use you “core engine” functions - avoid stuffing a lot of logic there
  • 63. Patterns - Drupal Patterns Views, Commerce Separate UI from core module functionality Allows us to focus on each and replace Form submit handlers, etc should use you “core engine” functions - avoid stuffing a lot of logic there Can switch UI off for performace gains
  • 64. Patterns - Service Patterns Rooms
  • 65. Patterns - Service Patterns Rooms Where possible decouple interaction points within same module
  • 66. Patterns - Service Patterns Rooms Where possible decouple interaction points within same module Rooms produces all availability data in JSON following a callback
  • 67. Patterns - Service Patterns Rooms Where possible decouple interaction points within same module Rooms produces all availability data in JSON following a callback Allows us to use any number of display techinques such as the FullCalendar JS library
  • 68. Patterns - Service Patterns Rooms Where possible decouple interaction points within same module Rooms produces all availability data in JSON following a callback Allows us to use any number of display techinques such as the FullCalendar JS library Can easily abstract and connect to non- Drupal site
  • 70. in conclusion need to work on methodology
  • 71. in conclusion need to work on methodology start collecting and documenting patterns
  • 72. in conclusion need to work on methodology start collecting and documenting patterns discuss conventions
  • 73. in conclusion need to work on methodology start collecting and documenting patterns discuss conventions talk to me if interested - @ronald_istos

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n