R.E.A.D: Four steps for selecting the right modules

A presentation at Drupal MIDCamp in March 2015 in Chicago, IL, USA by Michael Miles

Slide 1

Slide 1

R.E.A.D How to select the right modules https://2015.midcamp.org/node/34 MidCamp 2015 #MidCamp

Slide 2

Slide 2

Who You Are New to Drupal. Want to improve habits. Session curious.

Slide 3

Slide 3

Your Role A Drupal developer. A site architect. Functionality decision maker.

Slide 4

Slide 4

What it is all About How to quickly make smart, informed functionality decisions.

Slide 5

Slide 5

What we will Cover Steps to decide between a contrib, patched or custom module. Basics of writing/contributing a patch. Basics of writing/contributing a module.

Slide 6

Slide 6

Michael Miles From: Boston, MA Work: Genuine ..a.k.a Planet Hoth (@WeAreGenuine) Exp: Working with Drupal since 2008. Recently named an Acquia M.V.P Twitter: @mikemiles86 Drupal.org: mikemiles86 All the Places: mikemiles86 mike­miles.com

Slide 7

Slide 7

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

Slide 8

Slide 8

Research What Exists

Slide 9

Slide 9

Isolate Keywords Read documentation, specs, etc… Pay attention to unique nouns and verbs. Ask questions!

Slide 10

Slide 10

Perform Searches 30k+ Modules available. Favorite search engine “Drupal [keyword]”. Search on Drupal.org

Slide 11

Slide 11

Utilize the Community Use IRC: #drupal, #drupal­support. Use Stack Exchange: drupal.stackexchange.com. Social Networks: G+, Facebook, LinkedIn. Even reddit! reddit.com/r/drupal.

Slide 12

Slide 12

Isolate Keywords. Perform Searches. Utilize Community.

Slide 13

Slide 13

Evaluate the Options

Slide 14

Slide 14

Read the Description What does the module do? What does the module not do? What does the module depend on?

Slide 15

Slide 15

Community Adoption Downloads vs. Installs vs. Age. Activity of issue queue. Issues are good, not bad!

Slide 16

Slide 16

Maintainer Activity Participate in issue queue? Accepting of feedback? Regular commits and/or releases?

Slide 17

Slide 17

Read the description. Check community adoption. Check maintainer activity.

Slide 18

Slide 18

Analyze the Gap

Slide 19

Slide 19

Download and Test the Module Gain a better understanding. Use a sandbox: simplytest.me. What is offered out of the box?

Slide 20

Slide 20

Discover Missing Functionality What does it not do? Missing 80%? Missing 20%? Bigger gap = Bigger effort.

Slide 21

Slide 21

Check for Community Solutions Look at the issue queue. Search “Drupal [module] [functionality]”. Ask questions!

Slide 22

Slide 22

Download and test the module. Discover missing functionality. Check for comunity solutions.

Slide 23

Slide 23

Determine Change

Slide 24

Slide 24

Review the Module Code Does it follow coding standards? Is it extendable? Can you figure out what does what?

Slide 25

Slide 25

Estimate Effort How much code to rewrite? How much code to add? How much time is there?

Slide 26

Slide 26

Extend or Alter Adding functionality? Changing functionality? Changing the modules goal?

Slide 27

Slide 27

Review module code. Estimate effort. Extend or alter?

Slide 28

Slide 28

Slide 29

Slide 29

Examples

Slide 30

Slide 30

Scenario #1

Slide 31

Slide 31

The Requirements WHEN SAVING A FILE ENTITY 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

Slide 32

Slide 32

Research What Exists

Slide 33

Slide 33

Isolate Keywords WHEN SAVING A FILE ENTITY 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

Slide 34

Slide 34

Perform Search We will focus on the keyword “Exif”

Slide 35

Slide 35

Search Google

Slide 36

Slide 36

Utilize the Community

Slide 37

Slide 37

Evaluate the Options Exif custom seems like best fit.

Slide 38

Slide 38

Read the Module Description

Slide 39

Slide 39

Look at Community Adoption

Slide 40

Slide 40

Look at Maintainer Activity

Slide 41

Slide 41

Analyze the Gap

Slide 42

Slide 42

Download and Test the Module

Slide 43

Slide 43

Discover Missing Functionality

Slide 44

Slide 44

Check for Solutions

Slide 45

Slide 45

Determine Change

Slide 46

Slide 46

Review Code

Slide 47

Slide 47

Estimate Effort Add Features integration. Alter primary key for mappings. Time is minimal.

Slide 48

Slide 48

Extend or Alter Adding features support. Not changing what module does. Extending.

