How a Crowdsourced Code Snippet Library Can Boost Your Open Source Project

Roughly one year ago this month Pippin Williamson made the first commit to Easy Digital Download’s “Library” repository on GitHub. He created the library to be a community-maintained repository of code snippets that modify the default behavior of Easy Digital Downloads.

So far the library has received 113 commits from eight contributors, which has resulted in more than sixty code snippets available to users and developers. The snippets cover everything from modifying the checkout experience to customizing the plugin’s email notifications.

edd-code-snippet-library

With more than half a million downloads on WordPress.org and 150+ free and commercial extensions, Easy Digital Downloads has a large community of developers who work with the software every day.

Williamson said that having the ability to share snippets for modifying EDD behavior has been hugely useful for the project. He only approves solid, tested code but in most cases the snippets have been submitted by the EDD team. Managing the repository hardly costs any time at all, “a few minutes per week at max,” he said.

The benefits of hosting a community-maintained repository of code snippets far outweigh the minimal time required to maintain it. “The biggest problem it has is humans: we tend to forget to put snippets up a lot of times,” Williamson said. He identified three key areas where the library benefits the project:

  • It’s a resource for the support team.
  • It’s a source of examples for people wanting to customize behavior.
  • It provides live testing (similar to add-on plugins) for potential features to add to core.

The most common way that snippets are added to the EDD library is through the support staff. “We write code snippets for customers while helping with support tickets and then we put the snippet in the library,” Williamson said.

He hasn’t seen any WordPress-based open source projects or products doing anything similar but thinks that others could gain some value from implementing a library. GenerateWP might be the closest example of a site attempting something similar for snippets that extend WordPress core, with its new user code library feature. However, this doesn’t have the collaborative benefits of hosting the library on GitHub.

Larger WordPress projects like the Pods Framework, Gravity Forms, WooCommerce, BuddyPress, Jetpack, etc., are prime candidates that might benefit from a library of tested snippets. Of course, it helps that the base EDD plugin is free and open source. A 100% commercial project may not fare as well with a crowdsourced snippet library.

Easy Digital Download is well known for being extensible and developer-friendly. Over the past two years Williamson built a community of contributors 120+ strong and found that extensibility has a direct correlation to profitability. The code snippet library is undoubtedly a valuable investment toward helping developers extend the base EDD plugin.

Could your open source project or product benefit from a community-maintained library of code snippets? A snippet library can keep developers from having to reinvent the wheel when performing common modifications. It also provides a tested resource of code samples for those who are just getting started extending your project. If Williamson’s experience is any proof, then the few minutes per week spent on a snippets library can pay off with a big boost for the community surrounding your project.

7

7 responses to “How a Crowdsourced Code Snippet Library Can Boost Your Open Source Project”

  1. That’s actually not a bad idea. I use to use the Adobe Air app called Snippley to organize all my Theme Options functionality. The downside to that is risk of losing all your data in a drive failure. I’ve moved most of my snippets over to github and placed private repos on Bitbucket.

    I’ve been dabbling with the idea of just having 1 repo with all my code snippets in them.

  2. This looks like an excellent idea. Thanks for sharing it. It might be a good idea for other projects to do the same. I particularly like that Pippin maintains some control over what code is included; that will give people a lot more trust in anything found on there and avoid having to wade through a lot of broken code just to find something which does what they need.

    I’m always hunting through folders for code snippets I’ve written previously, so I’ve started adding them to my website lately to make them easier to find for myself, but hopefully others may find them useful too … https://geek.hellyer.kiwi/tools/

  3. That’s really not a bad idea at all! Our team is in the baby steps of growing and right now we have a bunch of snippets that we share with each other. We have no problems with sharing it with others, we’re totally okay with that, but I didn’t think that it may be beneficial as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Discover more from WP Tavern

Subscribe now to keep reading and get access to the full archive.

Continue reading