In the latest of the Dash saga, developer Kapeli announced that it was open sourcing its iOS app. This was initially met with applause--but then horror--as people started pouring over its source code:
Dash for iOS is open-source and I oh my god this Objective-C if statement 🙃https://t.co/AewEI9Pp9c pic.twitter.com/seHRfK4y9S— Patrick Balestra (@BalestraPatrick) November 14, 2016
And then the subsequent responses:
@BalestraPatrick this is why people are afraid of open sourcing their code, already 200 RTs 😢— Felix Krause 🚀 (@KrauseFx) November 15, 2016
@KrauseFx @BalestraPatrick @wtsnz depressing how we turn to code shaming like this. :(— Elland (@elland) November 15, 2016
The code pointed out by Patrick Balestra is definitely cringe-worthy: there are some fairly obvious ways that this could be better handled that don't involve a 50 line if-statement. I don't think there is any dispute over that. But here's a dirty secret: we all write code that we are ashamed of, is inelegant, or is outright awful. If any developer claims otherwise, run away, quickly, because they probably lack the self-awareness to realize it.
Despite my own opinions of how last month's drama played out, I respect Kapeli for making himself vulnerable and open to ridicule. Because he had reached a dead end with the App Store he decided that there was someone out there that would be able to get value out of his hard work and release it despite its warts. That takes an incredible amount of courage to do, as evidenced by the caustic reactions to the code.
Though I do not think that Patrick's intentions were necessarily mean spirited, words matter. The way in which we point out flaws matters. Maybe his reaction left too much room for misinterpretation, as well, as evidenced by this subsequent tweet:
I apologized to @kapeli for my tweet. It wasn’t my intention to scare people away from open-sourcing their code.— Patrick Balestra (@BalestraPatrick) November 15, 2016
And then to bring it to conclusion, Kapeli's graciousness in accepting the apology:
.@BalestraPatrick Don’t worry about it. You probably saved the world. That if statement was soon to become sentient.— Kapeli (@kapeli) November 15, 2016
What is sad to me, however, is that the apology didn't get as much socialization as the initial tweet. I guess it never does. People only remember the pithy quip, not the subsequent retraction.
But I wonder if the antidote, at least in this situation, should be more openness. More sharing of code. Making ourselves vulnerable more commonplace. And in that spirit, I am open sourcing some code that I had intended to be open, but had not because of my own insecurities. Announcing: CameraPicker, a camera picking control that looks strikingly similar to the picker that can be found in Apple's iMessage app on iOS 10.
I really liked how Apple streamlined the process of getting an image in as few taps as possible. It really is a great experience that I feel should be more pervasive across iOS. This was my first serious attempt at making something in Swift, so I hope that by releasing it I'll get some feedback on structure, naming, and all those things that go into making great Swift code.