SlideShare a Scribd company logo
www.vardot.com
DrupalCamp KKU | April 15, 2017
Using DRY (Don't
Repeat Yourself)
Principle in Drupal 8
Site Life Cycle
DrupalCamp KKU | April 15, 2017
Mohammed J. Razem
CEO & Founder at Vardot
m.razem@vardot.com

@moerazem

drupal.org/Vardot
DrupalCamp KKU | April 15, 2017
• Open Source Products Built on Drupal
• github.com/Vardot
• drupal.org/Vardot
What’s DRY (Don’t
Repeat Yourself)
In Context
DrupalCamp KKU | April 15, 2017
Every piece of knowledge must
have a single, unambiguous,
authoritative representation in
the system
- Wikipedia (https://www.wikiwand.com/en/Don't_repeat_yourself)
DrupalCamp KKU | April 15, 2017
Don’t Repeat Yourself
• One of the most important Programming
Principles
• Proper OOP is a direct application of DRY
• Especially important in multi-tier
architectures
DrupalCamp KKU | April 15, 2017
Don’t Repeat Yourself
• Repetition is the root of
all software evil
• Duplication in logic
should be eliminated
via abstraction
• Duplication in process
should be eliminated
via automation
DRY in Drupal 8 Site
Life Cycle
In Context
DrupalCamp KKU | April 15, 2017
Drupal 8 is Built on DRY
• Drupal 8 uses components from
other systems. It ships with several
built-in Symfony components.
• Drupal 8 now PHPUnit instead of
SimpleTest
• Drupal 8 now uses Composer
instead of Drush make
DrupalCamp KKU | April 15, 2017
Drupal 8 is Built on DRY
• Drupal 8 uses OOP methodologies
that implement DRY principle: i.e.
Interfaces, Abstract Classes,
Services, Service Containers …etc.
DrupalCamp KKU | April 15, 2017
Site Life Cycle
Perspectives
T E ST E R
( QA )
T H E M E RD E V E LO P E R
S I T E
B U I L D E R
DrupalCamp KKU | April 15, 2017
Site Builder Perspective
• Use Entities, (almost) everything is an entity
in Drupal
• Consider reusing fields instead of defining
new ones
• Consider “base” distributions instead of
starting from vanilla (fresh) Drupal
• Don’t use modules when the functionality
can be achieved by Drupal core
DrupalCamp KKU | April 15, 2017
Site Builder Perspective
• Package your work into “Features” using the
Configuration Management system
• Use Paragraphs, and ECK for content
entities
DrupalCamp KKU | April 15, 2017
Site Builder Perspective
DRY ✔ Not Applying DRY ✘
• Using Entities for new system
objects
• Download a module to expose
a new object to you
• Reuse fields • Create new field definition for
each case
• Use an existing base Drupal
distribution (Varbase,
Lightning)
• Every time you have a new site,
you download Drupal and other
module/themes/libraries
DrupalCamp KKU | April 15, 2017
Site Builder Perspective
DRY ✔ Not Applying DRY ✘
• Build a feature to achieve a
common functionality, reuse it
in your projects
• Rebuild the functionality in
every site
• Use Paragraphs module for
long-form content pages
• Use Blocks and add them to
the page
DrupalCamp KKU | April 15, 2017
Site Builder Perspective
• Let’s see:
• Entities and Entity Construction Kit (ECK)
• Reusing fields
• Base distributions (Varbase, Lightning)
• Using view modes
• Features
• Paragraphs
DrupalCamp KKU | April 15, 2017
Developer Perspective
• Using Composer in your
project
• Build your distribution instead
of starting from scratch every
time
• Using proper Drupal 8 API, and
entities for new system objects
DrupalCamp KKU | April 15, 2017
Developer Perspective
DRY ✔ Not Applying DRY ✘
• Use Composer to include
modules/components in your
project
• Commit contrib modules and
components in your repository
• Build a distribution for your
own needs
• Every time you have a new site,
you download Drupal and other
module/themes/libraries
• Use proper Drupal 8 API.

i.e. Services, Service
containers, controllers, …etc.
• Not using Drupal 8 API.

Creating custom DB table with
custom PHP code to write to it
DrupalCamp KKU | April 15, 2017
Developer Perspective
• Let’s see:
• Composer
• Libraries in Drupal 8
DrupalCamp KKU | April 15, 2017
Themer Perspective
• Use “Base themes”. i.e.
Bootstrap
• Theming for “View Modes” and
global styling first
• Use Libraries instead of custom
inclusions
• Using Less/Sass CSS to write
CSS
DrupalCamp KKU | April 15, 2017
Themer Perspective
DRY ✔ Not Applying DRY ✘
• Use Bootstrap as base theme
 • Build your custom theme from
scratch
• Theme view modes with
consistent and global styling.
Theme for general CSS
classes
• Theme fields. Theme specific
classes. Each newly created
view will need new theming
• Use “Libraries” in Drupal to
provide front-end specific
functionality
• Embed a custom JavaScript in
your theme to provide front-
end specific functionality
DrupalCamp KKU | April 15, 2017
Themer Perspective
DRY ✔ Not Applying DRY ✘
• Use Less/Sass CSS
variables, mixing, nested
rules …etc.
• Write regular (standard) CSS
DrupalCamp KKU | April 15, 2017
Themer Perspective
• Let’s see:
• Less/Sass vs CSS
• Libraries in Drupal 8
DrupalCamp KKU | April 15, 2017
Tester (QA) Perspective
• Testing is a process. Therefore,
we need to automate the
process
• Using automated functional
testing
• Using Continuous Integration
DrupalCamp KKU | April 15, 2017
Tester (QA) Perspective
DRY ✔ Not Applying DRY ✘
• Write an automated functional
test and test by running it

• Manually execute the test every
time
• Run a Continuous Integration
build, that will run all
automated tests
• Everytime you release, test the
whole system!!!
DrupalCamp KKU | April 15, 2017
Tester (QA) Perspective
• Let’s see:
• Behat tests
• Continuous Integration build
DrupalCamp KKU | April 15, 2017
Thank You!

More Related Content

PPTX
Interoperability of components built with different frameworks
PPTX
Super tools to boost productivity in React dev env!
PDF
Don't let FaaS do a BaaS job
PDF
Drupal Step-by-Step: How We Built Our Training Site, Part 2
PPTX
PPSX
Node on Windows Azure
PPTX
Introduction to Vue.js DevStaff Meetup 13.02
PDF
Build Your Blazing Fast Site with Gatsby and WordPress @ WordSesh by Muhammad...
Interoperability of components built with different frameworks
Super tools to boost productivity in React dev env!
Don't let FaaS do a BaaS job
Drupal Step-by-Step: How We Built Our Training Site, Part 2
Node on Windows Azure
Introduction to Vue.js DevStaff Meetup 13.02
Build Your Blazing Fast Site with Gatsby and WordPress @ WordSesh by Muhammad...

What's hot (20)

PDF
Drupal 8 mobile initiative
PDF
Drupal Presentation for CapitalCamp 2011: Features Driven Development
PDF
Burgas Conf 21.06.2014 - Single page application Angularjs and Nodejs
PPTX
React - An Overview
PPTX
Swedish SharePoint UserGroup Göteborg Oct 5 2016 SharePoint Framework
PDF
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
PPTX
#spsbe Get Typing with Typescript
PDF
What's new in Gradle 4.0
PDF
Drupal 8 Vocab Lesson
PPTX
Introduction to Cloud Foundry
PPTX
Presentation on Gatsby to SF Static Web Tech Meetup
PPTX
React in production (react global summit 2021)
ODP
how to make bumper video opensuse using inkscape and synfig
PDF
Web Policies & Reporting
PPTX
An Angular developer moving to React
PDF
Making websites with WordPress
PDF
Unscrambling An Omelette - How Companies Can Use WordPress Better - Jeremy Ke...
PDF
How to develop reusable components with Babel and Rollup.js
PPTX
Deploy It | Deployment Presentation for JavaScriptMN
PPTX
Introduction to git & WordPress
Drupal 8 mobile initiative
Drupal Presentation for CapitalCamp 2011: Features Driven Development
Burgas Conf 21.06.2014 - Single page application Angularjs and Nodejs
React - An Overview
Swedish SharePoint UserGroup Göteborg Oct 5 2016 SharePoint Framework
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
#spsbe Get Typing with Typescript
What's new in Gradle 4.0
Drupal 8 Vocab Lesson
Introduction to Cloud Foundry
Presentation on Gatsby to SF Static Web Tech Meetup
React in production (react global summit 2021)
how to make bumper video opensuse using inkscape and synfig
Web Policies & Reporting
An Angular developer moving to React
Making websites with WordPress
Unscrambling An Omelette - How Companies Can Use WordPress Better - Jeremy Ke...
How to develop reusable components with Babel and Rollup.js
Deploy It | Deployment Presentation for JavaScriptMN
Introduction to git & WordPress
Ad

Similar to Using DRY (Don't Repeat Yourself) Principle in Drupal 8 Site Life Cycle (20)

PPTX
Ready. Set. Drupal! An Intro to Drupal 8, Part 2
PDF
Drupal For Designers 1st Edition Dani Nordin
PDF
Don't Repeat Yourself, Be Agile
PDF
Drupal 8: A story of growing up and getting off the island
PDF
Modernize Your Drupal Development
PDF
State of Drupal keynote, DrupalCon Vienna
PPTX
Becoming A Drupal Master Builder
PDF
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
PDF
Drupal - Changing the Web by Connecting Open Minds - Josef Dabernig
PDF
What is Drupal? And Why is it Useful? Webinar
PDF
Drupal Documentation (Argentina)
PDF
Drupal Roadmap 2010
PDF
Memorial Sloan Kettering: Adventures in Drupal 8
PPTX
Intro to Drupal Slides - DrupalCampSC 2014
PDF
Drupal content editor flexibility
PDF
Building reusable websites on Drupal 8: lessons learned from transforming red...
PDF
Drupal - Changing the Web by Connecting Open Minds - DrupalCamp North 2015
PPT
Plan your Chunks! Win the Future with Information Architecture NOW
PDF
Drupal 8 Preview for Site Builders
PDF
Drupal training-by-ruchiwebsolutions
Ready. Set. Drupal! An Intro to Drupal 8, Part 2
Drupal For Designers 1st Edition Dani Nordin
Don't Repeat Yourself, Be Agile
Drupal 8: A story of growing up and getting off the island
Modernize Your Drupal Development
State of Drupal keynote, DrupalCon Vienna
Becoming A Drupal Master Builder
[HKDUG] #20160626 - HKOSCon 2015 - Website DIY with Drupal 8
Drupal - Changing the Web by Connecting Open Minds - Josef Dabernig
What is Drupal? And Why is it Useful? Webinar
Drupal Documentation (Argentina)
Drupal Roadmap 2010
Memorial Sloan Kettering: Adventures in Drupal 8
Intro to Drupal Slides - DrupalCampSC 2014
Drupal content editor flexibility
Building reusable websites on Drupal 8: lessons learned from transforming red...
Drupal - Changing the Web by Connecting Open Minds - DrupalCamp North 2015
Plan your Chunks! Win the Future with Information Architecture NOW
Drupal 8 Preview for Site Builders
Drupal training-by-ruchiwebsolutions
Ad

Recently uploaded (20)

PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PDF
Website Design Services for Small Businesses.pdf
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PPTX
Patient Appointment Booking in Odoo with online payment
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
history of c programming in notes for students .pptx
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
assetexplorer- product-overview - presentation
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Odoo Companies in India – Driving Business Transformation.pdf
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Website Design Services for Small Businesses.pdf
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Weekly report ppt - harsh dattuprasad patel.pptx
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
Patient Appointment Booking in Odoo with online payment
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
wealthsignaloriginal-com-DS-text-... (1).pdf
Reimagine Home Health with the Power of Agentic AI​
history of c programming in notes for students .pptx
Monitoring Stack: Grafana, Loki & Promtail
assetexplorer- product-overview - presentation
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Salesforce Agentforce AI Implementation.pdf
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Navsoft: AI-Powered Business Solutions & Custom Software Development

Using DRY (Don't Repeat Yourself) Principle in Drupal 8 Site Life Cycle

  • 1. www.vardot.com DrupalCamp KKU | April 15, 2017 Using DRY (Don't Repeat Yourself) Principle in Drupal 8 Site Life Cycle
  • 2. DrupalCamp KKU | April 15, 2017 Mohammed J. Razem CEO & Founder at Vardot m.razem@vardot.com
 @moerazem
 drupal.org/Vardot
  • 3. DrupalCamp KKU | April 15, 2017 • Open Source Products Built on Drupal • github.com/Vardot • drupal.org/Vardot
  • 4. What’s DRY (Don’t Repeat Yourself) In Context
  • 5. DrupalCamp KKU | April 15, 2017 Every piece of knowledge must have a single, unambiguous, authoritative representation in the system - Wikipedia (https://www.wikiwand.com/en/Don't_repeat_yourself)
  • 6. DrupalCamp KKU | April 15, 2017 Don’t Repeat Yourself • One of the most important Programming Principles • Proper OOP is a direct application of DRY • Especially important in multi-tier architectures
  • 7. DrupalCamp KKU | April 15, 2017 Don’t Repeat Yourself • Repetition is the root of all software evil • Duplication in logic should be eliminated via abstraction • Duplication in process should be eliminated via automation
  • 8. DRY in Drupal 8 Site Life Cycle In Context
  • 9. DrupalCamp KKU | April 15, 2017 Drupal 8 is Built on DRY • Drupal 8 uses components from other systems. It ships with several built-in Symfony components. • Drupal 8 now PHPUnit instead of SimpleTest • Drupal 8 now uses Composer instead of Drush make
  • 10. DrupalCamp KKU | April 15, 2017 Drupal 8 is Built on DRY • Drupal 8 uses OOP methodologies that implement DRY principle: i.e. Interfaces, Abstract Classes, Services, Service Containers …etc.
  • 11. DrupalCamp KKU | April 15, 2017 Site Life Cycle Perspectives T E ST E R ( QA ) T H E M E RD E V E LO P E R S I T E B U I L D E R
  • 12. DrupalCamp KKU | April 15, 2017 Site Builder Perspective • Use Entities, (almost) everything is an entity in Drupal • Consider reusing fields instead of defining new ones • Consider “base” distributions instead of starting from vanilla (fresh) Drupal • Don’t use modules when the functionality can be achieved by Drupal core
  • 13. DrupalCamp KKU | April 15, 2017 Site Builder Perspective • Package your work into “Features” using the Configuration Management system • Use Paragraphs, and ECK for content entities
  • 14. DrupalCamp KKU | April 15, 2017 Site Builder Perspective DRY ✔ Not Applying DRY ✘ • Using Entities for new system objects • Download a module to expose a new object to you • Reuse fields • Create new field definition for each case • Use an existing base Drupal distribution (Varbase, Lightning) • Every time you have a new site, you download Drupal and other module/themes/libraries
  • 15. DrupalCamp KKU | April 15, 2017 Site Builder Perspective DRY ✔ Not Applying DRY ✘ • Build a feature to achieve a common functionality, reuse it in your projects • Rebuild the functionality in every site • Use Paragraphs module for long-form content pages • Use Blocks and add them to the page
  • 16. DrupalCamp KKU | April 15, 2017 Site Builder Perspective • Let’s see: • Entities and Entity Construction Kit (ECK) • Reusing fields • Base distributions (Varbase, Lightning) • Using view modes • Features • Paragraphs
  • 17. DrupalCamp KKU | April 15, 2017 Developer Perspective • Using Composer in your project • Build your distribution instead of starting from scratch every time • Using proper Drupal 8 API, and entities for new system objects
  • 18. DrupalCamp KKU | April 15, 2017 Developer Perspective DRY ✔ Not Applying DRY ✘ • Use Composer to include modules/components in your project • Commit contrib modules and components in your repository • Build a distribution for your own needs • Every time you have a new site, you download Drupal and other module/themes/libraries • Use proper Drupal 8 API.
 i.e. Services, Service containers, controllers, …etc. • Not using Drupal 8 API.
 Creating custom DB table with custom PHP code to write to it
  • 19. DrupalCamp KKU | April 15, 2017 Developer Perspective • Let’s see: • Composer • Libraries in Drupal 8
  • 20. DrupalCamp KKU | April 15, 2017 Themer Perspective • Use “Base themes”. i.e. Bootstrap • Theming for “View Modes” and global styling first • Use Libraries instead of custom inclusions • Using Less/Sass CSS to write CSS
  • 21. DrupalCamp KKU | April 15, 2017 Themer Perspective DRY ✔ Not Applying DRY ✘ • Use Bootstrap as base theme • Build your custom theme from scratch • Theme view modes with consistent and global styling. Theme for general CSS classes • Theme fields. Theme specific classes. Each newly created view will need new theming • Use “Libraries” in Drupal to provide front-end specific functionality • Embed a custom JavaScript in your theme to provide front- end specific functionality
  • 22. DrupalCamp KKU | April 15, 2017 Themer Perspective DRY ✔ Not Applying DRY ✘ • Use Less/Sass CSS variables, mixing, nested rules …etc. • Write regular (standard) CSS
  • 23. DrupalCamp KKU | April 15, 2017 Themer Perspective • Let’s see: • Less/Sass vs CSS • Libraries in Drupal 8
  • 24. DrupalCamp KKU | April 15, 2017 Tester (QA) Perspective • Testing is a process. Therefore, we need to automate the process • Using automated functional testing • Using Continuous Integration
  • 25. DrupalCamp KKU | April 15, 2017 Tester (QA) Perspective DRY ✔ Not Applying DRY ✘ • Write an automated functional test and test by running it • Manually execute the test every time • Run a Continuous Integration build, that will run all automated tests • Everytime you release, test the whole system!!!
  • 26. DrupalCamp KKU | April 15, 2017 Tester (QA) Perspective • Let’s see: • Behat tests • Continuous Integration build
  • 27. DrupalCamp KKU | April 15, 2017 Thank You!