Slide 49

Slide 49

Which Path to Choose Use module as is. Patch module. Write own module.

Slide 50

Slide 50

Patch! Module meets 90% of needs. Small gap, small effort. Extends module.

Slide 51

Slide 51

What is a Patch? drupal.org/patch. A structured list of changes to files. Re­appliable to files. Focused on a single change.

Slide 52

Slide 52

Creating a Patch

Slide 53

Slide 53

Clone and branch module git repo.

Slide 54

Slide 54

Make changes to code.

Slide 55

Slide 55

Test your changes.

Slide 56

Slide 56

Generate patch file.

Slide 57

Slide 57

diff —git a/exif_custom.features.inc b/exif_custom.features.inc new file mode 100644 index 0000000..243bbe2 —- /dev/null +++ b/exif_custom.features.inc @@ -0,0 +1,158 @@ +<?php +/** + * @file + * Features file for the exif_custom module. + / + +/* + * Implements hook_features_api(). + */ +function exif_custom_features_api() { + return array( + ‘exif_custom’ => array( + ‘name’ => t(‘EXIF Custom mappings’), + ‘default_hook’ => ‘exif_custom_export_maps’, + ‘feature_source’ => TRUE, + ‘default_file’ => FEATURES_DEFAULTS_INCLUDED, + ‘file’ => drupal_get_path(‘module’, ‘exif_custom’) . ‘/exif_cus + ), + ); +} +…

Slide 58

Slide 58

Submitting a Patch

Slide 59

Slide 59

Create/comment on issue queue.

Slide 60

Slide 60

Attach your patch. Follow patch naming standards [module]­[description]­[issue­number]­[comment­number].patch

Slide 61

Slide 61

Watch for feedback.

Slide 62

Slide 62

Wait for merge. (hopefully)

Slide 63

Slide 63

Giving back to the community

Slide 64

Slide 64

Scenario #2

Slide 65

Slide 65

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

Slide 66

Slide 66

Research What Exists

Slide 67

Slide 67

Isolate Keywords 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

Slide 68

Slide 68

Search for Existing Modules We will focus on the keywords “workbench schedule”

Slide 69

Slide 69

Search Drupal

Slide 70

Slide 70

Evaluate the Options Look at Scheduler Workbench Integration.

Slide 71

Slide 71

Read the Module Description

Slide 72

Slide 72

Look at Community Adoption

Slide 73

Slide 73

Look at Maintainer Activity

Slide 74

Slide 74

Analyze the Gap

Slide 75

Slide 75

Download and Test the Module

Slide 76

Slide 76

Discover Missing Functionality Unable to create different transitions per type. Unable to select per revision. No features support.

Slide 77

Slide 77

Determine Change

Slide 78

Slide 78

Review Code

Slide 79

Slide 79

Estimate Effort Refactor creating schedules & transitions. Decouple transitions from content types. Add Features integration. Will take time.

Slide 80

Slide 80

Extend or Alter Changing how transitions/schedules are created. Changing purpose of module. Altering.

Slide 81

Slide 81

Which path to choose? Use module as is. Patch module. Write own module.

Slide 82

Slide 82

Build a custom module! Too big/complicated to be a patch. Would alter module goals. No other module exists to support use cases.

Slide 83

Slide 83

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

Slide 84

Slide 84

Contributing a Module Ask yourself: Could others use this? Seriously, is it abstracted enough?

Slide 85

Slide 85

Name module appropriately. Namespace based on dependencies. Be clear, not clever. Should indicate what module does.

Slide 86

Slide 86

Slide 87

Slide 87

Provide a detailed description. Explain what module does and does not do. Outline any dependencies. Help fellow R.E.A.D­ers.

Slide 88

Slide 88

Slide 89

Slide 89

Be a good maintainer. Bugs are badges not bruises. Participate in the issue queue. Update, release and improve.

Slide 90

Slide 90

Slide 91

Slide 91

Let’s review

Slide 92

Slide 92

Remember to R.E.A.D Research what exists. Evaluate the options. Analyze the gap. Determine amount of change. bit.ly/drupalREAD

Slide 93

Slide 93

Sprint Sunday 09:00-17:00 The Nerdery, 300 N Elizabeth St., Suite 500C http://2015.midcamp.org/schedule Learn through contribution Contributors of all skill sets and levels are welcome and encouraged

Slide 94

Slide 94

Feedback https://joind.in/talk/view/13791 Speaker Name: @mikemiles86 #MidCamp

Slide 95

Slide 95

Thank You! #MidCamp R.E.A.D / Michael Miles