to patch or custom: how to decide when to patch a contrib module or go custom @nerdsummit 2014
DESCRIPTION
To use a contrib (community) module, patch a contrib module or write a custom module, that is the question. With over 25,000 community contributed modules available for download it is rare to find one that does not offer the functionality you are looking for. However, when you cannot find a module that fits your needs you are then faced with a choice. Do you patch an existing contrib module? Or write a custom one? To figure out the answer to the answer you just need to remember to R.E.A.D. In this session we will go over the four steps of R.E.A.D that help you decide which path you should follow and how you can quickly and correctly identify if you should patch a contrib module or write your own custom module. We will use some real world examples to demo straight how these steps were utilized to make the correct decision. We will also talk about the basics and best practices of writing and contributing a patch, and the best practices to follow if you decide to pursue writing a custom module and how to contribute it back to the Drupal community. This session is geared to developer, site builders and functionality decision makers who consider themselves new to Drupal. This session can also prove to be beneficial to experienced drupalists who want validation on habits they have developed over time.TRANSCRIPT
![Page 1: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/1.jpg)
To Patch or CustomHow to select the right path.
#PatchOrCustom, #justREAD
![Page 2: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/2.jpg)
Who You Are.
• Site Builder
• Developer
• Decision Maker
• New to Drupal !
• Want to re-enforce habits
![Page 3: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/3.jpg)
What’s it all about.
How to quickly make smart, informed decisions.
![Page 4: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/4.jpg)
Michael Miles
• Associate Director of PHP @ Genuine Interactive.
• Drank the Drupal Kool-aid in 2008. (it’s grape flavored)
!
• Twitter: @mikemiles86
• D.o: mikemiles86
@WeAreGenuine
![Page 5: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/5.jpg)
A lover of memes.
![Page 6: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/6.jpg)
How to R.E.A.D!!(yay acronyms!)
![Page 7: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/7.jpg)
R.E.A.D
• Research what exists.
• Evaluate the options.
• Analyze the gap.
• Determine amount of effort.
#justREAD
![Page 8: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/8.jpg)
Research what exists.
![Page 9: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/9.jpg)
Research what exists.
• Isolate key functionality needs.
• Search for existing modules.
• Use the community.
![Page 10: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/10.jpg)
![Page 11: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/11.jpg)
Evaluate the options.
![Page 12: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/12.jpg)
Evaluate the options.
• Read the module description.
• Look at community adoption.
• Look at maintainer activity.
![Page 13: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/13.jpg)
![Page 14: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/14.jpg)
Analyze the gap.
![Page 15: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/15.jpg)
Analyze the gap.
• Download and test the module.
• Discover missing functionality.
• Check issue queue for solutions.
![Page 16: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/16.jpg)
Patch not found.
![Page 17: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/17.jpg)
Determine amount of effort.
![Page 18: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/18.jpg)
Determine amount of effort.
• Review the module code.
• Estimate how much has to be changed.
• Do changes extend or alter module?
![Page 19: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/19.jpg)
Let’s review.
Like developers…
![Page 20: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/20.jpg)
Research.!Find modules?
Evaluate.!find best
fit?
Analyze.!is there a
gap?
Determine.!big change?
Build a custom module.
Use existing module.
Use community solutions.
Community solutions
exist?
Patch.
YES YES YES
YES
NO NONO NO
YES
NO
…Flow Chart FTW!
![Page 21: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/21.jpg)
Examples.
![Page 22: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/22.jpg)
Scenario #1.
![Page 23: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/23.jpg)
The Requirements.WHEN SAVING A FILE
AND IT IS A JPEG IMAGE
THEN THE EXIF META DATA NEEDS TO BE CAPTURED
AND MAPPED TO CUSTOM FIELDS
AND THESE MAPPINGS NEED TO BE EXPORTABLE USING FEATURES
!
![Page 24: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/24.jpg)
WHEN SAVING A FILE
AND IT IS A JPEG IMAGE
THEN THE EXIF META DATA NEEDS TO BE CAPTURED
AND MAPPED TO CUSTOM FIELDS
AND THESE MAPPINGS NEED TO BE EXPORTABLE USING FEATURES.
!
Isolate key functionality needs.Research what exists.
![Page 25: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/25.jpg)
Search for existing modules.Research what exists.
![Page 26: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/26.jpg)
Find possible existing solutionsResearch what exists.
• The Exif module
• The Exif custom module
![Page 27: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/27.jpg)
Read the module description.Evaluate the options
![Page 28: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/28.jpg)
Look at community adoption.Evaluate the options
Exif
Exif Custom
![Page 29: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/29.jpg)
Look at maintainer activity.Evaluate the options
![Page 30: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/30.jpg)
Determine best fit.Evaluate the options
![Page 31: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/31.jpg)
Download and test the module.Analyze the gap.
![Page 32: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/32.jpg)
Discover missing functionality.Analyze the gap.
![Page 33: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/33.jpg)
Check issue queue for solutions.Analyze the gap.
![Page 34: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/34.jpg)
Which path to choose?
• Patch Exif Custom module !
• Write own Exif module
![Page 35: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/35.jpg)
PATCH!
![Page 36: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/36.jpg)
What is a Patch?
• drupal.org/patch
• A structured list of changes to a file.
• Used to re-create changes to a files.
• Focus on a single change.
![Page 37: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/37.jpg)
How to submit a Patch.
• Create/Comment on an issue.
• Attach the patch.
• [description]-[issue-number]-[comment-number].patch
• Revise based on testing/reviews.
![Page 38: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/38.jpg)
Contributed a Patch
![Page 39: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/39.jpg)
![Page 40: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/40.jpg)
Scenario #2.
![Page 41: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/41.jpg)
The Requirements.WHEN SITE USES WORKBENCH TO MODERATE CONTENT
THEN CAN CREATE MULTIPLE TRANSITIONS BETWEEN STATES
AND TRANSITIONS ARE EXPORTABLE USING FEATURES
!
WHEN EDITNG A CONTENT REVISION
THEN CAN SCHEDULE A TRANSITION
AND CAN SELECT DATE FOR FIRST STATE
AND CAN SELECT DATE FOR SECOND STATE
![Page 42: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/42.jpg)
WHEN SITE USES WORKBENCH TO MODERATE CONTENT
THEN CAN CREATE MULTIPLE TRANSITIONS BETWEEN STATES
AND TRANSITIONS ARE EXPORTABLE USING FEATURES
!
WHEN EDITNG A CONTENT REVISION
THEN CAN SCHEDULE A TRANSITION
AND CAN SELECT DATE FOR FIRST STATE
AND CAN SELECT DATE FOR SECOND STATE
Isolate key functionality needs.Research what exists.
![Page 43: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/43.jpg)
Search for existing modules.Research what exists.
![Page 44: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/44.jpg)
Read the module description.Evaluate the options
![Page 45: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/45.jpg)
Download and test the module.Analyze the gap.
![Page 46: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/46.jpg)
Discover missing functionality.Analyze the gap.
• Unable to create different transition schedules
• Unable to select different transitions for revisions
• No features integration.
![Page 47: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/47.jpg)
Estimate how much has to be changed.Determine amount of effort.
• Will need to change how schedules are created.
• Will need to change how schedules are stored.
• Will need to add features integration.
![Page 48: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/48.jpg)
Which path to choose?
• Patch Scheduler workbench module !
• Write own scheduler module
![Page 49: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/49.jpg)
CUSTOM MODULE!
![Page 50: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/50.jpg)
Module Writing Guidelines.
• drupal.org/developing/modules
• Follow Drupal coding standards.
• Make use of hooks and APIs.
• Test your code.
![Page 51: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/51.jpg)
Contributing a module.
• Is it functionality other could use?
• Name appropriately.
• Provide accurate description.
• Be an active maintainer.
![Page 52: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/52.jpg)
Wrote a custom module.
![Page 53: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/53.jpg)
Be an active maintainer.
![Page 54: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/54.jpg)
![Page 55: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/55.jpg)
Remember R.E.A.D.
• Research what exists.
• Evaluate the options.
• Analyze the gap.
• Determine amount of effort.
#justREAD
![Page 56: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014](https://reader034.vdocuments.site/reader034/viewer/2022052621/55844485d8b42afc4e8b4650/html5/thumbnails/56.jpg)
Thank You!
@mikemiles86