SlideShare a Scribd company logo
Drupal Coding Standards
&
Best Practices
✓ What are Drupal Coding Standards
✓ Why they Exists
✓ How to follow them.
Drupal Coding Standards
Drupal coding standard and best practices
Drupal Coding Standards
The Quality of your code is not just in its
execution but also in its appearance
Drupal coding standard and best practices
What is Coding Standard
A set of guidelines regarding naming
conventions and document formatting to
follow that dictate the writing style used
when working with a specific programming
language
Drupal coding standard and best practices
Why Coding Standards
“The point of a coding style standard is not to
say one style is objectively better than another
in the sense of the specific details….instead
the point is to set up known expectations on
how code should look!!”
- Paul M Jones
Drupal coding standard and best practices
Why Coding Standards
✓ Readability
✓ Maintainable Code
✓ Spot errors more easily
✓ Everyone on the same page
✓ Encourages collective ownerships
Drupal coding standard and best practices
Aren’t these just little details that don't
really matter
✓ they’re vs. their
✓ it’s vs. its
Drupal coding standard and best practices
Who Decides Coding Standards
✓ Well! We do, the coding standards are decided
by the drupal community
Drupal coding standard and best practices
How are they decided
✓ Drupal Standards are based on the PEAR
Coding standards
✓ They are decided in an issue queue of
https://www.drupal.org/project/coding_standar
ds
Drupal coding standard and best practices
How do we implement coding
standards
Drupal coding standard and best practices
Read the coding standards and keep
them handy
✓ They can change
✓ https://www.drupal.org/project/coding_standar
ds
Drupal coding standard and best practices
Review your own code with
coder/PHPCodeSniffer
Drupal coding standard and best practices
Team Code Reviews!!
✓ Make the time!
✓ The most successful teams build in time to
review one another’s code
✓ There is no substitute for code reviews by
another person
Drupal coding standard and best practices
Formatting
Drupal coding standard and best practices
General
Drupal coding standard and best practices
✓ Always use <?php
?> not <? ?>
✓ Exclude trailing ?>
✓ Unix new line
character
✓ 80 character per
line
Hooks
Drupal coding standard and best practices
Operators
Drupal coding standard and best practices
✓ Always use one space
on either side of the
operator
Control Statements
Drupal coding standard and best practices
✓ Space between
keyword and
parenthesis
✓ Always use curly
braces even when
optional
✓ elseif
✓ opening curly brace
on same line as
condition
✓ Closing curly brace
on line by itself
Calling function
Drupal coding standard and best practices
✓ No space between
function name and
parentheses
✓ Arguments separated
by comma
✓ No Extra space inside
paranthesis
Declaring function
Drupal coding standard and best practices
✓ No space between
function name and
parentheses
✓ Arguments separated
by comma
✓ Arguments with
default values at the
end of the list
Arrays
✓ Array declaration that's longer than 80
characters should be split into multi-line arrays
✓ New short array syntax standards
[“kittens”, “puppies”, “bunnies”] - Correct
✓ Old array
array(“kittens”, “puppies”, “bunnies”) -
Wrong
Drupal coding standard and best practices
Documentation
Why is documentation important?
It tells us what to expect from our code
Drupal coding standard and best practices
But I know what my code does!!!
Drupal coding standard and best practices
But my code is so good it's
self-documenting!!!!!
Drupal coding standard and best practices
DOC Blocks
✓ Specially formatted blocks of information that
goes on both top of the file and before each
function
✓ File Doc Blocks
✓ Function Doc Blocks
Drupal coding standard and best practices
API Module
✓ Why are these docblocks so important
✓ Why do they have to be formatted so exactly
✓ The API module parses the information in doc
blocks to human readable documentations
Drupal coding standard and best practices
Inline Comments
✓ // For inline comments
✓ Should be 80 characters long
✓ Must end in a fullstop
Drupal coding standard and best practices
Helpers
✓ Coder Module
✓ PHPCS + Coder Sniffer
✓ IDE/Editor Integration
Drupal coding standard and best practices
Dev Tips
✓ Understand the requirements clearly
✓ Do not hesitate to ask questions
✓ Consider others when you anything
Drupal coding standard and best practices
Dev Tips
✓ Read Code
✓ Use Issue ID along with GIT commit message
✓ Pay attention to machine names
Drupal coding standard and best practices
You are the painter, and code is your medium
Drupal coding standard and best practices
Thanks!
Drupal coding standard and best practices

