Monday, July 29, 2013

Invisible Art

The other day in the office I was speaking with an engineering candidate for his final round interview. We were looking at some code and I was explaining our architecture. Later on Hemakshi remarked to me, "You were so excited to talk about code!". I didn't realize it at the time, but I really was. Since I'm the only engineer on the team, I rarely get to do it, nor does the team hear me talk about it. But once we got into the discussion and the guy showed interest and asked good questions, it was really fun and engaging to talk about this body of work I have been chipping away at for the better part of the last four years.

I take a lot of pride in writing code. I'm not an elite software developer, but I try very hard to write clean, maintainable, intuitive, well-documented code. Only after Hemakshi made her comment did I realize that all of that writing will largely go unobserved by the rest of the world.

Software developers spend countless hours on a craft largely invisible to a viewing audience. The outward manifestation is certainly visible as end-user software, but the code will pretty much never be seen. The only chance for significant amounts of your code to be seen/scrutinized/admired is if you are a core developer on a popular open source project. And even then it's only other hackers. Otherwise for all to rest of us slogging it out in our little corners of github, no one cares. Maybe you can organize a party with your college buddies where you take turns projecting up some stuff you've been hacking on for work. But who would ever do that? And besides, it would mostly be illegal. Jo can't show me his Pixar code, if he did I'd later have to be shot.

But to me programming is art; at the very least it is creative self-expression. It's sad that a genre of art that so many people pour themselves into isn't shared/shareable. Out of fear that I will die without ever getting a chance to talk about my code to a general audience, here we go:

