Pages

Wednesday, July 17, 2013

Daily Routine of a 4 Hour Programmer

Everyone knows the routine, get to work by 9 AM, sit in front of the computer, code all day, and head home at 5. Now, thanks to guys like Tim Ferris I have started to re-think how I work and what makes me productive as a software developer.
Recently, I made some big changes to my Monday to Friday schedule. For a long time, I did things just like all of the other coders I know. But during the second half of 2011, I started experimenting to see what type of daily schedule makes me most productive. This is still a work in progress, and I do not work on military precision - I may get up 20 minutes earlier or later, for example - but here is my current schedule:
4.30 AM to 7 AM: Meditation, Writing, Goal Review Family Breakfast

Getting up at 4.30 AM is actually not that hard. Everyone is a bit different, but the body generally needs 7 to 9 hours of sleep. The way to know if you are getting enough sleep is to wake up without an alarm. Just go to bed early enough and you can wake up at 4.30 AM also.
Immediately after getting up, I drink 16 oz of water—no coffee! I have not had a coffee in a long time, and I don’t miss it much. In fact, I feel better without it. Then I take a shower; I want to start the day fresh.
I meditate for 30 minutes every morning. It’s best to meditate just before or during sunrise, so any time before 6 AM for people in the western world. I am not going to explain why meditation is good for you; there is plenty of research on the net. If you want a good book on meditation I recommend Meditation for Dummies. Despite its name, it’s one of the best books I have read.
After that, I spend 30-45 minutes writing content for my blog. I will try to write between 500 and 800 words. I have found that I can pull it off if I do this task very well right after meditation. Plus, the brain works all night while we sleep, so its best is to do a brain dump before moving on to other mental tasks. A tip on writing: use this time for an initial brain dump. Don’t try to do research, editing, etc. until later.
Then it’s To Do List time. I check my emails, Twitter, LinkedIn, etc., and assign tasks. Speaking of tasks, I follow the GTD Method and orient my life around Omnifocussoftware. I run this on my iPad, iPhone, and MacBook Air (ok, so I am an Apple fan boy). Yes, Omnifocus is a bit expensive for a to-do list management software, but since my entire life revolves around it, it’s worth the price.  I go through my list and compare it against my goals - everything from small objectives for today to long-term goals. Every item on the list should relate to a goal. If it doesn’t, I remove it.
Breakfast is next. There are several schools of thought on when you should have breakfast and what you should eat. I have experimented with lots of different things. I find that something fiber rich, low carb, and high protein works best for me. Ever tried oatmeal with peanut butter? Perfect! I also like to include fresh fruit and tea. Also, we try to have breakfast as a family. Sometimes we make it work, and sometimes not. My goal is to get this 100% this year.
7 AM to 11 AM: My 4 hour Programmer Time
This is the time that I use for coding. 4 hours a day may seem ridiculously small, but I have found that I can get more coding done in these 4 hours than most people can do in a week.  Research has shown that people who have a consistent timetable deliver better than people with a random work schedule. For me, it’s 7 to 11 AM, every day. All I do is coding during this time, nothing else. There are a few ground rules:
First, turn off all communications - phone, email, chat etc. You should have no distractions. You can give a handful of people a way to reach you if something is really urgent. The people who might have a reason to contact me in an emergency know how to do it, and I have yet to have anyone use it. I have even trained my wife, who used to expect immediate answers to every question, to respect this 4 hour block. also you should work on a single project. Don’t try to work on 5 different things.
Second, Don’t take any breaks for e-mail, surfing on the net, or anything like it. Here’s why: In an hour’s time, I can get x number of functions coded. I have found that if I work for four continuous hours, I can deliver not just 4 times but 8 to 16 times that amount of work. You will experience this when you 100% focused on one objective and not thinking about anything else. This is what we call the Flow mental state. I plan to write more about the state of Flow in a future blog entry.
So why not apply the same principle to an 8 hour work day? Because there are limits on human productivity. The brain is just like a muscle. Can you continuously run on a treadmill for eight hours? Like our muscles, the brain needs occasional rest. The limit is a bit different for each individual. Through trial and error I have found that 4 hours is my max.
It is also worth mentioning that I don’t set an alarm for an 11 am stop. I finish work when I feel my brain is getting tired and my productivity is decreasing. Some days I work for 3 hours and some I work for 5 hours; 4 is the average.
I work from home to avoid disturbances. If you are based in an office environment, see if management will allow you to work from home during your most productive time. The daily commute to the office can undo the benefits of yoga and meditation. After you drive through traffic and hit all of that office noise, your brain may be so stressed that the benefits of meditation disappear. You will probably be more productive working from home.

11 AM to 1 PM: Gym, Lunch, and Shopping
I hit the gym every day. John J. Ratey’s book Spark: The Revolutionary New Science of Exercise and the Brain make a good argument for daily exercise so if you want the science behind why brain functions improve when you exercise read this book.  Don’t try to do the same work out or even go to the same gym every day. I do yoga 3 days a week at a yoga studio, and spinning classes 2 days at a spinning studio and  I do weights 2 days at my gym, where I have a trainer. Having some someone to push me is the best motivation so this is where a trainer helps you a lot.

I love the gym because of the extra services. You can take 5 towels with no wife around to complain. You can take a 30 minute shower with no one waiting outside the door and shouting “Are you done yet?”… Which happens a lot at my home.

I also make a point of shopping for groceries every day, usually at the Whole Foodswhich is walking distance from my house. Why shop every day? In many countries, especially throughout Asia, people shop for groceries every day instead of buying two weeks’ worth of stuff to store in the freezer and the fridge. This way, you buy only what you need and cut back on waste. How many times have you found some something unidentifiable in the back of your fridge or freezer and wondered if it was more than six months old? I grab lunch while I’m out. Whole Foods has a nice salad bar. Since I love Japanese food, I will sometimes hit my favorite joint for some sushi or a bento box.
1 PM to 6 PM: Learning and Talking Time
I try to stack my appointments so I do not have to drive to work every day. Usually, this time involves meetings, interviewing candidates, presentations, mentoring developers, code reviews etc. I do not do any coding during this time unless there are an urgent bug fixes or fires to put out.
I also dedicate significant time to learning. I spend a lot of time reading other people’s stuff, everything from books to blogs to code base related to technology and neurosciences  I try to learn something new every day. The best way to stay motivated and on track is to write few lines of notes on each subject and then bookmark any references. Software like EverNote it is good for that.
Also look at what other products are on the market, the most productive software developer is someone who writes zero lines of code to solve a problem. I do not want to reinvent the wheel if someone else has done the work. This is where spending time on CodePlex, GitHub and Component Source helps.
I have taken a lesson from my wife’s experience during her medical internship. Every morning the new doctors spend time with patients. Then, in the afternoon, they all gather to discuss the complications they encountered and how they solved problems.  In my case I try to conduct a post-mortem on my activities. I examine where I got stuck when I was coding in the morning, where I was chasing a bug or how I did a presentation, handled a meeting  and so on. I try to learn from my mistakes and avoid repeating them.
6 PM to 8.00 PM:  Family Time
My wife is a doctor and has a busy schedule but we do our best to spend this time as a family. We try to make dinner together. Then I work with my kid on his homework. (It’s amazing the amount of homework a 2nd grader gets, but that’s a blog topic for later.)
8.00 PM to 8.30: Reflection and Brain Work
I do not meditate in the evening. Instead, I sit down and reflect on the whole day. It’s amazing how much you learn and improve if you spend 15 minutes just sitting in a quiet place and reflecting on your day.
Next I create some work for my brain. It’s a well-known fact that the brain works as we sleep. So it’s best to assign it some work. For me, the following has been working well: I make a bulleted list of the things I need to write in the morning. I think of them like tags. I find it best to write it down instead of typing on the computer.
Alternately, I look at some programming / algorithmic issues. Again, I write or sketch it down. It’s amazing how often I end up with a solution the next morning!  For these tasks I keep a nice, unlined, letter-size notebook. Something about writing on a blank sheet of white paper makes me more creative. I hit the bed between 8.30 PM to 9 PM. The earlier the better.
So that’s my daily schedule. It changes when I travel, of course; I spend a lot of time on the road for work. I have also not covered what I do on the weekends.  But we’ll get to those things in future posts.
I would love to hear from others on what type of schedule they keep and what they find productive.
Jan-11 Edit : It looks like I am not the only one who gets up at 4.30 AM. 23 Successful People Who Wake Up Really Early

What demotivates me the most as a developer?


