Category: balanced


I asked for a t-shirt, I got a job


### I'm not just a developer Can a person truly be happy at their job? As I pondered this question over several months, I was arriving at a negative conclusion. I had what I considered to be a good job– I made decent money, the benefits were good, my bills were getting paid, and I was living a relatively comfortable life. Something was still lacking, though, and I began to notice I wasn’t happy. I love writing software, and I feel fortunate to have my interests coincide with my profession. I very much enjoy being creative and taking pride in my work. Coding makes me happy. So why wasn’t I? At the time, I was working for a “closed” company. One, in fact, that practiced stacked ranking, and prohibited contributing work back to open source projects. This company placed no value on developer involvement in feature planning and expected developers to just code what they ask for. All the credit for a successful feature addition would go to the project manager, and all the blame for a problem or failure would land on the developer. Opportunities for learning new technologies and methodologies were practically non-existent as the company demonstrated a strong bias to arcane technologies because that's "how it's always been." This environment was crushing my creativity, and that was something I refused to lose. ### Pursuing a creative outlet My creativity is the core for everything I do. It's what motivates me. My job wasn't challenging; it stood as a blockade to learning and creativity. I decided to retain my creativity by beginning work on a free time project; something that would allow me to apply knowledge gained though leisurely studies. This project required a payments solution. I've never liked dealing with payment gateways and wasn't looking forward to, once again, dealing with companies like PayPal and; whose integration, documentation, agreements, and pricing are vastly overcomplicated. I was looking for one with two specific features. First, I needed to accomplish a payment scenario where I would charge buyer A, then pay out to seller B without being a middleman – a marketplace solution of sorts. Second, I needed the ability to debit bank accounts. I spent several months researching various payments solutions, but results proved disappointing. Some only processed credit cards. Some had vague pricing. Some had horrible documentation. Most were generally very overcomplicated. Many had horrible support. Then, I found [Balanced]( Balanced had an [IRC]( channel where I could get support directly from developers. I inquired about [ACH debit]( support and they said they didn't have the ability yet but that it was on the [roadmap]( for the near future. Since I wasn't in a hurry, I decided to continue implementing Balanced into my application while they developed the feature I needed. I began by hanging around in the [Balanced IRC channel]( asking questions here and there. I was impressed by the Balanced team's helpfulness and politeness. On several occasions they directly asked me for my feedback on their style of operation. Balanced completely changed my opinion of working with payment gateways. In a short space of time, I started to find the Balanced IRC channel to be an enjoyable place to hang out. I appreciated the help I received from them, so I began answering questions in the channel as a means of giving back and saying thanks. This was often followed up by a series of appreciative remarks from several Balanced employees. Before I knew it, my creative outlet had become Balanced. It was like my second job, my fun job. I couldn't wait to get through the day at that boring company and return home to work on exciting Balanced projects. ### I asked for a t-shirt It was at about this point when I had a breakthrough. Balanced had been using Github in a very unique way. They used Github issues to not only track problems, but also to openly design features and prioritize them for implementation. I then realized Balanced wasn’t just an open source company, it was an “open company”. My contributions, be it code pull requests, comments, questions, or feature requests, all meant something. I wasn’t just contributing to open source, I was contributing to the company. My creativity was welcomed. I was helping shape Balanced. I really liked the direction Balanced was going and had a genuine desire to see them grow to become a leading player in the payments industry. I felt honored to contribute to such a great company, help realize their vision, and become a part of the Balanced legacy. The satisfaction I felt drove me to more actively contribute to [balanced-ruby]( and look for other areas where Balanced could possibly benefit from my skills. While hanging out in IRC, a frequent question asked was if Balanced had an iOS library. The answer was always the same- “not yet, but we hope to have one soon!” Since I work a lot with Mac OS X and iOS Objective-C applications, I saw the opportunity to contribute and spent the next few evenings creating [balanced-ios]( I can only imagine the incredulous surprise that must have ensued when I presented it to Balanced. They openly mentioned me in interviews and articles, thanking me for my work [1]. For weeks they pestered me about paying for my contributions. Each time I replied that I wasn’t motivated by money; I contributed because I believed in Balanced and wanted to see it grow and succeed. They were relentless though, so I asked if I could just have a Balanced t-shirt. They sent me four. ### I got a job What's the worth of a t-shirt? The company which employed me showed no appreciation for my work, so I decided to give my work where it would be valued. The t-shirt is my badge of recognition and I consider it to be priceless. Shortly after the first release of balanced-ios, I was asked if I wanted to work full-time at Balanced. At the time, Balanced had a strict no remote worker policy, so I reluctantly declined because I couldn’t move away from family. This deterrent didn’t change my drive to keep contributing to Balanced, though. Another few months passed, and I started to see more requests for an Android library. So I made [balanced-android]( over the course of a few evenings and gave it to Balanced. I’m not sure what made them rethink their policy, but Balanced again asked me to come work for them, this time as their first remote developer. I’m now a full-time remote employee at Balanced, and I’m loving every minute of it. In complete contrast to my old job, I’m able to be creative and work on new things to make the payments industry better, especially for marketplaces. It's refreshing and inspiring to work in an environment where it's commonplace to hear, "Want to take a whack at it?" when asking about an issue or proposing a feature. I feel that I am a valued member of the company. I asked for a t-shirt, and I got a job, plus much more. I now know that the key to finding happiness in my career isn’t just by doing what I love, but by also being part of a team that openly appreciates everyone’s achievements and gives people the freedom to thrive in their passions. Discussion on HackerNews: []( 1. [Why I Made My Payments Startup An Open Company][]
    [Balanced adds Andreessen Horowitz and Collaborative...][]
