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

How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Embed Size (px)

DESCRIPTION

To use a contrib module, patch a contrib module or write a custom module, that is the question. With over 27,000 contrib 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 module? To figure out the answer to the questions you just need to remember to R.E.A.D. This session goes 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. This session use some real world examples to demo straight how these steps were utilized to make the correct decision. This session 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.

Citation preview

Page 1: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

How to R.E.A.DSteps for selecting the correct module.

#PatchOrCustom, #justREAD

Page 2: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Who You Are.

• Site Builder

• Developer

• Decision Maker

• New to Drupal !

• Want to re-enforce habits

Page 3: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

What’s it all about.

How to quickly make smart, informed decisions.

Page 4: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

What we’ll cover.

• Steps to decide between a contrib, patched or custom module.

• Basics of patching.

• Basics of writing a module.

Page 5: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 6: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

A lover of memes.

Page 7: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

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

Page 8: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

R.E.A.D

• Research what exists.

• Evaluate the options.

• Analyze the gap.

• Determine amount of change.

#justREAD

Page 9: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Research what exists.

Page 10: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Research what exists.

• Isolate keywords about functionality.

• Search for existing modules.

• Use the community.

Page 11: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
Page 12: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Evaluate the options.

Page 13: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Evaluate the options.

• Read the module description.

• Look at community adoption.

• Look at maintainer activity.

Page 14: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
Page 15: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Analyze the gap.

Page 16: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Analyze the gap.

• Download and test the module.

• Discover missing functionality.

• Check issue queue for solutions.

Page 17: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Patch not found.

Page 18: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Determine amount of change.

Page 19: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Determine amount of change.

• Review the module code.

• Estimate how much has to be changed.

• Do changes extend or alter module?

Page 20: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Let’s review.

Like developers…

Page 21: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 22: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 23: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Examples.

Page 24: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Scenario #1.

Page 25: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 26: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Step 1 Research what exists.

Page 27: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 keywords about functionality.Research what exists.

Page 28: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Search for existing modules.Research what exists.

Page 29: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Talk to the community.Research what exists.

IRC: #drupal, #drupal-support

Page 30: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Find possible existing solutionsResearch what exists.

• The Exif module

• The Exif custom module

Page 31: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Step 2 Evaluate the options.

Page 32: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Read the module description.Evaluate the options

Page 33: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Look at community adoption.Evaluate the options

Exif

Exif Custom

Page 34: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Look at maintainer activity.Evaluate the options

Page 35: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Determine best fit.Evaluate the options

Page 36: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Step 3 Analyze the gap.

Page 37: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Download and test the module.Analyze the gap.

Page 38: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Discover missing functionality.Analyze the gap.

Page 39: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Check issue queue for solutions.Analyze the gap.

Page 40: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Step 4 Determine amount of change.

Page 41: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Review the module code.Determine amount of change.

Page 42: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Estimate how much has to be changed.Determine amount of change.

• Requires little rewriting of code base.

• Need to add new hooks and one new file.

Page 43: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

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

Page 44: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Which path to choose?

• Patch Exif Custom module !

• Write own Exif module

Page 45: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

PATCH!

Page 46: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 47: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

How to create a Patch.

• Clone module repository.

• Create a new branch.

• Make changes to code.

• Test changes.

• Generate the patch.

Page 48: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Clone module repository.

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

Page 49: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Create a branch.

mm:exif_custom$ git checkout -b patch/features_integration

Page 50: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Make changes.

Page 51: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Test changes.

Page 52: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Create the patch file.

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

Page 53: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 54: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Create an issue.

Page 55: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Attach the patch.

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

Page 56: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
Page 57: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Contributing back to the community.

Page 58: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Scenario #2.

Page 59: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 60: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Step 1 Research what exists.

Page 61: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 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 keywords about functionality.Research what exists.

Page 62: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Search for existing modules.Research what exists.

Page 63: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Step 2 Evaluate the options.

Page 64: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Read the module description.Evaluate the options

Page 65: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Look at community adoption.Evaluate the options

Page 66: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Look at maintainer activity.Evaluate the options

Page 67: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Step 3 Analyze the gap.

Page 68: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Download and test the module.Analyze the gap.

Page 69: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Discover missing functionality.Analyze the gap.

• Unable to create different transitions per type

• Unable to select different transitions for revisions

• No features integration.

Page 70: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Step 4 Determine amount of change.

Page 71: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Review the module code.Determine amount of change.

Page 72: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Estimate how much has to be changed.Determine amount of change.

• Will need to change how transitions are created.

• Will need to change how schedules are stored.

• Will need to add features integration.

Page 73: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

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

Page 74: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Which path to choose?

• Patch Scheduler workbench module !

• Write own scheduler module

Page 75: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

CUSTOM MODULE!

Page 76: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Module Writing Guidelines.

• drupal.org/developing/modules

• Follow Drupal coding standards.

• Make use of hooks and APIs.

• Test your code.

Page 77: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Contributing a module.

• Is it functionality other could use?

• Name appropriately.

• Provide accurate description.

• Be an active maintainer.

Page 78: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Name appropriately.

Page 79: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Provide detailed description.

Page 80: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Be an active maintainer.

Page 81: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Free QA and improvements from community.

Page 82: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
Page 83: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

How to R.E.A.D.

• Research what exists.

• Evaluate the options.

• Analyze the gap.

• Determine amount of change.

#justREAD

Page 84: How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014

Thank You!

@mikemiles86