I have been developing software over the last 20 years. In this time I faced several things that de-motivated me from my work.  In addition, I passed on that same non motivation to fellow software developers. In my experience, a properly motivated developer can be exponentially more productive than one who has lost their motivation.  I have made a point to keep a list of the things that leads to such a state in an effort to combat it. Today I am writing about the worst of worst.

Matt Wullenweg,  the founder of Wordpress , summed up the aesthetic of coding when he wrote:  “Code is poetry.”    There is something so simplistic in this line.  It has the eerie, erotic fist-punch of a haiku poem satori Certainly there is a rhyme and meter to what we do.  Certainly code doesn't read like a novel.   Topographically, a page of code has the look of a poem.  For the unitiated a page of code looks like carefully constructed chaos, while for the initiated, a page of good code could read like verse from Wordsworth.


There is a beauty and subtlety which forms images and converts ideas from these multiple lines onto the pixelated screen for users across the world.   In fact, never has there been a poetry so widely read across an audience with no regard for race, creed, color education, social class or religion.  A good coder is truly a universal artist.  So why then is there so little value in what we do?   Why is there so little value in code itself?

When we write code for a client they only see the tip of that iceberg, the ten percent that sits above the water.  These are those little pixels that flash bright and click open windows and drop down menus.  What they don't see is the 90% below the surface, the code that we as architects call our labor.  In reality a client only sees two things:  A. that the code base is operational and B.  That it is cost effective.

Now I have been working as a lead architect & developer on a product for a client for over a year.    Never was I given any concrete requirements.  I was only given a general idea from the client who spoke something like: “we want an e-commerce site.” (It's not an e-commenrce site, but to protect the innocent let's call it that) With such general guidelines I have been developing a version of what I envisioned the client asking for.  Hey, at the end of the day I'm getting paid for what I love and I love working with new tech and ideas and most importantly I wanted to deliver something cutting edge.  

And as it's now years end and I'm cleaning house a bit, I decided to clean up the code base by removing code we're not using any more.  To my surprise I erased almost 90% of the code related to the business logic of the application.  I'm the first to agree that a business in constant state of flux has changing business needs.  The software must be kept fluid so the client can stay competitive.   But in this case the software never had been live.   Never was there user testing, just a guess by product designers on what the market may need or what would make the site look cool.  

And of course as the client could say, based upon the amount of code in the finished product:  “Wow, I essentially paid you nine times more than this site is worth.  Never could the client have known of all the work that led up to what is there now.  They only see the finished product and the bottom line: A. that it's cost effective and B. that it works.

But as I sat in my client’s office last Friday night, I kept thinking about this code that had been erased.  I, for one take great pride in my work.  I'm not just a hack getting paid for a job.  I love what I do.  Personally, I akin writing code to painting.  Each line of code, even every little keystroke that becomes a character is something that I have created.  I still get teased by other developer friends when I am trying to get all the curly brackets to match their indentions or try to name variables in a meaningful way. Maybe it's my OCD, but when you spend hours writing the code, it becomes this piece of art.  That may be the reason I am reluctant to erase the code when new requirements make old code obsolete.

So I kept asking myself that if this were a house being built by Frank Lloyd Wright do you think that the client would ever expect such an architect to tear down what he has built because their living needs have changed.   Of course not!  You would have too much respect for the artist and his art to tear down any precious wall.  Now imagine commissioning a painting from Van Gogh. You tell him you want painted a night scene over a little town with stars in the sky.   And then when he hands you a masterpiece like “Starry Night” you say something like: “I don't know Vinny, these stars are just too BIG.  Could you tone it down a bit” No, you wouldn't, because you have too much respect for the artist and his creation.

The problem with our medium is just how quickly and easy it is to erase.  Click, highlight, delete.  That's it, and in a puff it could all be gone.  A years’ worth of work in one second.  Unlike a painting or a house,  code is too transmutable. For this reason, clients and consumers have yet to elevate code and see that really: “Code is Poetry.”  And as such, software developers have yet to be elevated to the estimation of poets in the public's eyes. There is an art involved in creating really good software and we should start classifying our developers as artists in their own right.

Now don’t go on assuming every coder is good, Just like an artist, every one can draw but only few can create masterpieces. For the record I will not hire 90% of the coders I have worked with in my 20 year carrier.

