#

It’s Not a Feature, it’s a Bug

September 23, 2013

Part of the open source way is community. Helping out and giving back. So I was happy to do just that as an assignment which was part of my studies in free and open source software. The assignment was to find a bug in an open source project and submit a patch to fix the bug.

Being a coffee-driven, sleep-deprived, do-ten-things-at-once college student, I decided that I would contribute to an open source project I had already used. Swipe.js is a carousel-like slider for websites. I say “carousel-like” because it’s not a carousel. Carousels display more than one thing at once, while this script slides things in and out of a box. Another bonus is that Swipe.js has 1-to-1 touch movement, so it works very well on mobile devices. I don’t really like using carousels prominently (for good reason), but Swipe makes sense in a mobile context. I used it last year on the RIT College Activities Board Springfest website (only on mobile 😉 ) to great effect. So I figured I’d give back.

Almost every other carousel script has support for captions…text associated with the image displayed somewhere else on the page. Swipe.js did not. For the CAB site, I used Swipe’s callback option to implement captioning, but I figured making it built-in would be easier for others to implement their own captions.

The process was standard 20 GOTO 10 for something open source. I forked the Github repo, added the code, did a bit of testing, pushed to my fork, and submitted a pull request to the master branch. As of this writing, the pull request has not been accepted, and that’s okay! The beauty of open source is in the keyword: open. Forking, patching, submitting…everything you could do to tweak something existing or make something new are encouraged.

I considered a couple of ways to implement the captions. My way is beneficial to existing installations of the script because it doesn’t break them. The Swipe object takes an optional array of options, the captions being one of them. So if someone doesn’t need captions, that’s fine. That part of the code just won’t execute. This allows Swipe to still be the super-great, super-lightweight plugin that it is, while being a little bit more robust.

I hope to contribute more to open source software in the future. It’s fun 🙂

Leave a Reply

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