to patch or custom: how to decide when to patch a contrib module or go custom @nerdsummit 2014

56
To Patch or Custom How to select the right path. #PatchOrCustom, #justREAD

Upload: michael-miles

Post on 19-Jun-2015

157 views

Category:

Technology


3 download

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

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

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

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

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

A lover of memes.

Page 6: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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

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

Research what exists.

Page 9: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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
Page 11: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

Evaluate the options.

Page 12: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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
Page 14: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

Analyze the gap.

Page 15: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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

Patch not found.

Page 17: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

Determine amount of effort.

Page 18: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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

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

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

Examples.

Page 22: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

Scenario #1.

Page 23: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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

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

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

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

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

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

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

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

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

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

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

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

PATCH!

Page 36: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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

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

Contributed a Patch

Page 39: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014
Page 40: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

Scenario #2.

Page 41: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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

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

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

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

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

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

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

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

CUSTOM MODULE!

Page 50: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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

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

Wrote a custom module.

Page 53: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

Be an active maintainer.

Page 54: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014
Page 55: To Patch or Custom: How to decide when to patch a contrib module or go custom @NerdSummit 2014

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

Thank You!

@mikemiles86