More Related Content

What's hot

eXtreme Programming
eXtreme ProgrammingeXtreme Programming
eXtreme Programming
Artem Tabalin
 
Getting Comfortable with BDD
Getting Comfortable with BDDGetting Comfortable with BDD
Getting Comfortable with BDD
Alex Sharp
 
BDD and Behave
BDD and BehaveBDD and Behave
BDD and Behave
Adam Englander
 
What's DSL and what isn't
What's DSL and what isn'tWhat's DSL and what isn't
What's DSL and what isn't
Leandro Parazito
 
Coldfusion
ColdfusionColdfusion
Coldfusion
Ram
 
BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32
OpenEBS
 

What's hot (6)

eXtreme Programming
eXtreme ProgrammingeXtreme Programming
eXtreme Programming
 
Getting Comfortable with BDD
Getting Comfortable with BDDGetting Comfortable with BDD
Getting Comfortable with BDD
 
BDD and Behave
BDD and BehaveBDD and Behave
BDD and Behave
 
What's DSL and what isn't
What's DSL and what isn'tWhat's DSL and what isn't
What's DSL and what isn't
 
Coldfusion
ColdfusionColdfusion
Coldfusion
 
BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32BDD Testing Using Godog - Bangalore Golang Meetup # 32
BDD Testing Using Godog - Bangalore Golang Meetup # 32
 

Viewers also liked

How to execute Automation Testing using Selenium
How to execute Automation Testing using SeleniumHow to execute Automation Testing using Selenium
How to execute Automation Testing using Selenium
valuebound
 
Token module in drupal 8
Token module in drupal 8Token module in drupal 8
Token module in drupal 8
valuebound
 
Automation testing for beginners on Selenium
Automation testing for beginners on SeleniumAutomation testing for beginners on Selenium
Automation testing for beginners on Selenium
valuebound
 
RESTful Web services in Drupal 8
RESTful Web services in Drupal 8RESTful Web services in Drupal 8
RESTful Web services in Drupal 8
valuebound
 
Features module in drupal 8
Features module in drupal 8Features module in drupal 8
Features module in drupal 8
valuebound
 
An introduction to Apache Cordova
An introduction to Apache CordovaAn introduction to Apache Cordova
An introduction to Apache Cordova
valuebound
 
Why JSON API?
Why JSON API?Why JSON API?
Why JSON API?
valuebound
 
How to Schedule Automated Tasks in Drupal with Cron?
How to Schedule Automated Tasks in Drupal with Cron?How to Schedule Automated Tasks in Drupal with Cron?
How to Schedule Automated Tasks in Drupal with Cron?
valuebound
 

Viewers also liked (8)

How to execute Automation Testing using Selenium
How to execute Automation Testing using SeleniumHow to execute Automation Testing using Selenium
How to execute Automation Testing using Selenium
 
Token module in drupal 8
Token module in drupal 8Token module in drupal 8
Token module in drupal 8
 
Automation testing for beginners on Selenium
Automation testing for beginners on SeleniumAutomation testing for beginners on Selenium
Automation testing for beginners on Selenium
 
RESTful Web services in Drupal 8
RESTful Web services in Drupal 8RESTful Web services in Drupal 8
RESTful Web services in Drupal 8
 
Features module in drupal 8
Features module in drupal 8Features module in drupal 8
Features module in drupal 8
 
An introduction to Apache Cordova
An introduction to Apache CordovaAn introduction to Apache Cordova
An introduction to Apache Cordova
 