[Why I Made My Payments Startup An Open Company]: [Balanced adds Andreessen Horowitz and Collaborative...]:

balanced-ios Project Architecture

balanced, ios

A few months ago I authored balanced-ios, an iOS framework for tokenizing credit cards and bank accounts for Balanced Payments. It's since seen great adoption and as more people use it, automated testing of pull requests have become imparative to the project's growth and stability. Recently I change the architecture of balanced-ios. This post will explain how it used to work, how it works now, and the reasons for the changes. ### Old balanced-ios Architecture (Framework)

Distributing libraries in a developer-friendly manner is tricky. You need to include not only the library itself, but also any public include files, resources, scripts etc.

Apple's solution to this problem is frameworks, which are basically folders that follow a standard structure to include everything required to use a library. Unfortunately, in disallowing dynamically linked libraries in iOS, Apple also removed static iOS framework creation functionality in Xcode.

Unfortunately Xcode currently provides no template to create a framework for iOS. Following several guides for manually making one proved unfruitful and I eventually stumbled upon [iOS-Universal-Framework]( which, amazingly enough, just worked.

Xcode is still technically capable of building frameworks for iOS, and with a little tweaking it can be re-enabled.

Static frameworks are perfectly acceptable for packaging code intended for the app store. Despite appearances, it's just a static library at the core.

Fantastic! Getting set up with iOS-Universal-Framework was as simple as cloning the project, firing up the installer script, answering a few questions that already had sensible defaults, and entering a sudo password. ### The Problem(s) #### Integration Barrier Making use of iOS-Universal-Framework introduced a dependency for getting the project running on any given machine. Some developers struggled to understand what they needed to do to get the project to build. Simplicity was the goal and it became obvious this framework template requirement was stifling the project's growth. #### Testability As more people began to use the framework and submit pull requests to make balanced-ios even better, it became increasingly time consuming to pull down each fork and run the test suite to ensure non-breaking changes. Implementing automated testing became imparative. Travis-ci was a clear choice for performing automated tests for balanced-ios but certain challenges made the integration difficult. Travis-ci does not allow sudo access. The installation of iOS-Universal-Framework requires sudo to install the templates into the Xcode templates directory. The decision was made to drop the framework design in favor of building an iOS universal static library. Unfortunately this change doesn't come without sacrifice. Instead of integration being a matter of dropping into an iOS project a single framework file that encapsulates all balanced-ios content, users of the pre-built project will need to drop the static library, balanced.a, and the header files into their project. For the sake of attempting to not be more long-winded on the subject, I'll tone down the verbosity of all the trial and error performed. ### New balanced-ios Architecture (Static Library) The decision was made to drop the framework design in favor of building an iOS universal static library. Unfortunately this change doesn't come without sacrifice. Static libraries are a bit different from frameworks. While frameworks encapsulate all project files, including headers, static libraries do not. Users of the pre-built library are required to add the static library, balanced.a, and the header files into their project. #### Add Static Framework Targets Unfortunately a single static framework doesn't want to build correctly for more than the device selected in the scheme chooser. The resulting binary usually reports something like the following, missing the simulator architecture, which makes developing iOS applications difficult: ``` libbalanced.a: Mach-O universal binary with 2 architectures libbalanced.a (for architecture armv7): current ar archive random library libbalanced.a (for architecture cputype (12) cpusubtype (11)): current ar archive random library ``` For the sake of simplicity and clarity, balanced-ios has been set up with two individual Cocoa Touch Static Library targets, balanced-iphonesimulator and balanced-iphoneos. balanced-iphonesimulator is configured as follows: * Architectures - i386 * Build Active Architecture Only - No * Valid Architectues - i386 Self-explanatory here. The simulator uses the i386 arch so it can run on a Mac machine. If you build only the active arch, it's likely to be x86_64, which doesn't end well. balanced-iphoneos is configured as follows: * Architectures - $(ARCHS_STANDARD_32_BIT) * Build Active Architecture Only - No * Valid Architectues - armv7 armv7s Again, self-explanatory. Build for armv7 armv7s and not only the active arch, which is likely to be x86_64. #### Combine Framework Targets Combining the targets into a single universal library proved to be more difficult. This process required a new aggregate target with a run script phase. This is the script to build each of the static library targets into a single static library. ``` shell rm -rf "${PROJECT_DIR}/balanced.a" rm -rf "${PROJECT_DIR}/include" xcodebuild -project Balanced.xcodeproj -scheme balanced-iphonesimulator -sdk iphonesimulator6.1 "ARCHS=i386" "VALID_ARCHS=i386" build > /dev/null xcodebuild -project Balanced.xcodeproj -scheme balanced-iphoneos -sdk iphoneos6.1 "ARCHS=armv6 armv7 armv7s" build > /dev/null lipo -create "${BUILT_PRODUCTS_DIR}/../${CONFIGURATION}-iphonesimulator/libbalanced-iphonesimulator.a" \ "${BUILT_PRODUCTS_DIR}/../${CONFIGURATION}-iphoneos/libbalanced-iphoneos.a" -output \ "${PROJECT_DIR}/balanced.a" cp -R "${BUILT_PRODUCTS_DIR}/../${CONFIGURATION}-iphoneos/include" "${PROJECT_DIR}/include" mv "${PROJECT_DIR}/include/balanced-iphoneos" "${PROJECT_DIR}/include/balanced" ``` The script does the following: * Remove previous build artifacts * Build the balanced-iphonesimulator target with the i386 architecture * Build the balaced-iphoneos target with the armv6, armv7, and armv7s architectures * Use lipo to combine both static frameworks into one universal framework * Move the header includes to the project folder This results in the desired Mach-O universal binary. ``` balanced.a: Mach-O universal binary with 3 architectures balanced.a (for architecture i386): current ar archive random library balanced.a (for architecture armv7): current ar archive random library balanced.a (for architecture cputype (12) cpusubtype (11)): current ar archive random library ``` ### Conclusion While frameworks are a great tool, only static libraries are supported on iOS. Using a custom framework template proved to be a significant barrier for balanced-ios contributors and automated testing. Switching to building a universal static library came at a small cost but overall provided a much better development and testing experience.