This is a part of our software's data model definition. Our data model has been really successful; it's stood the test of time quite well. There is one major mistake I made in it early on (created two different models for a user at a time when I didn't know you can cross-reference models from different Django applications) and few deprecated fields, but all-in-all a very neat and flexible data model. 

Not only am I proud of what the code does, but I'm proud of how it's written and commented. I've not worked much on large software teams, so I don't have a sense for what is good commenting, but I try to comment as much as possible, especially in the last year or so as I realized other folks will soon be working on it.

I would love for there to be an art exhibit on people's code. The MoMa should have an installation where people put up beautiful codes on the walls. I would totally go and marvel at different hacks in different languages. The exhibit should include a snippet from Nipun's ServiceSpace code, who has spent over a decade developing a multi-100K lines codebase mostly as a one-man engineering team. From the little I've worked on it, I can say it is tremendous, and the same attention to detail he puts into everything he does shows up in his code.

I imagine the MoMa Code exhibit would have the ribbon cut by Knuth, although my personal choice would be RMS since he's the Rick Rubin of software.

Wednesday, July 24, 2013

Wednesday, July 10, 2013

Driving License

I recently got an Indian driver's license. People here call it a driving license. Getting my license took many steps and much time, combining hilarity and insanity.

The process of getting an Indian driver's license can be summarized as a big charade. A license is an official government document, so there has to be real process with a real institution behind it. But as I learned, that process is highly bendable and even breakable. What was even more stunning was how hard it was to not bend the process. In other words, going through the process by the book required going out of your way to such an extent that it made attempting it highly unusual and/or insane.

How do I know this? It just so happened that my friend Shital was attempting to get her license at the same time I was. Shital is from the U.S., so we faced similar technical difficulties in getting a license. My approach to address the difficulties was to work through an agent, who provided you instruction on how to drive as well as steer you through the process of obtaining the license with the RTO (India's DMV). Basically, an agent is a middle man who has special relationships with the right people at the RTO to get your license in a frictionless way. Agents are not illegal; in fact the RTO pretty much endorses them. Shital decided to try without an agent. She rightly argued that using an agent is participation in a corrupted system, and the system will not change unless people resist it. More on how that turned out later.

My agent was named Bablubhai. He has a driving school (code for agency) on Ashram Road. Bablu was recommended by my rickshaw driver Narendra. My main criteria for an agent were dependability, quality of instruction, and cost. Bablubhai said he would get me my license without any trouble or delay. He gives the best instructions in town; students from one of the competing agencies nearby even come to him for lessons after failing to properly learn the first time. The other agencies teach in crappy cars, he gives lessons in a  higher-end Honda Brio. He seemed professional and confident.

Bablubhai's driving lessons consisted of 15 sessions of 30 minutes each. My instructor was Bablubhai's 20-something employee Chirag. Chirag and I would meet in front of the driving school, hop in the Brio, and go meandering around the area, driving in normal traffic so I could get a feel for it. Lot of the complexity in learning was taken away because I knew how to drive stick-shift; I could just focus on learning the ways of Indian traffic.

Much has been made about the chaos of Indian traffic, how there are no lanes and people honk lustily while avoiding cows and carts and cycles. How bigger has right of way over smaller, the exact opposite of America. How there is no "letting someone pass" or regard for traffic rules, and the culture is dog-eat-dog. All of this turns out to be true. In fact, my instructor Chirag would remind me of this constantly. He knew I came from a place where there was order and respect for rules. His catchphrase was "Kai 'rules and regulations' nathi" ("There are no rules and regulations").

I got the hang of the roads relatively quickly. Overall, I learned two main tricks for driving effectively and safely in India. The first is to drive slow. There is so much stuff happening around you. If you're driving fast, you may not be able to process everything in time and so your chances of mishap increase. The easiest way around that is to just drive slow. No one will honk at you for it, they will just maneuver around you and keep moving. The second trick I learned was to not look at any rear view mirrors. If you start looking around, you will freak out because there's all kinds of shit happening. It's better to keep a narrow focus and drive straight. If you mind yourself and don't make any sudden movements, everyone else around you will basically do the same thing and you will all get through it.

In Indian driving, there are no mistakes. People aren't going to get upset when you linger after a light has turned green or you brake suddenly. There's so much chaos that anything "wrong" you do at the individual level just blends in with the rest of the chaos. It's all part of the game, and there are no mistakes.

One of the most important and non-intuitive things to realize about driving in India is that knowing how to drive is a totally different matter from getting a license. In the U.S., the system is that having a license proves you know how to drive. In other words, the system is set up so you can't get a license unless you know how to drive. That's not how it works in India. In India, it is possible to get a license without never having driven, let alone being comfortable on the road. In fact, many people get a license, and after that seek out lessons to learn how to drive. This ridiculous situation is borne out of the fact (or perhaps reflects it) that the RTO is corrupt and fundamentally broken.

A few lessons into my learning I scheduled a time with Bablubhai to go to the RTO and get my kaachhu license (learner's permit).

The RTO in Ahmedabad is a deceptively huge building on aptly named RTO Circle near Ranip. Inside, it is a damp dingy labyrinth. As I walked through the various dark corridors looking for Bablubhai, I glanced into room after room full of dreary gray shelves to the ceiling full of old stained papers and documents. Around these shelves sat agents relentlessly doing paperwork.  Stacks of papers all around them, not a single computer in sight. I met Bablu, who led me hastily through this and that corridor. Bablubhai is a little man who moves like a torpedo missile. I had trouble keeping up with him. As he walked he would engage people he knew with a warm smile and how-do-you-do chit-chat. He talked a mile a minute. It occurred to me that Bablubhai's job was predicated on maintaining as many good relationships with as many people in the RTO as possible. We eventually entered one of the stacked rooms and parked in front of a fat man doing paperwork. Before we went to him, Bablu had advised me to not speak unless spoken to, and to let him do all the talking. My case was a bit sensitive because I was a US citizen and so didn't have any local ID. But with some sweet talking Bablu got a signed paper through that let me take the test for a learning license.

A few days earlier, Bablubhai had given me a book to study for the multiple choice test. I would have to answer 11 of 15 questions correctly about traffic rules and regulations. Instead of giving me a book of rules, though, Bablubhai gave me a book of all the questions (with answers) that would be asked on the test. If I just memorized all those questions, there would be no problem passing.

And of course he was right. I got called into the test room with a group of others. The room had computers in cubicles against all four walls. We sat at the cubicles and took the exam. I sat down and got question after question, each of which I recognized. I didn't have to even finish reading the question or read all the answers; I had memorized the location of the right answer. It took me 3 minutes to answer the first eleven questions I saw correctly. I went outside and around the corner, where I collected a crudely laminated black-and-white postcard sized printout of my photo and some identification details. I had my learner's permit!

I had 15 guaranteed 30-minute lessons with Chirag, but ended up only going through 13 because I had gotten the hang of it and a month had elapsed since I got my learner's permit, so I was eligible to go for my paaku license (official license). So on a Wednesday I showed up at 8:30 sharp as per Bablu's instructions to the RTO to take my road test.

I walked into the RTO's big dirt parking lot and found a buzz of activity. There were clusters of people, maybe 100 total, around 5-6 parked cars that belonged to a number of agencies around town. I found Bablu's cluster, he was busily filling out forms for all of his students who had shown up for the test. I tapped him on the shoulder; the look he gave me indicated he'd forgotten he had asked me to come. He pulled out a fresh form and scribbled my details on it. He asked if I knew how to drive a two-wheeler (motorcycle/scooter). I panicked; why the hell was he asking me that? Is it a part of my driving test? I was thrown off because he should know the answer, he was the one giving me driving lessons. I told him no, and he hung his head for a second. Then he said, "Don't worry, I'll handle that part of the test for you, just stand where I tell you to stand." As he scampered away I caught him and told him I wanted to do the test the "right" way; I didn't want any special treatment. This was a promise I had made to Shital, who inspired me by not giving into the corrupt agent system. He brushed me off. Sure sure, you will be taking the same test as everyone else.

As I stood around waiting for Bablu or someone else to tell me what to do, I noticed that some people were there for a car license, others for a two-wheeler license. The two-wheeler tests began first. Bablu stood next to an RTO agent, handing him a form from his stack to test each of his students one at a time. The two-wheeler test was ridiculous. You had to drive a motorcycle in a small figure eight in front of the RTO agent. That was it. It took no more than 20 seconds. Some people couldn't even do the figure eight, one lady could only take the cycle straight and couldn't turn. She drove into a crowd of people, braked just in time, got off the bike, and walked it back to the instructor. I think she passed. At one point Bablubhai handed the agent a form and then got on the scooter himself and did a sad stunted go-through-the-motions figure eight. I was pretty sure he was taking the two-wheeler test on my behalf.

The car test was just as absurd. I was able to go first out of Bablu's students since I was the NRI. We formed a line next to Bablu's car and a path was cleared 100 meters long ahead. The test was to drive in a straight line for those 100 meters. I got into the car with an RTO instructor in the passenger seat and another in the back. The one in the back sat with the stack of forms and handed the front agent one at a time to administer the test. I got in and buckled my seat belt, and waited. The agent, with no preamble, told me to turn on the car and drive forward. I did that, but worked slowly to not mess anything up. He was in a bigger rush, so he kept urging me to speed up. I started driving forward gingerly, making sure that I don't stall out the car. The agent said, "Go go!". The car had the two sets of driving pedals since it was an instructional vehicle. The agent put his own foot to his pedal and carried us to the finish line. I asked him if I should reverse back; I had noticed from other tests going on that people went forward and back. "No, that is all. Please sign this paper, you are finished." I signed and got out of the car. I wasn't even sure if I had passed, the agent didn't indicate one way or the other. I walked over to Bablubhai and asked him if that was it. Did I pass? He replied, "Well, did you sign the form? You can go home now."

Three weeks later, I got my license in the mail. It felt triumphant, and I was proud. On the other hand I looked back at the process and it felt like a big joke. Any fool can get a license, you don't even need to know how to drive. I used low-level corruption, and even worse it seemed like it was the only way to do things. Poor Shital is still in the process of getting her kaachu license; the first time she went to the RTO, they refused to let her take the computer test because she didn't have a document proving she had a residence in Ahmedabad (even though she did). They said her rental agreement was invalid because it wasn't notarized. Unfortunately she couldn't get it notarized because her landlord was in the U.S.. She argued with a number of people until she made it to a hidden room in the RTO where the head man sat. He was sympathetic to her cause, but one of the lower-level ladies refused to let her go on a small technicality. Later Shital returned to the RTO with notarized documents, only to be refused by the RTO worker because the date of notarization wasn't within the required timeframe.

On the other end of the spectrum, another American friend of mine (who will remain anonymous) walked into the RTO and out with his official license in hand in a single day. His process even bypassed the agent. Without taking a single lesson, without taking the computer test, without even waiting for the license in the mail, this friend knew and paid off the right people in the RTO and completed the entire process (which took me two months, and has taken Shital 5 months and counting) in a few hours.

Getting official documentation to drive in India is just like driving in India. It seems broken and arbitrary, but in spite of itself it continues to work.

Monday, July 1, 2013

Manav Sadhna football program

Editor's Note: I wrote this a few months ago for Manav Sadhna's 2013 annual report. A shorter version may make it in there, but wanted to share the full version, which captures the program and children's stories nicely.


The MS football program began as a humble, informal practice organized by some football-loving volunteers with a small handful of children. Two years later, it has become a full-fledged program within Manav Sadhna. Many of the children have been a regular part of the program for over a year, with a deep commitment and a genuine passion for the game.

There are currently roughly 31 children in the program. They range in age from 8-16 years. The main activity of the program is a weekly practice on Sunday morning at Manav Sadhna. This practice has been happening regularly for over a year. The children warm up, stretch, work ball drills, play small sided games, and usually end with a match splitting all the children into two teams. Practice ends with a brief coaching session and nutritious snack.

As the children have improved their skills, they have also participated in city tournaments and other more competitive programs.

Going forward, we aim to provide the football program with a dedicated ground with enough space to practice all aspects of the game without disturbance. The children will also be given more chances to play in larger and more competitive venues. Finally, we will look to increase the number of children in the program, including younger children as well as girls.

Every Sunday morning, 15-35 children come for the main football practice. Another 4 children attend Sunday practice irregularly and/or have just started coming regularly.
The children come from various neighborhoods of Ahmedabad: Powerhouse, Jamalpur, Wadaj (Ramapir no Tekro), Ashramshalla (Manav Sadhna). Several of the children come from Jamalpur, a slum area on the opposite side of the city. To make the 7am practice, the children wake up at 5am, board a bus by 6am, and arrive at the Gandhi Ashram by 7am. It is the children’s commitment and passion for the game that drives them to wake up early on a Sunday morning to come and play.

Practice typically lasts for 3 hours. After a warm-up run and stretching, the children work on ball skills and passing through drills organized by the coaches. The emphasis is on ball control and teamwork. The children are then led into small-sided games and keep-away. Key aspects of the game, such as shooting and set pieces, are also practiced. Finally, all of the children are split up and play one large match.

Once a month, practice is shortened and a filmed professional match is screened for the children inside Manav Sadhna. Having little exposure to top-class football, these film sessions are critical to helping build the children’s model of how the game can and should be played.
At the end, the practice is recapped and the children get an opportunity to share about what they liked and didn’t about the practice, and how to improve. The coaches offer some guidance, and then a snack consisting of fruits and biscuits is served.

Outside of Sunday practice, the children informally (but regularly) practice on their own. Scrounging for balls around their neighborhoods (all of the program’s equipment is kept in a locker at MS), they find and patch old discarded balls and play. Committed to improving their skills, they organize themselves into drills they learn on Sundays, in addition to fun matches.

The Manav Sadhna football program is coordinated by Rahul and Neil. Rahul is a staff member at MS and also runs arts programs for the children. Since a young age, Rahul has had a deep passion for sports, especially football. However, as a child he was never given the opportunity to play. Now, as a coach, he plays through the children. His dream is to have a player compete at the Olympic level. Rahul is the backbone of the football program. He rides his bicycle from several kilometers outside Ahmedabad every day to work at MS. Whether it’s a weekend or holiday, you can always count on Rahulbhai to be there to help and put in effort with the utmost sincerity and care. He shows tough love with the football team, being strict when they make mistakes but being generous with praise when they show well. Neil is a volunteer from the US who grew up around the game of soccer. He is thrilled to have the game in his life through this program, and is committed to seeing it reach and benefit any child at MS who is passionate about the sport.

In March 2012, the MS football program connected with Kahaani Football Academy, the premier children’s football club in Ahmedabad. Kahaani’s director, Manisha Shah, has been a huge supporter of the MS program. She offered Kahaani’s large grass sports ground to MS for Sunday practice. This is a hugely valuable opportunity for the children, who normally play on confined dirt patches in the Gandhi Ashram. However, travelling to the grounds has been a challenge, with so many children to manage safely. When available, the players and coaches take MS’ Khushi bus to Kahaani for practices.

Tournaments and Exhibitions
Kahaani has also graciously included MS players in football tournaments that they regularly organized. In January, 6 players from MS (U-13) participated in the tournament. They played two matches on mixed teams with Kahaani players, playing against others from all over Ahmedabad. It was a great opportunity for the children to taste competition with players beyond their own teammates.

In March, Manav Sadhna organized an exhibition match at Abhay Ghat. All of the children participated, split up into two teams. The field was chalked out and goals with posts and crossbars were erected. Teachers, family members, and fellow MS students filled the sidelines and cheered both teams on with flags prepared by the coaches. The match was a rousing success, with high-quality play from all the players.

All of the children in the program have soccer equipment (1 pair shoes, 1 pair shin guards, 1 pair long socks, 1-2 shorts, 1-2 jerseys) that they keep and maintain themselves.

A significant amount of the equipment have come via donation from people around the world.
The initial donation came from Football Action in the UK, which sent balls, jerseys, cones and other equipment that was critical for the program to launch.

However, shoes were still in short supply. Later, an individual walking through the Ashram spotted the children playing barefoot, was moved, and spontaneously wrote a cheque to cover shoes for the first batch of players in the program:

Later, Andria Caruso, a volunteer from Michigan, was inspired to organize a clothing drive for the children. She ended up collecting over four large boxes of donated shorts, jerseys, shoes, socks, sweats, and jackets:

As the children play on harsh conditions, shoes and balls get worn down relatively quickly. Manav Sadhna has stepped in to keep the supply of these two critical equipments in supply for the children. In addition, Manav Sadhna has procured a first aid kit and has covered the costs of the snacks since the program began.

Program Successes
The most compelling indicator that the children find value in the program is their sincere dedication to practice and playing the game. Despite the difficulties of travel, playing on dirt fields with dust flying, being constrained by the lack of area, the children play on with no complaints. They attend practices very regularly, only missing them when they must study for important exams.

One shining example is Dasarath, a player from Jamalpur. Dasarath comes from a very challenged family background. To earn for himself, he works as a sweeper and rag picker. This work requires him to wake up early in the morning daily to do sweeping before he gets ready for school.

Dasarath is crazy for football. On Sundays, he still has to do his work. So he wakes up at 2am and works until 4am. He comes back home, gets ready, and goes around the neighborhood waking up and gathering the other children. He then leads them on a run for several kilometers to the main bus stand at Paldi, where they catch a bus the rest of the way to make practice on time.

The children have improved their skills as football players significantly since they began. Starting from scratch, the children could not dribble or pass, let alone understand spacing and movement. Since then, the children play with skill, combining discipline and creativity. They diligently work in drills as well as play matches. They listen to the coaches and take their advice seriously. They have truly become students of the game. During film sessions, the children used to grow impatient, only wanting the see the goals. Now, they patiently absorb full 90-minute matches, appreciating the subtleties of build-up, defensive positioning, spacing and movement, and set pieces. They model their style of play after FC Barcelona, using quick and precise passing to break down their opponent.

Robin, one of the program’s more talented players, was invited by Kahaani to join their academy. Our vision is to send one child from the MS football program to the Indian National Football Team.

Team sports certainly imparts many valuable life skills. These children have markedly improved in their teamwork, cooperation, patience, and communication during practices. They have become proud and self-confident as athletes and young people

Looking Ahead
The future is bright for the Manav Sadhna football program. With the successful development of our first group of children into formidable team players, MS will look to expand and improve the program in a few key areas:
  • Expose the children to more competitive playing opportunities. Enrolling them in camps, tournaments, and academies that let them grow their passion and skills for the game. This will require financial and human resources for coordinating participation and entrance fees.
  • Construct a dedicated grass field for the children to train and play matches. With limited space in the Ashramshalla, the children cannot fully develop their skills. They need a large dedicated practice field. Ideally it should be grass, since the dirt fields lead to the children breathing in large amounts of dust as they play. Manav Sadhna has identified a field and cleared some debris, but more funds are required to finish the project
  • Improve the nutrition of the children. They are served a snack after Sunday practice, but they require regular nutritious meals to keep their strength and grow at healthy level.
  • In the harsh conditions that they play in, the children require regularly replaced equipment including balls, shoes, socks, jerseys and shorts.

A blog provides regular updates about the football program, with videos and pictures: