Filed under Education

Grit for Programmers

It turns out that the best indicator of success isn’t IQ or natural talent or how well off you were at birth. Rather it’s something called grit – the perseverance and passion for long-term goals. Grit requires a clear goal, self-confidence and a careful balance between stubborness and flexibility. For the last few months I’ve been living one of the most productive (and most challenging) times of my life. I’ve been building a system that has more parts, does more things and is much larger than just about anything I’ve built before. It’s been challenging and rewarding work and I couldn’t have done it without lots of support from great mentors. As I’ve stumbled, fallen down, hit brick walls, picked myself up and kept going I’ve been wondering – does grit apply equally to programmers and success in building good software?

Programming culture is generally synonymous with hard work and long hours — death marches, all-nighters, 80 hour work weeks, we do them all. But we’re talking about grit here, not masochism. Grit isn’t strictly equal to working obscenely hard, long hours. Part of the problem with thinking about grit in relation to programming is defining what success means for a programmer. Is your definition of success simply finding a working solution? Does it mean finding the most efficient solution? Are you successful if you cover every single edge case or is it enough to just take care of the most common ones? Is your program really better if it handles everything you could throw at it or should you handle core uses cases well and fail gracefully on the others? Part of the problem of coming up with a good solution is asking the right question. This is especially true of building software. However merely coming up with the right question requires a certain amount of grit. We need the patience to look beyond the obvious problems and solutions and ask the hard questions.

So now we’ve found the right question and defined bounds on the possible solutions. What next? How does grit help with the actual act of writing code and building stuff? Programming is not easy. It can be fun and exciting and uplifting, but sometimes it is downright hard and depressing. Sometimes we spend hours sifting through possible solutions before hitting upon the appopriate one. Sometimes we spend several intimate hours with a debugger tracking down pointer bugs before finding that one variable we forgot to initialize. Being tenacious and persistent in the face of seemingly unrelenting roadblocks is not an added benefit for a programmer – it is a bare necessity. When it comes down to the act of sitting down, writing and debugging code grit is not optional. Without it not only can we not be good programmers, we can’t even be an average ones.

But if our goal is to be a good (maybe even great) programmer, then grit will continue to help. One of the qualities of good programmers is that they get a lot of stuff done. In particular they do a lot that isn’t strictly their job. This includes fixing and extending their tools and improving core infrastructure. They do this even if they aren’t in charge of infrastructure because they realize that their code depends on what’s underneath. Grit is the difference between waiting for someone else to fix the annoying bug in the library that you depend on and diving in and fixing it ourselves. When Steve Yegge talks about the difference between “superhumanly godlike” and “smart”, grit is a part of what he’s talking about. Not that there’s anything wrong with being smart, but it might not be enough. Of course to cultivate that level of grit we need to cultivate a good deal of courage. Diving into someone else’s code and fixing it can be a daunting task but it’s one that has to be mastered.

While I’ve always liked programming it’s taken me a long time to understand the importance of grit. When you do something because you like it (mostly) it’s tempting to stay away from the parts that are painful and hard. For a long time I avoided writing large programs because I was afraid of all the complexity that was involved. I was afraid of becoming familiar with complex algorithms because I was afraid of the possibility that I’d get it wrong. I understand now that I can’t become a good programmer if I don’t push myself to do the things that I consider hard and dislike. I need to have the grit to handle large complex problems and spend the time to understand and apply advanced algorithms. The good news is that just like perseverance and discipline, grit can be trained and improved. I’m no longer as afraid to dive into unknown codebases as I was a few months ago. I now find it much easier to hold complex code paths in my head. I’m certainly far, far away from being superhuman, but I try to suck a little less every day.

Tagged ,

Create More, Consume Less

I don’t like buying things. It’s not that I don’t have money or that I live beyond my means. As a starving graduate student I make enough to get by and I can generally stay within my income. What I don’t like is accumulating stuff. I have a rather visceral negative reaction whenever I buy things that I will keep around for a long time. This includes essentials (clothes, books) as well as non-essentials (gadgets, artsy things). Part of it is just practicality: the more stuff I have the more I need space to put it all and the more I need to lug around when I move (which happens every year or two). The more important reason is that right now I want to be a creator, not a consumer and buying stuff is opposed to that.

Compared to the energy of creating and making things, consumption almost always feels draining. There is a difference between buying things and consumerism. For better or for worse it’s possible to be a consumer without spending money. Thanks to all the free content around the web I can easily spend hours and days consuming without spending a dime. Netflix, YouTube, Vimeo, Spotify, etc. are all incredible (and seemingly unending) sources of consumable content. I don’t spend any money (or at most very little money), but I do spend a large amount in terms of energy and time. It’s so easy to sit on the couch and just hit the next button. Before I know it, it’s dark outside, the day is gone, I’ve forgotten to get dinner and accomplished pretty much nothing. The problem with this form of empty consumption is that it’s not relaxing or refreshing and it’s definitely not useful. The day just melts away into a sea of unproductiveness.

Television is particularly soul-sucking. It’s almost drug-like in the effectiveness with which it shuts down my brain and makes the rest of the world go away. When I sit on the couch and turn on Netflix I can feel my brain turning off. There’s a fog of semi-consciousness descending on my mind. I’m awake, I can see and touch and feel, but I’ve lost all the will to act or do anything other than hit the next button. After a few minutes it’s more work tearing myself away than hitting “next”. I suppose this is what being a zombie is like. This is my brain on television and in hindsight it’s quite terrifying. Perhaps there’s a reason it’s been called the “idiot box”.

Modern society seems to be predisposed towards consumers. Everyone is a consumer whether or not they want to be. Even the point of creation is to make money to be used for more consumption. I’m not about to make a grand sweeping statement like “consumption is evil”. Personally I think the occasional (even regular) indulgence is fine, maybe even healthy. But for me, consumption as a way of life is depressing. It’s synonymous with days sitting on the couch watching bad television, feeling my brain gradually atrophy a handful of neurons at a time. It’s synonymous with buying a nice shirt and then wearing free t-shirts to class everyday. Even though it might feel good in the moment, it quickly turns to disappointment and regret. Personally, I’ll take the pain of discipline over the pain of disappointment and regret.

Creation is different. Creation should be harder, it should take up more energy, it should leave me feeling trained and tired. And sometimes it does. But even if I feel physically tired, at a deeper level I feel energized. It feels good to know that today I made something. It makes me look forward to getting up tomorrow morning and making it better. It’s good to be able to show something to people, to get their opinions and ideas and then go back and polish. It’s good to know that I can the change the world in some way and maybe, just maybe I can make a bigger difference. Creation is good.

I don’t know why being creative feels good. I’m sure there’s some reward pathway in the brain that gets triggered by designing something, making plans to make it happen and then actually following through on those plans. I would like to believe that what I make helps other people in some way. Even if it doesn’t, I think I’m fine with pursuing creativity for personal reasons. I’m hoping that a life with less random television, fewer RSS feeds and less time glued to Twitter and Facebook will translate to more blog posts, more working code and more meaningful connections with real people. I’m hoping that it’ll also keep away the dreaded feeling of brain decay that a few hours of “entertainment” produces. Even when I do consume, I’d like it to be good books, good music and movies, blog posts that are actually insightful and interesting and not shallow proclamations of half-formed thoughts.

What I consume should be what I aspire to create. I want to create more than I consume.

Generation Flux

A few months ago Fast Company run a multipart piece on “Generation Flux”. The piece had two intertwined themes. The first is the idea that we’re living in age of constant (and perhaps accelerating) change and that to stay competitive businesses and institutes have to ride this wave of change and go with the flow. The second idea is the notion that the most successful people are those who are intimately familiar with this state of flux and can craft their lives to take advantage of it. As part of the piece they profiled several members of Generation Flux – technologists, businesspeople and researchers like danah boyd and DJ Patil.

Though the piece focused on the tech industry and business, I think the basic ideas apply to all fields including (especially?) academia. In fact I think that the best researchers and scientists have always been those who have been spread out over a number of areas. While focus and diligence are necessary for productive research, I’m starting to think that it’s important (if not fundamental) to have a wider halo of interests and knowledge surrounding your core area.

As a new graduate student this is a question of great personal interest: I have a limited amount of time and energy in grad school (and later) and it’s in my best interest to make the most of it. As with many important things there’s a dilemma: if I spend too much time and effort on one thing I’ll miss out on everything else and that can be very limiting. I already know this first hand: I know a good amount about programming languages, but I’ve been scrambling to teach myself about networks and know next to nothing about AI. But on the other hand if I don’t dig deep enough into one relatively narrow area I’ll never have the knowledge or the insight to know what the important problems and come up with appropriate solutions.

So what are the lessons of Generation Flux and how do they apply? Accepting and adapting to change is definitely a big part of it. As danah boyd tells us: “We all have to learn new skills. Being able to live on one set of skills over a career is not realistic. Change is going to happen, not all of it good, in serious ways.” But simply being able to ride the wave is not enough. And it’s certainly not advisable to jump ship to the next shiny thing at the first sign of trouble. DJ Patil has more personal advice to offer: “At the end of the day, you have two things: your energy and your intellectual curiosity. If you’re willing to apply them, try to add value to the world, the possibilities are so endless.”

Patil, boyd and the other Gen Fluxers seem to be able to strike a balance between change and constancy. In times of perpetual change the key to success seems to lie in two complementary values: first is the ability to live on the edge of chaos and move fluidly from one spot to another. But second (and just as important) seems to be the ability to be tenacious, diligent and sometimes downright stubborn. Patil for example taught himself mathematics and worked midnight to morning to get computer access. While he’s worked on amazing projects he’s also turned down lucrative offers because they didn’t fit his vision of what he wanted to do.

Viewed through the lense of graduate school the lessons become: Explore broadly and lightly across areas related to what you’re interested and then buckle down, dive deep and keep going until you get to something novel. Of course the timing is critical and to some extent they have to happen in parallel. As Matt Might puts it: going rogue too early or too late can be fatal. Luckily that’s what advisors, mentors and colleagues are for.

Personally I’m still in stage 1: I’m still taking classes and exploring the broad regions of computer science but I’m also making forays deep into some areas (particularly programming languages and datacenter networks). Looking further ahead I think it’s great that we’re going to be living in a time where being a member of Gen Flux is a good thing. Gen Flux is perhaps just a modern term for Renaissance Men (or Women) – people with a breadth of knowledge and skills but also with singular and far-reaching accomplishments in some of those fields. And that seems like a goal worthy of a lifetime worth of time and energy.

Sunday Selection 2012-03-11

Happy Daylight Savings Time Day everyone! (Or something like that)

Around the Web

Are you a Zen coder or a distraction junkie? It’s been a while since I’ve worked on a project where “my code’s been compiling” has been a valid excuse for not working. But now that I am on such a project, it’s important that those mini-breaks don’t turn into longer breaks.

Successful people are successful Einstein is rumored to have said that compound interest is the most powerful force in the Universe. Whether or not he actually said that, compound interest is still pretty powerful. Maybe it applies to reputation and achievement just as much as it applies to money.

The power of diligence in creating a remarkable life Keeping one’s options open seems to be a pretty common strategy but it could be the wrong one. Perhaps it’s a better idea to pick an area and dive deep rather than to spread your bets.

Videos

On being an introvert Everyone seems to be busy building the next social thing to help us “connect” better to everyone else. But a lot of the best work requires solitude and independence. Introversion might be a hidden superpower. (There’s a written synopsis, but the video is well worth the 18 minutes of your time.)

Etudes for programming

From Wikipedia:

An étude (a French word meaning study, French pronunciation: [eˈtyd], English pronunciation: / ˈeɪtjuːd /) is an instrumental musical composition, most commonly of considerable difficulty, usually designed to provide practice material for perfecting a particular technical skill.

I noticed today that Michael Fogus (one of the authors of Joy of Clojure) has a number of Github repos with names such as etude-ocaml and etude-syntax. I also realized this week that I’m a pretty slow programmer. I’ve been getting better over the years but I’m still slow, especially if there’s a good amount of API design involved. While I think that writing lots of code will make me faster over time, I do wish there was a more structured, focused approach.

In general, I wish there was more by the way of études for programming — problems and exercises of considerable difficulty designed to provide practice material for a particular (set of) skills. There are of course great textbooks for programming and computer science and those books have good exercises (I particularly like SICP and the K&R C book), however in most of those cases the point is to teach first and practice second. What I’d like to see is the reverse – assume that the reader already knows about functional programming or the C language but needs to “level up”, so to speak. The exercises would be harder and more in number but would also cover a broad area in terms of application of the concepts involved.

This is related to what I’ve written earlier in terms of deliberate practice for programmers. That post talks about “level up” lists – a list of programs to make that help explore the different areas of computer science and help you gain experience and hence “level up” as a developer. On the other hand études would focus on depth rather than breadth – each one would focus on a small technique or technology and fully explore that area. Together a continuous habit of working on études and doing level-up projects would give programmers a steady stream of deliberate practice exercises to work on.

The question is, where are we to find these études? I’m not sure if there are programming books out there that fit that description. If there are, I’d love to here about them. But in the meantime I’ve found an acceptable alternative — homework and assignments for college level courses. This semester I’m the TA for a course on functional programming and throughout the semester we have a set of 6 assignments for students to do. Each of them have about 3 to 4 problems (each with multiple parts) that tackle a small area of functional programming. I think exercises like this are great material for études. I’m currently working through the exercises at the same time as the students (other TAs are making them). Even though I’m already familiar with most of the material it’s been a good learning and great practice for me. I can’t really measure if I’m improving (apart from running my solutions through the test harness) but it’s more direct and practice in functional programming that I’ve ever had.

I’ll be done with this particular étude in a few months. I don’t think I’ll be releasing the code since the problems often get reused. However I do think there will be lot more where those came from. There are lots of college courses with website out there and there’s lots to learn. I’ll probably try compilers next. All that being said, it would be great to see some curation and collection. With Amazon’s Kindle Shorts and the growing interest in short, self-published books putting together a regular series of études might be a pretty lucrative endeavor.

Tagged ,
Follow

Get every new post delivered to your Inbox.

Join 338 other followers