How to R.E.A.D Steps for selecting the correct module. #PatchOrCustom, #justREAD

Who You Are. • Site Builder • • Developer ! • • Decision Maker New to Drupal Want to re-enforce habits

What’s it all about. How to quickly make smart, informed decisions.

What we’ll cover. • Steps to decide between a contrib, patched or custom module. • Basics of patching. • Basics of writing a module.

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

A lover of memes.

How to R.E.A.D! (yay acronyms!) !

R.E.A.D • Research what exists. • Evaluate the options. • Analyze the gap. • Determine amount of change. #justREAD

Research what exists.

Research what exists. • Isolate keywords about functionality. • Search for existing modules. • Use the community.

Evaluate the options.

Evaluate the options. • Read the module description. • Look at community adoption. • Look at maintainer activity.

Analyze the gap.

Analyze the gap. • Download and test the module. • Discover missing functionality. • Check issue queue for solutions.

Patch not found.

Determine amount of change.

Determine amount of change. • Review the module code. • Estimate how much has to be changed. • Do changes extend or alter module?

Let’s review. Like developers…

…Flow Chart FTW! Use community solutions. YES Research.! Find modules? YES Evaluate.! find best fit? NO YES Analyze.! is there a gap? YES NO NO Community solutions exist? NO Use existing module. Build a custom module. YES Determine.! big change? NO Patch.

…Flow Chart FTW! Use community solutions. YES Research.! Find modules? YES Evaluate.! find best fit? NO YES Analyze.! is there a gap? YES NO NO Community solutions exist? NO Use existing module. Build a custom module. YES Determine.! big change? NO Patch.

Examples.

Scenario #1.

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 !

Step 1 Research what exists.

Research what exists. Isolate keywords about functionality. 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. !

Research what exists. Search for existing modules.

Research what exists. Talk to the community. IRC: #drupal, #drupal-support

Research what exists. Find possible existing solutions • The Exif module • The Exif custom module

Step 2 Evaluate the options.

Evaluate the options Read the module description.

Evaluate the options Look at community adoption. Exif Exif Custom

Evaluate the options Look at maintainer activity.

Evaluate the options Determine best fit.

Step 3 Analyze the gap.

Analyze the gap. Download and test the module.

Analyze the gap. Discover missing functionality.

Analyze the gap. Check issue queue for solutions.

Step 4 Determine amount of change.

Determine amount of change. Review the module code.

Determine amount of change. Estimate how much has to be changed. • Requires little rewriting of code base. • Need to add new hooks and one new file.

Determine amount of change. Will changes extend or alter the module?

Which path to choose? • Patch Exif Custom module ! • Write own Exif module

PATCH!

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.

How to create a Patch. • Clone module repository. • Create a new branch. • Make changes to code. • Test changes. • Generate the patch.

Clone module repository. mm:~$ git clone —branch 7.x-1.x http://git.drupal.org/project/exif_custom.git

Create a branch. mm:exif_custom$ git checkout -b patch/features_integration

Make changes.

Test changes.

Create the patch file. mm:exif_custom$ git diff 7.x-1.x > exif_custom-features_integration.patch

How to submit a Patch. • Create/Comment on an issue. • Attach the patch. • • [description]-[issue-number]-[comment-number].patch Revise based on testing/reviews.

Create an issue.

Attach the patch. [description]-[issue-number]-[comment-number].patch

Contributing back to the community.

Scenario #2.

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

Step 1 Research what exists.

Research what exists. Isolate keywords about functionality. 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

Research what exists. Search for existing modules.

Step 2 Evaluate the options.

Evaluate the options Read the module description.

Evaluate the options Look at community adoption.

Evaluate the options Look at maintainer activity.

Step 3 Analyze the gap.

Analyze the gap. Download and test the module.

Analyze the gap. Discover missing functionality. • Unable to create different transitions per type • Unable to select different transitions for revisions • No features integration.

Step 4 Determine amount of change.

Determine amount of change. Review the module code.

Determine amount of change. Estimate how much has to be changed. • Will need to change how transitions are created. • Will need to change how schedules are stored. • Will need to add features integration.

Determine amount of change. Will changes extend or alter the module?

Which path to choose? • Patch Scheduler workbench module ! • Write own scheduler module

CUSTOM MODULE!

Module Writing Guidelines. • drupal.org/developing/modules • Follow Drupal coding standards. • Make use of hooks and APIs. • Test your code.

Contributing a module. • Is it functionality other could use? • Name appropriately. • Provide accurate description. • Be an active maintainer.

Name appropriately.

Provide detailed description.

Be an active maintainer.

Free QA and improvements from community.

How to R.E.A.D. • Research what exists. • Evaluate the options. • Analyze the gap. • Determine amount of change. #justREAD

Thank You! @mikemiles86