Thus, the very nature of coding, our products erasabilty that is my demotivator.  I almost feel that the next client who would expect me to erase what I have done is not even worth working for.  We developers, as artist, must start taking our work seriouslyso that our clients will as well.  For my New Year's goal, I have decided that any potential client will have to read The Lean Startup by Eric Ries or let me explain it to them.  If I need to throw my code away, there must be good a very good reason.   And of course, I would rather get the hell out of there rather than stay working on a project for clients.  If at once they are not going to change, they will never change.

And that, folks, is what really demotivates me.

I'd like to hear back from you on this.  Tell me what demotivates you most as a developer and for the managers who manage developers how do you manage a developer’s work when business requirements change, do you explain the reasons for the change or just ask the developer to make the change because the big guy in the top who is paying for every one asked to make the change.  

What I learned from Steve Jobs


About 20 years ago, I was in San Francisco.  It was my first visit to the city, and while walking along Moscone Center I saw Steve standing outside – waiting for his car. This was during the time he was running NeXT. I walked up to him and said, “ You must be Steve Jobs, I just want to shake your hand.” Keep in mind, I was 20 at the time.  We shook hands and spoke for about a minute.  This chance meeting, was inspirational.  From that moment on, I became a fan of everything – Steve. If Jobs were to start a religion, I’d be the guy who knocked on doors – trying to convert new members.
After that encounter I came back to Toronto and bought a second hand NeXT computer and things have not stopped. I bought every version of iPhone and iPad.  All – on the first day they were released. This week,  I bought the new Mac Book Air with Thunderbolt.
Everything is in your mind.
Jobs always led a small team of people to create amazing products. Mac and IBM PC Jr. came out at the same time  - and Mac was developed by a team that was 1/100 of the IBM team. How can a small team produce cutting edge products, while a massive team and a huge budget make one the biggest flops in the computer industry?  Here is a quote from the interview Steve gave to Playboy:

PB:  What’s the difference between the people who have  insanely fantastic thoughts,  and the people who pull off those insanely fantastic thoughts?
SJ: Let me compare it with IBM. How come the Mac group produced Mac and the people at IBM produced the Pacer? We reflect the Mac will sell zillions, but we didn’t erect the Mac for anyone else. We built at for ourselves. We were the group of people who were going to judge whether it was fantastic or not. We weren’t going to go out and do market research. We just wanted to erect  the best thing we could erect.  When you’re a carpenter making a gorgeous chest of drawers, you’re not going to use a piece of plywood on the back, even though it faces the wall and nobody will ever see it. You’ll know it’s there so you’re going to use a gorgeous piece of wood on the back. For you to sleep well at night, the aesthetic, the quality, has to be carried all the way through.
PB: Are you saying that the people who made PC Jr. don’t have that kind of pride in their product?
SJ: If they did they wouldn’t have made the PC Jr. It seems to me that they were designing that on the basis of market research for a specific market segment, for a specific demographic type of customer, and they hoped that if they built this, lots of people would buy them and they’d make lots of money. Those are different motivations.  The people in the Mac group wanted to erect the greatest computer that has ever been seen.

Attention to Details
There was a story on how Steve Jobs spent days agonizing over which Black should be selected for the NeXT computer cases; even though for all most everyone else, all the Blacks looked same. Another story I found on NPR today that is even more interesting, was a conversation between Steve and Vic Gundotra –  the main guy at Google+ who used to work for Apple.

Hey Steve — this is Vic. I’m sorry I didn’t answer your call earlier. I was in religious services, and the caller ID said unknown, so I didn’t pick up. Steve laughed and said,Vic, unless the Caller ID said ‘GOD’, you should never pick up during services.
I (Vic) laughed nervously. After all, while it was customary for Steve to call during the week upset about something, it was unusual for him to call me on Sunday and ask me to call his home. I wondered what was so important?
So Vic, we have an urgent issue, one that I need addressed right away. I’ve already assigned someone from my team to help you, and I hope you can fix this tomorrow,” said Steve.
I’ve been looking at the Google logo on the iPhone, and I’m not happy with the icon. The second O in Google doesn’t have the right yellow gradient. It’s just wrong, and I’m going to have Greg fix it tomorrow. Is that okay with you?
Product development – be it hardware, product design or software development, is always on a person’s mind and how passionate you are about it. As a software developer , if you want to produce quality products, you need to ask yourself,  ”If I am not getting paid, will I still work on this project?”  If the answer is “NO,” then you need to look for a new project.