Why JSON API?
Why JSON API?Why JSON API?
Why JSON API?
 
How to Schedule Automated Tasks in Drupal with Cron?
How to Schedule Automated Tasks in Drupal with Cron?How to Schedule Automated Tasks in Drupal with Cron?
How to Schedule Automated Tasks in Drupal with Cron?
 

Similar to Drupal coding standards and best practices

Drupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better ThemesDrupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better Themes
nyccamp
 
WordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standardsWordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standards
Swapnil Patil
 
BDD & Beyond: The Past, Present, & Future of Test Automation
BDD & Beyond: The Past, Present, & Future of Test AutomationBDD & Beyond: The Past, Present, & Future of Test Automation
BDD & Beyond: The Past, Present, & Future of Test Automation
Ford Prior
 
Coding standards
Coding standardsCoding standards
Coding standards
Mark Reynolds
 
Engineer Stunning (API) documentation
Engineer Stunning (API) documentationEngineer Stunning (API) documentation
Engineer Stunning (API) documentation
Pronovix
 
Miami2015
Miami2015Miami2015
Miami2015
DevinVinson
 
Coding conventions
Coding conventionsCoding conventions
Coding conventions
systemcrashed
 
Software development best practices & coding guidelines
Software development best practices & coding guidelinesSoftware development best practices & coding guidelines
Software development best practices & coding guidelines
Ankur Goyal
 
Coding conventions
Coding conventionsCoding conventions
Coding conventions
Thitipong Jampajeen
 
The Technical Co-Founders Handbook
The Technical Co-Founders HandbookThe Technical Co-Founders Handbook
The Technical Co-Founders Handbook
Joseph K. Ziegler
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austin
Chad Windnagle
 
PHP Code Quality
PHP Code QualityPHP Code Quality
PHP Code Quality
Usman Zafar
 
Robot Framework Dos And Don'ts
Robot Framework Dos And Don'tsRobot Framework Dos And Don'ts
Robot Framework Dos And Don'ts
Pekka Klärck
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
How to be a better WordPress-er
How to be a better WordPress-erHow to be a better WordPress-er
How to be a better WordPress-er
Grant Landram
 
The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practices
Bill Buchan
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
Gil Fink
 
Tools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy codeTools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy code
Dennis Doomen
 
Autoframework design
Autoframework designAutoframework design
Autoframework design
Forge Events
 

Similar to Drupal coding standards and best practices (20)

Drupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better ThemesDrupal Aware Design: Good Techniques for Better Themes
Drupal Aware Design: Good Techniques for Better Themes
 
WordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standardsWordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standards
 
BDD & Beyond: The Past, Present, & Future of Test Automation
BDD & Beyond: The Past, Present, & Future of Test AutomationBDD & Beyond: The Past, Present, & Future of Test Automation
BDD & Beyond: The Past, Present, & Future of Test Automation
 
Coding standards
Coding standardsCoding standards
Coding standards
 
Engineer Stunning (API) documentation
Engineer Stunning (API) documentationEngineer Stunning (API) documentation
Engineer Stunning (API) documentation
 
Miami2015
Miami2015Miami2015
Miami2015
 
Coding conventions
Coding conventionsCoding conventions
Coding conventions
 
Software development best practices & coding guidelines
Software development best practices & coding guidelinesSoftware development best practices & coding guidelines
Software development best practices & coding guidelines
 
Coding conventions
Coding conventionsCoding conventions
Coding conventions
 
The Technical Co-Founders Handbook
The Technical Co-Founders HandbookThe Technical Co-Founders Handbook
The Technical Co-Founders Handbook
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austin
 
PHP Code Quality
PHP Code QualityPHP Code Quality
PHP Code Quality
 
Robot Framework Dos And Don'ts
Robot Framework Dos And Don'tsRobot Framework Dos And Don'ts
Robot Framework Dos And Don'ts
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
How to be a better WordPress-er
How to be a better WordPress-erHow to be a better WordPress-er
How to be a better WordPress-er
 
