Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Contributing to Drupal


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Contributing to Drupal

  1. 1. Contributing to Drupal Christopher Skene
  2. 2. Summary <ul><li>What is Drupal and who contributes? </li></ul><ul><li>Why contribute to Drupal? </li></ul><ul><li>Challenges of contributing? </li></ul><ul><li>Types of contributions </li></ul><ul><li>Case study: Display Suite </li></ul>
  3. 3. What is Drupal <ul><li>Open-source content management platform </li></ul><ul><li>A blogging tool </li></ul><ul><li>An enterprise-grade CMS </li></ul><ul><li>An extensible publishing tool </li></ul><ul><li>An application framework </li></ul><ul><li>A linked-data publishing tool </li></ul><ul><li>A community of 100s of 1000s of users </li></ul><ul><li>A collaborative development project </li></ul>
  4. 4. The best bits <ul><li>Balances flexibility with ease-of-use </li></ul><ul><li>Extensible </li></ul><ul><li>Uses design patterns extensively </li></ul><ul><li>Completely open-source </li></ul><ul><li>Collaborate with other developers </li></ul><ul><li>Can be scaled acceptably </li></ul><ul><li>Most content problems already solved through contributed modules </li></ul><ul><li>You can rely on community developers </li></ul>
  5. 5. The worst bits <ul><li>Some design patterns are Drupal-specific </li></ul><ul><li>Still fundamentally based around procedural code </li></ul><ul><li>Learning to use the API takes time </li></ul><ul><li>Modules don’t always do what they say </li></ul><ul><li>Though improving, some internal logic is harebrained </li></ul><ul><li>Big implementations are no less complex than other enterprise CMSs </li></ul><ul><li>You have to rely on community developers </li></ul>
  6. 6. Who contributes? <ul><li>Drupal 7 Core commit statistics… </li></ul><ul><li>There were 954 people mentioned. </li></ul><ul><li>A total of 10,091 mentions in 6,117 patches (about 1.6 people per patch) </li></ul><ul><li>The top 10 people were mentioned in 30% of the commits </li></ul><ul><li>The top 20% were mentioned in 85% </li></ul><ul><li>People with 3 or fewer mentions form a group that are responsible for almost 10% of mentions = long tail </li></ul><ul><li>-- Greg Knaddison, @greggles, maintainer 6yr 2wk, 1013 commits </li></ul>
  7. 7. @xtfer <ul><li>Web developer, project manager, communications and marketing practitioner </li></ul><ul><li> </li></ul><ul><li> member for 6yr 9 wks </li></ul><ul><li>127 commits </li></ul><ul><li>Maintainer for contrib modules Display Suite 6.x, Layouts, Registry, Query Tools , and the Velo administration theme </li></ul><ul><li>Built a large number of government and non-profit sites using Drupal 5, 6 & 7 </li></ul><ul><li>Contributor to the Drupal 8 core context initiative </li></ul><ul><li>First module (a Drupal 5 theme engine) in 2007 </li></ul><ul><li>First module contribution April 2011 </li></ul>
  8. 8. Why contribute? <ul><li>It's fun to learn things. </li></ul><ul><li>It's fun to solve problems. </li></ul><ul><li>It's fun to help people out. </li></ul><ul><li>The work you contribute back to the community can be multiplied many-fold by the others in the community. In turn, their work can provide a base for further work. </li></ul><ul><li>Sometimes, it can even be beneficial to your job prospects. </li></ul><ul><li>-- Evan Donovan, @EvanDonovan </li></ul><ul><li>4 yr 14 wk, 151 commits </li></ul>
  9. 9. Also… <ul><li>A rising tide raises all boats </li></ul><ul><li>Providing solutions is the fastest way to get people to help you </li></ul><ul><li>Everyone has different skills – the whole is greater than the sum of its parts </li></ul>
  10. 10. Challenges of contributing <ul><li>Learning the basic APIs first takes time </li></ul><ul><li>Breaking PHP programming habits </li></ul><ul><li>Understanding the breadth of modules already available </li></ul><ul><li>Tough review processes </li></ul><ul><li>Lots of waiting </li></ul><ul><li>Dealing with technical criticism </li></ul><ul><li>Nobody uses your module (rejection) </li></ul><ul><li>Everybody uses your module (overload) </li></ul><ul><li>You can, and will often, be wrong </li></ul>
  11. 11. Ways to contribute <ul><li>User support </li></ul><ul><li>Documentation </li></ul><ul><li>Help to maintain existing modules </li></ul><ul><ul><li>Help maintain issue queues (triage etc) </li></ul></ul><ul><ul><li>Track down reported bugs </li></ul></ul><ul><li>Translations </li></ul><ul><li>Testing </li></ul><ul><li>Design and Usability </li></ul><ul><li>Donations </li></ul><ul><li>Module and theme development </li></ul>
  12. 12. Developer contributions <ul><li>Theming (i.e. working with the theme layer) </li></ul><ul><li>Glue code (usually submitted to documentation) </li></ul><ul><li>Module patches  </li></ul><ul><li>Custom module functionality </li></ul><ul><li>Contributed modules & themes </li></ul><ul><li>Core patches </li></ul><ul><li>Core initiatives </li></ul>
  13. 13. Theming <ul><li>Most people start with theming </li></ul><ul><li>Simple PHP </li></ul><ul><li>HTML & CSS </li></ul><ul><li>Extending a base theme (e.g. Zen, Omega) </li></ul><ul><li>Some snippits contributed to documentation </li></ul><ul><li>Unlikely to result in a community contribution </li></ul>
  14. 14. Glue Code <ul><li>Make modules work together </li></ul><ul><li>Customise module behaviour for a given project </li></ul><ul><li>Requires no module changes </li></ul><ul><li>May appear in a custom module or theme </li></ul><ul><li>Sometimes submitted to documentation or on blog posts, but rarely results in a module </li></ul>
  15. 15. Module patches <ul><li>Bugs, features or integration work for existing modules </li></ul><ul><li>Anyone can contribute but module maintainer has final decision </li></ul><ul><li>Patches count as a commit, if attributed correctly </li></ul>
  16. 16. Basic patch workflow <ul><li>Try to reproduce the issue based on the provided information </li></ul><ul><li>If you can’t, ask for steps to reproduce </li></ul><ul><li>Reclassify the issue if necessary </li></ul><ul><li>-- How to contribute to Drupal </li></ul><ul><li> </li></ul><ul><li>by Sascha Grossenbacher, @Berdir </li></ul><ul><li>3yr 46 wks, 710 commits </li></ul>
  17. 17. Tips <ul><li>Procedures differ somewhat by maintainer and module </li></ul><ul><li>Some modules may be effectively abandoned </li></ul><ul><li>Get a good git viewer </li></ul><ul><ul><li>e.g. SourceTree, Tower, gity, gitx </li></ul></ul><ul><li>Test fixes with a clean Drupal site and the default theme </li></ul>
  18. 18. Help a patch along… <ul><li>Learn to roll a git patch correctly </li></ul><ul><li>Use the right issue number in your patch </li></ul><ul><li>Check your work with the Coder module </li></ul><ul><li>If a module has tests, update the tests if necessary </li></ul><ul><li>Swap patch reviews with colleagues </li></ul><ul><li>Providing accurate and concise descriptions of problems </li></ul><ul><li>Refrain from posting till you’ve worked through the problem properly </li></ul>
  19. 19. Creating a patch <ul><li>Set up a clean environment </li></ul><ul><li>Apply existing patch (if applicable) </li></ul><ul><li>Work on your fix </li></ul><ul><li>Test (preferably using the SimpleTest framework) </li></ul><ul><li>Check formatting </li></ul><ul><li>Comment appropriately </li></ul><ul><li>Submit the patch to the appropriate issue and mark it &quot;Needs review” </li></ul><ul><li>-- Novice Code Contribution Guide, </li></ul><ul><li>mostly by @kathyh </li></ul><ul><li>2yr 46w, no commits, lots of presentations </li></ul>
  20. 20. General rules for committing code <ul><li>No changes are committed without a corresponding issue on </li></ul><ul><li>Patches need to be reviewed by others and must be in Reviewed and Tested By the Community (RTBC) state before committing them. </li></ul><ul><li>Ideally, another project maintainer reviewed them and had no objections. </li></ul><ul><li>However, if patches are unnecessarily held off because of missing reviews, then they should be committed, so development can go on. Project maintainers are often involved in many other projects, and they have a life, too. </li></ul><ul><li>Follow the best practices for commit messages. </li></ul>
  21. 21. Contributing modules and themes <ul><li>When to contribute? </li></ul><ul><ul><li>Has it been done already? </li></ul></ul><ul><ul><li>Can you collaborate? </li></ul></ul><ul><ul><li>Is there a need? </li></ul></ul><ul><ul><li>Have you built it anyway? </li></ul></ul><ul><li>Sandbox vs Full projects </li></ul><ul><li>Read Applying for permission to create full projects </li></ul>
  22. 22. Module stats <ul><li>12699 modules total </li></ul><ul><li>9016 full projects </li></ul><ul><li>3516 sandboxes </li></ul><ul><li>773 4.7.x full modules </li></ul><ul><li>2638 5.x full modules </li></ul><ul><li>6189 6.x full modules </li></ul><ul><li>2708 7.x full modules </li></ul><ul><li>35 8.x full modules </li></ul>
  23. 23. Module developer tips <ul><li>Don’t create duplicate work </li></ul><ul><li>Balance abstraction with complexity </li></ul><ul><li>Build a proper internal API (you’ll thank yourself later) </li></ul><ul><li>Use object-oriented programming </li></ul><ul><li>Always use the Drupal APIs where relevant </li></ul><ul><li>Release before a major code change is committed to the repository, not just after </li></ul><ul><li>Learn how to do test-driven development </li></ul>
  24. 24. Module maintainer tips <ul><li>Check your issue queues regularly </li></ul><ul><li>Write good comments, including… </li></ul><ul><ul><li>What has changed </li></ul></ul><ul><ul><li>Any information a dev might need to implement a feature </li></ul></ul><ul><ul><li>The reasons why a change may not be made </li></ul></ul><ul><li>Close issues you don’t intend to work on, stating why </li></ul>
  25. 25. Display Suite <ul><li>Created by Kristof de Jaeger </li></ul><ul><ul><li>@swentel, 2367 commits, contributor to 29 modules, lives in Gent, has a Drupal tattoo </li></ul></ul><ul><li>Missing Drupal feature </li></ul><ul><ul><li>Change field formatters, labels etc </li></ul></ul><ul><ul><li>Custom fields </li></ul></ul><ul><ul><li>Views integration </li></ul></ul><ul><li>Consists of 1 core API module and 5 provider modules </li></ul>
  26. 26. Control presentation of fields
  27. 27. Display Suite in Drupal 7
  28. 28. Display Suite in Drupal 6
  29. 29. Things I do as a maintainer <ul><li>Check the Display Suite 6.x issue queue every 1 to 3 days </li></ul><ul><li>Respond to support requests </li></ul><ul><li>Triage, prioritise and patch bug fixes </li></ul><ul><li>Plan development for new work in 6.x </li></ul><ul><li>Talk to people about Display Suite </li></ul><ul><li>Keep the module owner (Kristoff) in the loop </li></ul><ul><li>Not including new work, about ½ hr per week </li></ul>
  30. 30. Motivations for becoming a maintainer <ul><li>For an existing production site: </li></ul><ul><ul><li>Fix some major bugs </li></ul></ul><ul><ul><li>Add support for CCK3’s multigroup feature </li></ul></ul><ul><li>Drupal 6.x still has extensive use. Upgrading to 7.x is not always possible. Display Suite is a way to improve 6.x sites without upgrade. </li></ul><ul><li>Improve my reputation as a Drupal developer </li></ul><ul><li>Improve my employment prospects </li></ul>
  31. 31. Thanks! <ul><li>[email_address] </li></ul><ul><li>@xtfer </li></ul><ul><li> </li></ul>
  32. 32. Want to know more? <ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul>
  33. 33. Basic skills for Module Maintainers <ul><li>Knowledge of PHP, MYSQL and JQuery as a basic requirement </li></ul><ul><li>Able to install Drupal on a server </li></ul><ul><li>Able to research and install modules to meet project requirements </li></ul><ul><li>Able to configure all the basic modules and core settings to get a site running </li></ul><ul><li>Able to create a custom Theme from scratch which validates with good HTML/CSS and also pays attention to usability and accessibility </li></ul><ul><li>Able to customise forms, core, themes without altering core files but by using template.php or a custom module. </li></ul><ul><li>Able to use Hooks in the theme template.php to alter forms, page layout and other core functionality </li></ul><ul><li>Know the most common hooks used in custom modules for accessing the core API </li></ul><ul><li>Can make forms from scratch using the Form API - with validation and posting back to the DB/email </li></ul><ul><li>Can use Views to create blocks or pages, use php snippets as arguments, etc. </li></ul><ul><li>Be involved with the community, understand the naming conventions, git system and ideally have submitted some code or revisions </li></ul><ul><li>Be a module co-maintainer (unlikely) </li></ul>
  34. 34. Guidelines for contributing code <ul><li>All code fully adheres to Drupal's coding standards, Doxygen, commenting, and documentation standards, and all other development standards handbook pages. </li></ul><ul><li>All code complies with Coder module's review rules. </li></ul><ul><li>All changes, especially new features and improvements, are done for the newest official branch first (master or latest core compatibility) and possibly backported afterwards. </li></ul><ul><li>If applicable, patches should be supplied for every branch of a project. However, focus on the latest major version first. </li></ul><ul><li>Discuss all changes in separate issues. Create issues for almost all changes, even if you could commit them directly. This not only allows others to review them, but is also the only way to adhere to Drupal's guidelines for commit messages. </li></ul><ul><li>When porting a module to a new version of Drupal core, keep changes minimal and focused. Meaning: no code clean-ups, no new features. </li></ul><ul><li>Defer larger improvements, rewrites, and optimizations to separate follow-up issues, in case the new Drupal core allows for any. They can be done later, and depending on API changes, possibly in a new major version of the project. </li></ul><ul><li>The goal is to make fast progress, allowing users to adopt the new version of Drupal core and your project. </li></ul><ul><li>Read and understand the meaning of major versions. </li></ul><ul><li>-- Daniel F Kudwein, @sun </li></ul><ul><li>5yr 32 wk, 3774 commits </li></ul><ul><li>~ 50 module contributions </li></ul><ul><li>#1 contributor to Drupal 7 </li></ul>
  35. 35. git usage <ul><li>all Drupal projects use git as their vcs </li></ul><ul><ul><li>With the exception of Pressflow 6.x </li></ul></ul><ul><li>Learn how to use git properly and effectively </li></ul><ul><li>Major versions are branches, prepended by the major Drupal version </li></ul><ul><ul><li>e.g. 6.x-1.x, 6.x-2.x, 7.x-1.x </li></ul></ul><ul><li>Individual releases are tags </li></ul><ul><ul><li>e.g. 6.x-1.12, 7.x-1.1 </li></ul></ul><ul><li>With the exception of the following, no other words can be used for downloadable releases: </li></ul><ul><ul><li>unstable x , alpha x , beta x , rc x </li></ul></ul><ul><li>Development work should be done in branches named with the issue number you are working on </li></ul>