STEVE JOBS AT HOME IN 1982 — “This was a very typical time. I was single. All you needed was a cup of tea, a light, and your stereo, you know, and that’s what I had.” —Steve Jobs

Becoming a productive software developer

“A great lathe operator commands several times the wage of an average lathe operator, but a great writer of software code is worth 10,000 times the price of an average software writer.” – Bill Gates
“90% of the code is written by 10% of the programmers.” – Robert C. Martin
Hi, welcome to JayOnSoftware. My name is Jay Janarthanan and I’ve been programming for about 20 years. I started this blog so I can share a bit of what I’ve learned over these two decades. It’s also a spot to put cools stuff I find as I work on projects of all stripes.
Don't Panic! This isn’t a geek blog, so I won’t tweak your head by waxing poetic on algorithmic equations or expounding the value of C#. I am interested in focusing mental and physical energies in order to become a super-productive software developer. This blog is for anyone involved in software, from the developers who write code to the team managers who whip coders into shape, from the CEO who hires the developers to the venture capitalist who funds them.
Why did I start this blog?
2011 was a transformative year. I turned 40. My two greatest influences passed away: my dad and Steve Jobs. I started reassessing my life, asking what could really fulfill me. After a week spent soul searching at a mediation retreat, I; concluded that I wanted to share my experience with other software developers and help them improve their lives.; Like my father said: "Teach a man to fish and you feed him for his entire life time."
Productive Software Developers
Golf has Tiger Woods and Jack Nicklaus the programming world has its own list of superstars. Check out this post on Quora for a full list of rock stars selected by other developers. These are the guys running the start-ups and working in lead spots at Google and Facebook.; You see, anybody can tee up and swing, but only a few hit it on the green every time. In my personal experience, the top 10% of developers can write more code then all the other 90% combined.; How? The greats—golfer and developer alike—shine by maximizing their mental and physical capabilities.
Great software developers, like great golfers, aren't born. They are refined through hard work and dedication. Not even a Harvard computer science degree will mean coding gold without a bit of dedication.; A technically competent developer optimizes productive potential by making mind/body connections. Here's how.
Mind Power
The best coders go into a flow mode as they write code. It takes a clear mind and complete concentration on the project. Over the past 3 years, I have found my way to coding Zen through a combination of life style changes. Don't laugh; it's true! There are a few Jedi exercises: meditation, yoga, and nutrition.; I have also learned a few interpersonal tricks for dealing with office politics, people, and time management.; It starts with a healthy physique, and builds to an exquisite mind.
On average, I spend about 4 hours a day coding and find that I am lot more productive than developers who work 8 to 12 hours a day.
My goal is to teach people what I’ve learned. It may seem hokey at first, but I’ve found that anything that makes me a better coder is worth paying attention to, and I hope you feel the same.
Continues learning
SvÄdhyÄya is a Sanskrit term that says a person must study the Vedas and other sacred books continually to stay sharpened and ready to work.;; It's one of the eight tenets of a yogi system of belief. 5000 years ago–before blogs, podcasts or GitHub;– these Vedas were the only source of information. Now, we have a lot more resources. But the central idea is the same: it is critically important, especially for someone like a software developer, to keep learning.
I have worked with C# for ten years, and through a lot of trial and error, I have honed a good system of software development using the Microsoft stack. In my experience, 95% of software developers don't utilize most of the functions provided in a given tool set. A company can spend $10,000 on a Visual Studio Ultimate license, but the developer may be using just 5% of its functionality! Imagine how much potential is lost. Developers need to training beyond programming language or API. They need learn about IDE, debugging, productivity tools, and anything that can help them avoid reinventing the wheel.
The Next Step
I spend a lot of time researching developer productivity.; I pour through piles of books, blogs, podcasts, conferences and forum posts every week to keep up to date with what's hot.; Most of us don't have the time to follow the endless stream of latest and greatest information. That’s the reason I have created this free weekly newsletter, featuring Top Ten lists of key information each week. Subscribing can help you save time, enrich your day, and keep you informed.
You can read more about me on my bio page. Please feel free contact me with questions, concerns, advice or just to say hi.
Jay Janarthanan
A software yogi with a Zen lifestyle and an obsession with developer productivity