The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practices
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
 
Tools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy codeTools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy code
 
Autoframework design
Autoframework designAutoframework design
Autoframework design
 

More from valuebound

Scaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic WebsitesScaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic Websites
valuebound
 
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdfDrupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
valuebound
 
How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.
valuebound
 
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound
valuebound
 
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js AppsHow to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
valuebound
 
Mastering Drupal Theming
Mastering Drupal ThemingMastering Drupal Theming
Mastering Drupal Theming
valuebound
 
The Benefits of Cloud Engineering
The Benefits of Cloud EngineeringThe Benefits of Cloud Engineering
The Benefits of Cloud Engineering
valuebound
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
valuebound
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
valuebound
 
Deep dive into ChatGPT
Deep dive into ChatGPTDeep dive into ChatGPT
Deep dive into ChatGPT
valuebound
 
Content Creation Solution | Valuebound
Content Creation Solution | ValueboundContent Creation Solution | Valuebound
Content Creation Solution | Valuebound
valuebound
 
Road ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projectsRoad ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projects
valuebound
 
Chatbot with RASA | Valuebound
Chatbot with RASA | ValueboundChatbot with RASA | Valuebound
Chatbot with RASA | Valuebound
valuebound
 
Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization
valuebound
 
Drupal growth in last year | Valuebound
Drupal growth in last year | ValueboundDrupal growth in last year | Valuebound
Drupal growth in last year | Valuebound
valuebound
 
BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"
valuebound
 
Event loop in browser
Event loop in browserEvent loop in browser
Event loop in browser
valuebound
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
valuebound
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
valuebound
 
Dependency Injection in Drupal 8
Dependency Injection in Drupal 8Dependency Injection in Drupal 8
Dependency Injection in Drupal 8
valuebound
 

More from valuebound (20)

Scaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic WebsitesScaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic Websites
 
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdfDrupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
 
How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.
 
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound
 
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js AppsHow to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
 
Mastering Drupal Theming
Mastering Drupal ThemingMastering Drupal Theming
Mastering Drupal Theming
 
The Benefits of Cloud Engineering
The Benefits of Cloud EngineeringThe Benefits of Cloud Engineering
The Benefits of Cloud Engineering
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
 
Deep dive into ChatGPT
Deep dive into ChatGPTDeep dive into ChatGPT
Deep dive into ChatGPT
 
Content Creation Solution | Valuebound
Content Creation Solution | ValueboundContent Creation Solution | Valuebound
Content Creation Solution | Valuebound
 
Road ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projectsRoad ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projects
 
Chatbot with RASA | Valuebound
Chatbot with RASA | ValueboundChatbot with RASA | Valuebound
Chatbot with RASA | Valuebound
 
Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization
 
Drupal growth in last year | Valuebound
Drupal growth in last year | ValueboundDrupal growth in last year | Valuebound
Drupal growth in last year | Valuebound
 
BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"
 
Event loop in browser
Event loop in browserEvent loop in browser
Event loop in browser
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
Dependency Injection in Drupal 8
Dependency Injection in Drupal 8Dependency Injection in Drupal 8
Dependency Injection in Drupal 8
 

Recently uploaded

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
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
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.
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
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
 
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
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
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
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

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...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
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
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
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
 
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
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
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...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

Drupal coding standards and best practices

  • 2. ✓ What are Drupal Coding Standards ✓ Why they Exists ✓ How to follow them. Drupal Coding Standards Drupal coding standard and best practices
  • 3. Drupal Coding Standards The Quality of your code is not just in its execution but also in its appearance Drupal coding standard and best practices
  • 4. What is Coding Standard A set of guidelines regarding naming conventions and document formatting to follow that dictate the writing style used when working with a specific programming language Drupal coding standard and best practices
  • 5. Why Coding Standards “The point of a coding style standard is not to say one style is objectively better than another in the sense of the specific details….instead the point is to set up known expectations on how code should look!!” - Paul M Jones Drupal coding standard and best practices
  • 6. Why Coding Standards ✓ Readability ✓ Maintainable Code ✓ Spot errors more easily ✓ Everyone on the same page ✓ Encourages collective ownerships Drupal coding standard and best practices
  • 7. Aren’t these just little details that don't really matter ✓ they’re vs. their ✓ it’s vs. its Drupal coding standard and best practices
  • 8. Who Decides Coding Standards ✓ Well! We do, the coding standards are decided by the drupal community Drupal coding standard and best practices
  • 9. How are they decided ✓ Drupal Standards are based on the PEAR Coding standards ✓ They are decided in an issue queue of https://www.drupal.org/project/coding_standar ds Drupal coding standard and best practices
  • 10. How do we implement coding standards Drupal coding standard and best practices
  • 11. Read the coding standards and keep them handy ✓ They can change ✓ https://www.drupal.org/project/coding_standar ds Drupal coding standard and best practices
  • 12. Review your own code with coder/PHPCodeSniffer Drupal coding standard and best practices
  • 13. Team Code Reviews!! ✓ Make the time! ✓ The most successful teams build in time to review one another’s code ✓ There is no substitute for code reviews by another person Drupal coding standard and best practices
  • 14. Formatting Drupal coding standard and best practices
  • 15. General Drupal coding standard and best practices ✓ Always use <?php ?> not <? ?> ✓ Exclude trailing ?> ✓ Unix new line character ✓ 80 character per line
  • 16. Hooks Drupal coding standard and best practices
  • 17. Operators Drupal coding standard and best practices ✓ Always use one space on either side of the operator
  • 18. Control Statements Drupal coding standard and best practices ✓ Space between keyword and parenthesis ✓ Always use curly braces even when optional ✓ elseif ✓ opening curly brace on same line as condition ✓ Closing curly brace on line by itself
  • 19. Calling function Drupal coding standard and best practices ✓ No space between function name and parentheses ✓ Arguments separated by comma ✓ No Extra space inside paranthesis
  • 20. Declaring function Drupal coding standard and best practices ✓ No space between function name and parentheses ✓ Arguments separated by comma ✓ Arguments with default values at the end of the list
  • 21. Arrays ✓ Array declaration that's longer than 80 characters should be split into multi-line arrays ✓ New short array syntax standards [“kittens”, “puppies”, “bunnies”] - Correct ✓ Old array array(“kittens”, “puppies”, “bunnies”) - Wrong Drupal coding standard and best practices
  • 22. Documentation Why is documentation important? It tells us what to expect from our code Drupal coding standard and best practices
  • 23. But I know what my code does!!! Drupal coding standard and best practices
  • 24. But my code is so good it's self-documenting!!!!! Drupal coding standard and best practices
  • 25. DOC Blocks ✓ Specially formatted blocks of information that goes on both top of the file and before each function ✓ File Doc Blocks ✓ Function Doc Blocks Drupal coding standard and best practices
  • 26. API Module ✓ Why are these docblocks so important ✓ Why do they have to be formatted so exactly ✓ The API module parses the information in doc blocks to human readable documentations Drupal coding standard and best practices
  • 27. Inline Comments ✓ // For inline comments ✓ Should be 80 characters long ✓ Must end in a fullstop Drupal coding standard and best practices
  • 28. Helpers ✓ Coder Module ✓ PHPCS + Coder Sniffer ✓ IDE/Editor Integration Drupal coding standard and best practices
  • 29. Dev Tips ✓ Understand the requirements clearly ✓ Do not hesitate to ask questions ✓ Consider others when you anything Drupal coding standard and best practices
  • 30. Dev Tips ✓ Read Code ✓ Use Issue ID along with GIT commit message ✓ Pay attention to machine names Drupal coding standard and best practices
  • 31. You are the painter, and code is your medium Drupal coding standard and best practices
  • 32. Thanks! Drupal coding standard and best practices