Ravi Mohan's Blog

Friday, December 28, 2007

Managers consume what?

from this site,

....managers are voracious consumers of theory. In other words, they value ways to think about their world, and mental tools that will let them make decisions and predictions with a level of confidence higher than they get from experience and intuition alone.

Ummmm. Ok. :-P

Sunday, December 16, 2007

Teaching Mathematics

I've just taken up an assignment to mentor one of my friends in maths/proof/logic.

My "student" has no background in maths or logic (if you ignore the negative knowledge gained by sitting through a bachelors degree in Engineering in India's f***ed up educational system), but is a good programmer.

The expected post condition is that my "student" will be able to read and work out mathematical proofs, design an experiment, analyze an existing research paper, work out an algorithm for a given task, understand basic calculus and linear algebra and in general gain the ability to conduct independent research in Machine Vision. I (and some others, like my friend Rajesh, for e,g.) have worked out some of these "how to"s over the last few years, mostly by brute force search of the landscape, discovering pitfalls by falling into them (and making a careful map, which it is now time to pass on).

"How to work out a proof" for example is rarely taught (well) in a classroom setting and I have had to synthesize knowledge from many sources to come up with a workable technique. I can save my "student" hundreds of hours of work.

Teaching is how one crystallizes one's knowledge. I've always enjoyed teaching but what I've done earlier was in a many to one to many format, involving speaking to a group of people in using a blackboard to derive a proof or a projector to display code.

The one to one format will be a new experience. I spent a few hours today working out a "syllabus" and it looks very good, even if I do say so myself :-)

Update : I plan to teach first order logic and proofs first, probably using books by Velleman, Polya, and Doets and Van Ejck.

Thursday, December 13, 2007

You can't catch up

One of my friends recently told me (I have interesting friends :-)) "Every time I meet you, you have moved further ahead in [area of focus], so how do I catch up with you?"

The answer == "You can't, unless (a) I stand still and wait for you to catch up - Why should I? (b) You figure out how to move a few hundred percent faster than me (Good luck with that)"

Imo, the right thing to do with life is not waste cycles "catching up" with other people. I'd rather do something that is uniquely mine. Competing with oneself is hard enough without wasting bandwidth on what other people are doing or how they are "drawing ahead" or whatever.

Robotics and the future of warfare

I was speaking to one of my friends doing research in robotics in a major American university when it struck me that most of the researchers in robotics and machine learning are gentle pacifists who wouldn't want to hurt a fly, while one of the greatest uses of robots is going to be in real battlefields.

And I am not talking about robots engaging in non lethal activities like scouting or mine clearing, though that's how robots will initially appear on the battlefield. I am talking of robots (on land ,sea and air) armed with guns and other weaponry and increasingly deciding for themselves when to fire and what to fire at.

I believe that in wars of the future two major features will be asymmetrical war (what we call "insurgency" -blurring the boundaries between "civilians" and "soldiers") and increased participation by increasingly sophisticated autonomous robots/remote control weapons. (see this column for some thinking along these lines). I'll ignore the first aspect and focus on the second, in the interests of keeping the size of this post manageable.

Here is how robotics will develop in war. First, robots will engage in non lethal activities like mine clearing or I.E.D detection. (This is happening today) Then you'll see them accompany human combat units as augmenters and enablers on real battle fields. (This is beginning to happen) As robotics gets more and more sophisticated, they will take up potentially lethal but non combat operations like patrolling camp perimeters or no fly areas, and open fire only when "provoked" (This is beginning to happen too). The final stage will be when robotic weapons are an integral part of the battlefield, just like "normal", human controlled machines are today and make autonomous or near autonomous combat decisions. These robots will look nothing like the vaguely humanoid robots of Star Wars - they will have shapes suited to their roles - think tiny dragon fly / cockroach like systems to computerized tanks and helicopters.

And this type of robotic battle system will not be confined to the major superpowers. As of today, what gives robots an edge is not really dependent on hardware, but on sophisticated software, something that does not depend on superpower status. Someone in Korea or India or China, or even a semi military corporation can gain a temporary edge in robotics software comparatively easily (though the Red Queen Effect will kick in soon enough to close the gaps) sufficient to tip a battle or a war one way or another.

The funny thing is that quite a bit of the required technology is available, sometimes in embryonic form, today. "The future is here, just not widely distributed" - as William Gibson said. I know that the Indian defense forces have made substantial progress in battle field robotics systems (I can't be more specific - the details are classified so don't ask! :-D ), and what India is on the verge of doing, others are, too.

None of this is to claim that future combat will occur between machines, all clinical and detached with no blood being spilled. On the contrary.

Historically, every innovation in technology has been hailed as bringing in an era of bloodless warfare. When the airplane was invented, for example, many columns were written on how they made war obsolete because, obviously, with planes roaming the sky no army could make unobserved movements and so war was now futile! Dresden and the Blitz and Hiroshima were just around the corner.

My prediction is that war will become more lethal, with increasingly sophisticated autonomous weapons systems and ever more vicious asymmetrical warfare twisting the business of making "the other fellow die for his country" (or ideology or religion or ...) into newer and ever more horrific forms. And that is something that all of us working on robotics or machine learning should think about.

Update: First Armed Robots deployed in Iraq . While these are not really autonomous systems (they are remote controlled) and substantial technical challenges remain on the path to truly autonomous systems, people conducting research in robotics know how fast these barriers are falling. Those who are not researchers in robotics/ai may mull over the progress in autonomous navigation of vehicles from 2004 to 2007 as exemplified by the DARPA Grand Challenge. Now extend that rate of progress to areas other than navigation.

Monday, November 26, 2007

Books for 2008

These are the books I'll be working through in 2008.

Friday, November 16, 2007

Meet "Spineless"

Spineless is a small Django app my friend Manoj whipped up to help me keep track of my books. People generally borrow books from me and I have a hard time remembering who took what when. Even after giving away almost all my 300 or so java/j2ee/dotNet/"agile"/"enterprise" books, I still have a few hundred books lying around in Bangalore and more in Trivandrum. I have entered the first 50 or so books into the app (actually I type some keywords and the app looks up the books in Amazon and grabs the details and plonks them into a database). There has been some demand for something like this, so all who asked, enjoy! I'll keep adding books whenever I find the time (which is a commodity in very short supply right now :-( ).

One of my friends asked me to enter my book list into Library Thing, but I have a visceral dislike of "social networks". Maybe too strong a mental association with Ruby on Rails, I don't know exactly why.

And before you ask, the name doesn't really refer to books' spines or anything to do with books really. It has to do with a private joke about something someone we know said recently. Manoj liked it so much that he named the app after it. Mention "optimization" to Abey or me and we'll roll around laughing. Mention "Spineless" to me or Manoj and you'll get the same reaction. Commemorating stupid things said by intelligent people (or vice versa) is a bit of a tradition in my circle of friends. What's life without people to make you laugh ?

Thursday, November 15, 2007

Fish Eye Plans

One of the emergent effects of my time management meta focus is that I have I call a "fish eye" plan.

I know in great detail what I will be working on in the immediate future (say the next few days). Next week, I know, but in less detail.I know what I'll be working on next month, but at a higher level of abstraction. Next quarter, even more abstract, but I *do* know what I'll be doing. So if you ask me what I'll be doing in (say) March 2008, I'll have an answer. Not many people can answer that question. This is a very refreshing change.

This is not to say that plans won't change. They will, but you know what they say about failing to plan.

What pleases me the most is that I didn't set out to do this. I just followed Dr Randy Pausch's "system" of time management (with many tweaks and some significant additions from elsewhere) and it all just fell out.

Life is good.

Question: Is anyone in Bangalore (anywhere in India will do at a pinch) doing significant programming in Haskell? Mail me please. Thanks in advance.

Wednesday, November 14, 2007

I won't go seal hunting with you

I told someone a few minutes ago "I think you are very capable and like you a lot but I don't trust you one inch". (Yeah I do say things like that in real life :-D).

After the (very unproductive) conversation was over, I was trying to recollect where that phrase/concept came from. It was certainly not an original thought/phrase and I was sure I read it somewhere. Turns out it was from Edward de Bono who said (paraphrased) "some languages have one word which says 'I like you very much, but I would not go seal-hunting with you'." so one can say (in that language) "I [word] you" where [word] has the meaning of the phrase above.

I forget the book he used the phrase in but iirc, the context was that sometimes if we lack the precise word for something, we need to repeat a long phrase.

This holds in technical conversation too. We don't say "change the structure of the code without changing the behaviour", we say "refactor". In the absence of the word "refactor" we would probably use the longer phrase, till someone got tired of it and invented the word.

Back to seal hunting. In this case, the context was one of doing a startup together and I suggested the phrase as an explanation why a few people don't "openly talk" to him, while the other people do talk to me "openly". Note that this doesn't mean that person X *is* untrustworthy. All it means is that I (and a few other people) *think* that in a crunch, X wouldn't stand by us and would do what's best for him vs what's best for us.

Is not trusting someone a problem? In a normal context, not at all. We all work with people whose competence we admire but we wouldn't want to trust them to keep our objectives and safety in mind when the stakes are high. We just add a double dose of caution, keep our guards up and are careful with words around that person, read the fine print very carefully and so on.

I am not very sure that would work in the context of a startup though. In a startup (from what I've read, not that I've ever founded a startup, though I've been employed in a couple) the pressure is so intense that one doesn't have the time to do all this armor donning and being careful. Founding startups is not like seal hunting -it is like hunting Great White sharks or the aliens from the movie "Predator".The founders absolutely *must* trust each other to do the right thing when the bullets (or harpoons or laser beams) are raining down.

Another thing that I noticed from the conversation was the use of phrases which don't really mean anything but are invitations to games (in an Eric Bernian, Transactional Analysis sense - the person proferring the invitation doesn't often know what he is doing, from a group dynamics perspective).

For e.g the conversation started with "I don't want to jeopardize our friendship but .. " and I was thinking "What friendship? we aren't friends - we were never friends- We are professional acquaintances who speak about technology occasionally and have met at a couple of parties".

To me a friend is someone who you have let into the "inner courtyards" of your life. You can have many positive, enriching relationships which are of a lesser intensity than a friendship, but the word does have a defined meaning and it didn't make sense in this context.

That opening phrase puzzled me for a while, but then I realized that he didn't really mean it either. It is just a phrase the meaning of which depends very much on the context of its usage, in this particular instance meaning something like "I am very uneasy about the fact that people don't relate to me like they relate to you. I am going to vent my feelings a bit but I don't know how you'll react to that, so I'll just use this phrase and hope you believe " maintain friendship" is the reason I am screaming".

Real friends don't need to use those kind of weasel phrases and would say something like "I don't know wtf you are doing, but I am concerned" or something to that effect. I try to avoid these meaningless phrases as much as possible, not because it is a particularly noble thing to do, but because I don't want to clutter a conversation with superfluities. "Say what you mean, mean what you say" is a surprisingly effective, not to mention efficient means of communication.

If you keep an open mind you learn something from the most trivial incident. I learned a few things today. Not too bad for a 20 minute conversation. Not bad at all.

Tuesday, November 13, 2007

A list of topics

My focus on Time Management has affected how I write on this blog. Earlier, when I felt strongly about something or when I was feeling bored, I'd just dash something off. This wreaks havoc with schedules and "getting things done",and I have often stopped writing for a few weeks, months whatever. But this is dissatisfying in its own way.

Now, when I think of something that I feel like writing about, I just add it to a list (on a wiki, if I am at a computer, in a small notebook if I am not) and carry on with what I am doing. When a "write a blog post" size chunk of free time comes around, 15-20 minutes, typically) and I am working on the comp, I just pick an item off the list and write about it.

The style of writing is different than it used to me because I am writing against a timer. More direct, less textured, which is probably the appropriate style for a blog post. The longer wait between conception and recording also allows the good ideas to percolate and the bad ones to show their unworthiness.

For anyone who is curious, my present topic list (this is a continuously mutating entity) looks like this.

  1. San Fransisco vs Bangalore - the right place for software startups?
  2. The Idea Bottleneck and how it really isn't [DONE]
  3. Stealing a leaf from Paul Graham.
  4. SICP Stumbling Blocks
  5. A Billion Dollars And Then?
  6. Topic List on a Wiki [DONE]
  7. Practical SICP - How SICP helps in real life projects
  8. Derivative Trading as Programming Pedagogy
  9. Growing into a (technical) book
  10. Memorizing Shakespeare (and Shaw)
This is just a record of things I might write about. But the time management meta focus seems to be paying off already. I am writing more frequently than usual, and not feeling stressed at all.

Monday, November 12, 2007

Someone stole my cell phone

so if you are reading this, and are on my phone list, please send me your phone numbers to repopulate the address book on my new cell phone.

Thanks in advance.

Update - I got a new sim card but decided not to get a new phone till I complete my research paper.Meanwhile, please use email.

The Idea Bottleneck That Isn't

One of my friends was talking about doing a startup in Bangalore. This is a conversation that comes up regularly. I tried to get a startup off the ground twice, but failed because the people who I wanted to work with didn't live in Bangalore and I didn't want to move.

Those attempts isn't what this post is about. Because this friend was talking about a startup, and wanted some people to work with him , I spent some time talking to other friends who might be interested (I am well connected to interesting, technically capable people who are hungry for success and money).

One question I keep hearing is "What about ideas? Do you have an idea?". I have never understood this question. Generating decent ideas has never been a problem for me. I could generate 20 workable ideas in 20 minutes. And repeat that exercise a few times before I need to pause.

The first time I encountered this "idea bottleneck" concept I didn't pay it much heed. But then someone I respect said I was not paying enough attention to "finding an idea" if we were to attempt that hypothetical startup. So I reached into my mental pile of ideas and gave him an idea to work with, while we work through other issues. He seems happy about it and sent me a link showing that a company with a similar idea (actually a trivial subset) had been acquired for 50 million $ cash.

Another friend heard of this and said "Dude, how can you give up your idea like that? What if he rips you off? Be careful"? First, the friend I told the idea to is a decent chap. Second, I don't really care if he (or anyone else for that matter) "rips me off".

My operating concept is that having ideas per se isn't all that important. It is the actual execution that matters and so I am not afraid of people "stealing" my ideas. It isn't as easy to do that as many people think. The idea I suggested to my friend, for example, sounds simple but there are all sorts of interlocking little problems that all have to be resolved perfectly for it to be successful. I can imagine someone spending a few months (and a few hundred thousand dollars) in an attempt to get it to work and not getting anywhere, because he isn't aware of what to tweak to get a particular effect or how to fix a subtle "error". In fact if anyone can execute the idea better, faster or more comprehensively than I can he is welcome to it.

Paul Graham says it better than I can (in news.ycombinator).

.... if we told everyone about everyone else's ideas, it wouldn't be as bad as you might think. Secrecy is not as important as beginning founders think, because (a) ideas are less valuable than they think, and (b) the most common form of death for startups is suicide, not being killed by competitors."

The last sentence says it all.

Update: One hour after this was written, the proposed startup project committed suicide :-D.

R.I.P :-D

Friday, November 09, 2007

Experiments with Time Management

After viewing Randy Pausch's lecture on Time Management, I've been experimenting with various time management practices. (yeah I know how management-ey and buzzword-ey that sounds, sorry). It helps that I am going through the busiest month in my entire life, so I am more motivated than usual to make this work.

The most successful habit I've adopted is to put a money value on my time. As Randy says in the first few minutes of his talk, people are generally willing to give you their time, but not their money. If you ask people to spend a quarter of an hour to help you arrange the furniture for a talk, they will happily do so, but they won't hand over 10 $ for no obvious reason.

Once you start putting a dollar value on your time, though, strange things happen. For example, I decided not to attend Barcamp. (I'd registered, I cancelled it). Say an hour of my time is worth say a measly 25 $ (being a cheap outsourced-to Indian programmer). Travelling to and from Barcamp, and attending 3 or 4 sessions would take, at a minimum 6 hours. 6 * 25 = 150 $.

Would I spend 150 $ to attend Barcamp? Not on your life! To be honest, there are other disincentives also - I really don't want to attend a meet which is so "implementation lite" - where there is so large a focus on things like search engine optimization (!) and blogging.

People actually think blogging is a big enough deal to form "collectives" about blogging? - there is even a "collective" for "radical ideas" -- yeah right, that makes sense .. NOT. The mind boggles. I consider blogging the intellectual equivalent of writing a post-it note. I cannot imagine self-identifying as a "blogger" and making a big deal out of it. God have Mercy.

Back to Time Management. Since I don't (in general) attend phone calls from unknown numbers/people when I am working, I don't have interruption issues. And once I concentrate on something, it is hard even for people (even if they are sitting right next to me) to jerk me out of the zone - I don't hear anything when I focus on work so they'd have to nudge me, and risk getting a laptop thrown at their heads) so I didn't benefit so much from that part of his talk. But the money value of time is an excellent perception to have. Would I spend 50 $ to have a good conversation with a friend/someone doing interesting things? definitely.

He is also right about keeping a time journal. The result of such an experiment is the most horrifying document you will ever see in your life. The good news is that with such an abysmal base, you can make substantial improvements in a very short order.

To round things off, a couple of snippets from a Phil Greenspun article.

Ask a wage slave what he'd like to accomplish. Chances are the response will be something like "I'd start every day at the gym and work out for two hours until I was as buff as Brad Pitt. Then I'd practice the piano for three hours. I'd become fluent in Mandarin so that I could be prepared to understand the largest transformation of our time. I'd really learn how to handle a polo pony. I'd learn to fly a helicopter. I'd finish the screenplay that I've been writing and direct a production of it in HDTV."

Why hasn't he accomplished all of those things? "Because I'm chained to this desk 50 hours per week at this horrible [insurance|programming|government|administrative|whatever] job.

So he has no doubt that he would get all these things done if he didn't have to work? "Absolutely none. If I didn't have the job, I would be out there living the dream."

Suppose that the guy cashes in his investments and does retire. What do we find? He is waking up at 9:30 am, surfing the Web, sorting out the cable TV bill, watching DVDs, talking about going to the gym, eating Doritos, and maybe accomplishing one of his stated goals.

Retirement forces you to stop thinking that it is your job that holds you back. For most people the depressing truth is that they aren't that organized, disciplined, or motivated.

This is so true it is not funny. And one doesn't have to retire to encounter this phenomenon.I know many people who drop out of the 9-5 rat race for various reasons ( startups, research , search for the meaning of life .. whatever), and then find that months and years pass with nothing substantial being achieved.

Another interesting suggestion from the same article.

publish a public Web diary of what you do every day, thus discouraging you from wasting time because you'll be ashamed to admit that all you accomplished yesterday was a 15-minute oil change and a trip to Target

That is a very interesting idea, but a little forbidding, exposing one's lack of productivity to the world. But I should probably grit my teeth and try it for a month or so. If you want to see what this would look like for someone who is really really good at what he does (vs humbler mortals like you and me) see John Carmack's dot plan files (warning - Flash, sorry I couldn't find an html document of these and I am running out of my "write a blog entry" time slot). There's even a theory that these (Carmacks' plan files) were the origins of the present day blogs, no matter what Dave Winer says.

While I don't quite have the guts to "dot plan" my puny daily efforts, I could probably list down what I plan to do each month on the first day of the month and a report on the last day of the month detailing what actually got done.

So, as an experiment, here is what I need to do this month (November 2007) (client work excluded - privacy concerns blah).

  1. Research - Solve the last 2 issues, code, write up research results into a paper and send out for review. Hard deadline of 24th Nov
  2. Write a Reinforcement Learning library for the friendly folks at at the DRDO. This is a a lot of work
  3. Implement the algorithms in chapters 9-12 of AIMA. (First Order Logic and planning, for anyone working through the book). Release the next version of the AIMA Java code.
Even with the newly adopted time management practices, that is a tonne of work which brings me to -

Blogging Time Over. Back to Work.

Tuesday, November 06, 2007

Hackers Month of Learning Haskell aka X Y Month

The local newspapers are all going crazy about National Novel Writing Month. Apparently NaNoWriMo is some kind of cultural phenomenon in which random people commit to writing 50,000 words in a month, hopefully finishing a (substantial part of a ) novel.

I am not sure any worthwhile novels actually get written this way. If you won't do it anway, you probably won't do it just because other people are also doing it but the idea has its possibilities. The "national" doesn't make sense in a networked world, so we'll replace it with the variable X.

Instead of novel writing we could do something more fun so we'll call it Y.

Let X = { .bunch of adjectives...} Let Y = { ..bunch of verbs.. }.

so we could have "Personal Month Of Derivative Trading" or whatever.

From the nanorimo website,

Valuing enthusiasm and perseverance over painstaking craft, NaNoWriMo is a novel-writing program for everyone who has thought fleetingly about writing a novel but has been scared away by the time and effort involved.

I can certainly think of analogues in programming. many people want to learn Haskell, (say) but never get around to doing it because at any given point of time, there are more important things to do. maybe someone should declare December to be "Hackers Learn Haskell" month and ask anyone participating to write, say, 500 functions in Haskell in a month. Or work through SICP completely. Or whatever.

from the nonwrimo site, Because of the limited writing window, the ONLY thing that matters in NaNoWriMo is output. It's all about quantity, not quality. The kamikaze approach forces you to lower your expectations, take risks, and write on the fly.

Make no mistake: You will be writing a lot of crap. And that's a good thing. By forcing yourself to write so intensely, you are giving yourself permission to make mistakes. To forgo the endless tweaking and editing and just create. To build without tearing down..

Programmers write a lot of crap code anyway so at least that part won't be new.

Sunday, November 04, 2007

The Algorithm Quotient of a Software Project

Still thinking of the DARPA Car Races, it strikes me that a project's dependence on algorithmic innovation for a successful outcome is in direct proportion to its "interestingness" froma developers point of view.

Think about it. All the cars that autonomously traverse 160 miles of desert or travel through an urban environment while obeying traffic rules have essentially the same hardware. The difference in performance is about how algorithmically sophisticated the *software* of each car is.

On the other end of the spectrum most "enterprise" projects are algorithmically trivial (I said "most" so if anyone's ego out there is tied to his knowledge of JSP or whatever, spare me the righteous indignation) and the most complex data structure used is often a hashtable.

I don't think this is always a valid heuristic, but it might be valuable to rank projects on the scale of the algorithmic complexity involved in each (which in turn probably depends on how close the project comes to exploring the unknown, as the DARPA race efforts do), and then by how compelling they are and see if there is a correlation.

In my experience, while enterprise projects have their own set of problems to be solved, they are rarely algorithmic in nature (vs economic or scheduling issues for e.g).

Another supporting factor might be to see if interviews for the interesting dev jobs focus heavily on testing algorithmic knowledge. At first glance this seems to hold as well. If you are interviewing for Google Research, you probably need to be great at algorithms. If you are interviewing for Wipro, not so much - a knowledge of the contemporary buzzwords (agile, xp, tdd, ruby dsl blah) should get you through.

Watching the DARPA Car Race

It is almost 3 in the morning here in Bangalore as I type this. I've been watching the webcast of the DARPA Car Race. This years challenge was for the autonomous ( == no human control) robot cars to accomplish three sub-missions in an urban environment, following all traffic laws (obeying traffic signs, recognizing and conceding right of way etc). This task is a magnitude tougher than finishing a 130 mile autonomous drive in the desert, with zero human control, which was the goal of the DARPA 2005 car race.

Stanford's entry, Junior, just pulled in to the finishing area. While it isn't yet clear who won (because this is not a first past the post race), I'd put my money on Junior. (His (its? :-) ) predecessor Stanley won the 2005 Grand Challenge. This is history being made before our eyes.

The sight of the cars driving themselves, with the steering visible through the windows turning with no human hand at the controls is .. exhilarating... exalting... too cool for words. This is **REAL** programming in action. The people who made this happen are just incredible. Congratulations to all!

How lucky does one have to be to live in these times?

Now to drag myself off to bed (and dream of autonomous vehicles).

Saturday, November 03, 2007

Is that office work?

So, it is late at night and two of my friends are talking to each other. One is a programmer, a very good one, and the other is a manager, I have no idea how good a manager he is.

The programmer is multi tasking, carrying on a conversation in one mental thread and working on some code in another. As the conversation ebbs and flows, his attention also focuses more or less on the code as appropriate, sometimes muttering to himself, sometimes whooping out loud, sometimes ignoring the code and focussing on the conversation.

The manager gets more and more curious as to what exactly the programmer is doing and finally blurts out "Is that office work ? something you have to deliver tomorrow?" . The programmer looks confused and says " No, no it is just something that I am fiddling with". Now the manager looks confused.

And in that moment, *I* understood something. Many people think of programming as work. It sounds very normal and rational when you write it out like that, but most good programmers I know don't think of programming as something you "do at work". Programming is a means of expressing oneself, which also *happens to be* something people pay for. And this is lost on some people who can't imagine "working on" something outside the office..

Just to be clear this has nothing to do with managers vs developers. I can imagine a manager poring over company balance sheets or whatever to find a good investment opportunity and some random programmer who doesn't write a line of code outside office hours asking the same question and getting the same answer.

The difference is something more fundamental. People either have something they work on in their free time or they don't. Now that I think of it, a staggering percentage of the people I know would just switch on the TV, or pick up a book, or idly surf the web or pick up the phone and call someone when they have a couple of hours of free time. The person who picks up a guitar, or writes a program, or analyzes a balance sheet or writes an essay is much rarer than the first variety. Many people don't work *on* anything outside their office hours (and then wonder why "life is boring".

I am sure many people say "yeah so what?" but as someone who has many irons in the fire and is always "working on" something or the other, it was a big revelation to me that most people **don't** have more things to do in life than time to do them in.

One lives. One learns.

As usual, once I finish writing a blog entry I find someone expressing the idea better than I can.

Excerpts from Dan Russell's essay on marathon running (you should read the whole thing).

I don't know how many people have told me that I'm crazed. But the reaction I get when I tell someone I'm running in the Boston marathon is either a "that's wonderful -- how exciting!" or a "you must be out of your mind..."

Usually, it's the latter. And if the person I'm talking with is not a runner or bicyclist or someone who enjoys the pleasures of a workout, then the conversation usually turns toward the health hazards of rigorous exercise. I've been told to watch for vitamin depletion, unexpected calcifications, loss of sensation in the private bits, shin splints, and even unexplained loss of sleep. It's touching, really, especially the ones that are worried about vague causal factors like "getting the body too riled up..."

....So it's hard to explain sometimes why you'd even want to run so far. ..Don't mistake me, running the marathon will be tremendously exciting; there's nothing quite like the sensation of running into the chutes at the finish line, all of the cheers, hearing your name and time called out over the PA -- it's a little like being born and first love and finally getting permission to stop all at once. It's relief, desire and fulfillment borne over the past several months all condensed sweetly into that final few minutes of running.

But as someone one said about practicing the viola, "the epiphanies come in practice." Don't mistake me, running the marathon will be tremendously exciting; ......So I've been running six days a week for the past year just to make it to Boston. Or have I? Seems to me that running is about, well, not to put too fine a Zenish point on it, running. Like anything else, once you've put enough hours of practice into a skill, the doing of the skill transcends the normal, pedestrian everyday experience. Once you get past the first thousand hours or so, the act of running becomes larger than the little aches and pains of physical motion. When I run, I'm moving over terrain; I glide through topography; my body becomes the vehicle that transports me through space. This is an odd, almost out-of-body feeling that starts to happen when you run long miles for training. More than a few times I've run and had the feeling that it would be fun to explore down this road; so I turn, and run down this road. Natural enough, but when you're running 18 or 20 miles, these side roads and random ventures can be two or three miles long each. That kind of distance really begins to change the nature of the experience. You cross towns on a whim and run over sizeable chunks of real estate just to see what's on the other side. On more than one occasion I've run north around a mountain or decided to shift to another watershed during a run. It's the change in scale that's so quietly dramatic. You stop worrying about distance and begin thinking about time -- "if I go this way, will it take another hour?"...

Exactly! And that is what my programmer friend was doing. Exploring. What happens if I try this? And then that? The pleasure from the act of exploring is something that my manager friend, who has nothing comparable in his experience to validate the process against, doesn't quite understand. (Note: This doesn't make him a bad person). So he falls back to "Is that office work"? or in other words, "where are you running to? Can't you get a taxi ?"

To "learn AI"

first learn basic mathematics.

I keep getting asked this question and I keep saying the same thing - to three people in the last week, for e.g, two of whom were working through (or planning to work through) AIMA - so I thought I'd put this down here (and point anyone who asks the same question to this entry in the future).

Learning AI (or any deep comp.sci for that matter) is not like learning J2EE or ruby "dsl"s or whatever the fad du jour in the enterprise software world is - read a few chapters of the latest bestselling "pragmatic" book, write some crappy web site and hey presto you are the expert.

"Real" comp sci doesn't quite work like that.

To understand a standard 3 layer feed forward neural network, for example, you need to have a solid grip on

  • vector spaces
  • basis vectors and change of bases
  • eigen vectors and eigen values
  • Basic matrix operations like inversion
  • multi dimensional performance surfaces
  • Quadratic functions and finding their global maxima within Newton's method and Conjugate gradients
  • performance measures and steepest descent
  • partial differentiation of vector values
  • numerical stability of algorithms

Without that background you will be able to use conceive of "class NeuralNetwork" that "has an" instance of "class Node" etc, but you will *not*,(repeat NOT) be able to do anything useful with real world data (writing a XOR classifier doesn't count!).

And, a feed forward neural network is only one type of pattern recognizer (or function approximator). There are many more, each with its own trade offs , and you have to know the math to make the trade offs.

That being said, the best book to start with is AIMA as long as you (1) learn the required math parallely (2) do all the exercises at the end of every chapter.(I can't emphasize this enough). Reading through != "working through".

If one is willing to work hard, there are very few fields as fascinating as the various branches of AI.

Once you start down the rabbit hole, however it may be very hard to continue writing all that heavy lifting enterprise software without hearing the giant sucking sound of your life going down the drain as you write yet another jsp page for the latest leasing system. ;-)

Be warned! :-D.

Anyway the really hard part of "learning AI" is not getting the books or working through them systematically (which is hard enough), but that is for another blog entry.

Post Script - Some book recommendations for beginners.

  1. Linear Algebra by Gilbert Strang
  2. Calculus by Gilbert Strang
  3. Artifcial Intelligence A Modern Approach By Russell and Norvig
  4. Machine Learning By Tom Mitchell
  5. Neural Networks for Pattern Recognition by Chris Bishop
  6. Paradigms of Artificial Intelligence Programming by Peter Norvig (ok, this one is not quite an cutting edge AI book, but imo this is the best book on programming ever written and if you call yourself a programmer you should have it on your book shelf)

Sunday, October 28, 2007

Intoxicating Conversation

I just got back from our end of the month "Losers' Club" meetings (more on these here). In the absence of the one person in our group who maintains an interest in enterprise software, we focussed on the more "blue sky" aspects of software/comp sci.

Topics that came up for discussion - Haptic sensors for robots, micro robots, challenges in building a simulation of the human cardio vascular system, metrics for each component of a research effort, Randy Pausch and his lecture on Time Management, the Bhagavad Gita, Reinforcement Learning as a methodology to learn control algorithms, Computational Fluid Dynamics and Aerodynamic modelling, building SkyNet, using histograms to model discrete probabilistic distributions, Algorithms for probability Density Tree construction, how to keep tight focus on research projects that spin off more areas for exploration with every step taken aka how to balance exploitation and exploration in the context of Rogue Research, proof techniques as weapons in a personal arsenal, abstract problem spaces, Lush as a lisp for day to day work, overcoming the fear of Calculus, Django (yay!) vs Rails (bleh!), the non importance of learning java script, Prototype vs jquery, Goal Driven vs Capability Driven learning styles, continous phenomena in genotype decoding, a proposal for a facebook style app for researchers, Aikido, conferences in Goa, and of course status reports, "iteration reviews" and plans for the next month.

Aaah, Life is Good!

Friday, October 19, 2007

A Few Good Men

One of the oddities of India's "silicon valley" is that there is very little hapening that is technically interesting.

For example, take interest groups. User groups for various topics of technical interest certainly do exist - for some value of "exist". They are unfortunately not very effective. Some common patterns I've seen are

FizzBust - There is a lot of enthusiasm for setting up a group, drawing up an agenda and holding an initial meeting. After that first (or occasionally second) meeting, nothing much happens and the group dies away.

"Eternal Beginners Syndrome" - Every single user group meeting has talks of the variety "Introduction to X" where X is the topic of interest. This is certainly fine *if* people ever move on to intermediate or advanced topics. This rarely happens. What's worse, every one of these "introductions" are (a)focussed on power point presentations and (b) every slide in those horrendous presentations are cut n pasted from the same old books. Encouraging powerpoint for non visual data is the infallible identifying sign of a group that has passed its peak and is now declining in utility and relevance.

A closely related pattern is "Propaganda over Exploration" - the group takes on the attributes of a cult with some members claiming to have "superior wisdom", the dissemination of which becomes the primary aim of the group. Thus rather than have a a collegial group exploring and learning and where appropriate criticizing the focus of the group, one has "masters" and "followers". This quickly drives away any good folks.

"Philosophy Over Code" - This is where people wax lyrical over the virtues of GPL vs the BSD license but haven't written a single piece of open source code in their lives and don't intend to.

"Uncritical Acceptance" - Once in a X user group I suggested that one possible topic for an upcoming "X Conference" would be "Where is the use of X inappropriate". I was quickly shushed with "That is a valid question but asking it in public would "hurt the movement" ". My reaction was "Duh? "movement"? what movement?" but I didn't press further.

The way to run an effective (vs "popular") user group would seem to actively invert all these phenomena. Have a small bunch of experts meet regularly to discuss things of interest. Don't actively try to expand the group or conduct "outreach". Avoid all formal organization and "outreach programs". If someone wanders in after hearing some word of mouth description of what goes on that's fine, but don't actively aim at recruiting or expanding the group. Have everyone bring code (or proofs or papers or whatever the metric of actual progress in the field is) and actively discourage empty philosophizing.

I've been experimenting with some of the above ideas for the last few months and they see to work well. One kind of "community" I'd like to see is of amateur researchers in hard comp sci - amateur in the sense of "pursuing research strictly out of interest and not to get paid" , not "amateur" as in "lacking skill". Assembling a group like this has its own difficulties however. With a few honorable exceptions most members of (Indian) "research groups" of technical companies could be stood up against the nearest wall and shot with no appreciable impact on the output of those groups. Likewise for most researchers in (Indian) government service or the (Indian)educational institutions. But "most" != "all" and that is what keeps me from abandoning the idea.

Saturday, October 06, 2007

Snapshots from my Robot Simulator

I've built a tiny robot simulator for my ongoing research. Like the (absolutely brilliant) Stage Simulator, my simulator enables the simulation of robots in a 2D world. Of course my simulator is much simpler than Stage, primarily because it doesn't try to do as much as Stage does. On the other hand it has a couple of important differences that are important to my research. For e.g. it has a built in sensor and motion error model and (being implemented) a sophisticated Sonar Model.

Anyway, here are some early snapshots of a simple environment.

A simple world for a robot to navigate - The world is 10m X 20m with a resolution of 2 cm. The corridor is 2.5 m wide.

A robot (the little blue dot)stands in the middle of a corridor.

The world overlaid with a quadtree that overlays and recursively decomposes the 2D world and enables efficient ray projection.

The world illuminated with a laser. The illuminated points are rendered in yellow. The scan has a resolution of 1 degree,a "pan" of 360 degrees and a range of 3 m. I was a bit concerned that this would be slow but it takes no appreciable time, even when the angular resolution is 0.1 degree. All hail the quadtree!

Of course the robot sees only the illuminated points, not the complete length of the walls etc.

This is what the robot "sees". There are other sensors simulated (e.g. an odometer) but they are not rendered here. You'll notice that the laser sensor senses the environment "perfectly", i.e the range detected is the actual range to an obstacle that intercepts the laser beam. No real sensor works like that. To simulate this imperfection in a simulator, a probabilistic error model is added to filter the reading so the robot sees an approximation to the real range.

Here we've added a bivariate gaussian error (with a standard deviation of 10 cm) to the laser sensor. If you squint, you can see that the readings now only approximate the wall surface. To see this more clearly, we'll remove the unseen parts of the corridor walls and the overlaid quadtree to get a picture of what the robot sees, with the simple error model in place.

This is what the robot "sees" through the error filter. Note the "scatter" of the readings. Now the robot doesn't know for certain where the walls (or whatever objects obstruct the laser - different parts of the world react differently to different sensors - some surfaces absorb light for e.g returning no readings to the laser sensor) are.

The robot simulator is not the central thrust of my research effort, but it helps to have an environment in which one can plug in various sensor models, motion models and error models and see what the robot would see. I thoroughly enjoyed coding this up.

The next step is to replicate a realistic sonar (vs laser) sensor. There are a few interesting issues to be resolved to get this to work properly. Sonar works differently from lasers - cones of ultrasound have different propagation and reflection characteristics from rays of light. Stage simulates sonar with the same "ray trace" approach as is used for lasers. For my research I need a more accurate model (and hence the need for a custom simulator). Early next week, I will be visiting the Robotics Lab of the DRDO (The Defense Research and Development Organization - For non Indians reading this, they are the local equivalent of DARPA) to talk to some scientists working on similar problems. I have a basic sonar model working already, the key challenge of which was to layer different continuous probability distributions and sample data from them in reasonably efficient fashion, but to describe that would make an already long post longer, so I'll stop now.

Thursday, September 20, 2007

Saluting Randy Pausch

First read this (via news.ycombinator).

Then see the streaming video. It is terribly slow and broken up on a typical Indian internet connection but just see it anyway. You'll thank me afterwards.

If you are a parent, a spouse, a teacher (of any subject), a student, a programmer, an artist, a designer, a public speaker, just see it.

Dr Pausch, I have never met you but you just changed my life. Thank You.

Update: The video is on YouTube in ten pieces. This is much better than CMU's streaming video, because in these you can load the full video before viewing, go back and forth etc.

Tuesday, September 18, 2007

The Lame and the Blind - Proofs And Code in research software

There is this old story about a blind man teaming up with a legless man. The blind man carries the legless man on his shoulders and provides the locomotion while the sighted cripple tells him where to head.

Similar divisions of labor exist in enterprise software (think "developer" and "analyst") but this two fold division of labour is exacerbated when one focuses on research software. Here the scientists are the "sighted folks" who know where to go but can't move and the developers are (ideally, as we'll see later) the folks who know how to move the project forward by writing code, but don't have the requisite mathematical/scientific skills to navigate and choose one direction over another.

Earlier today, I was talking to a scientist trying to move a multi million dollar machine learning project forward, who was feeling hamstrung because it was impossible to find a few people who could follow advanced calculus and also write good C code.

Unlike in the folktale, a real life arrangement consisting of a blind man and a cripple would be very inefficient, with the occasional fall, not to mention the constant stubbing of toes and odd outburst of swearing. But equally, nothing in real life mandates this kind of "pairing". Nothing prevents a scientist from learning how to code (except a feeling that coding is a relatively "blue collar" activity) and nothing prevents a developer from learning the requisite maths and science (except that most developers, especially the enterprise/agile/dsl types either don't have the caliber to learn hard math or think erroneously that these skills are beyond them or just don't want to work that hard).

The few folks who do master both proofs and code, can and do make a tremendous difference. The very best people in every research area that incorporates software and maths are very capable scientists/mathematicians and very capable programmers. Peter Norvig is an example. As is Donald Knuth. Or Manolis Kellis. Or Yann leCun.

If you are running a research software project you'd want to staff it with high level multi-class (think dungeons and dragons) scientist-mathematician-developers. Unlike in D and D specializing in one area does not need to involve trading off the other.

After all the lame man/blind man arrangement is not the best possible one. The best (and normal) situation is having two (or n) people who can both walk and see.

Tuesday, September 04, 2007

Erlang is the new Ruby

There is a particular type of programmer who tries to keep up with the "coolness" crowd by jumping on to the latest bandwagons and hanging on for dear life (till it is time to jump again). The word "fanboy" doesn't quite describe these folks but it gets some of the nuances right. The key characteristic is that they talk a lot about what essentially they don't really understand.

For a while , the fad was ruby. "Ooooh look we can use select instead of a loop" "Oooh everything is an object". Then it was creating half baked "DSL"s, especially in the context of Rails.

Now Ruby seems to be losing some of its sheen, and the lemmings are migrating to Erlang. Now, Erlang is a very powerful language that is worth studying and it has been around for the last twenty years or so, but the next time I meet someone "evangelizing" Erlang, without the faintest idea of how functional programming, pattern matching or concurrency really works, I am going to do something nasty.

Don't get me wrong. Erlang is well worth studying. But first write a 10,000 line+ non trivial program in it. Create an open source library or two. Submit a few patches. Then try to convert the heathen. But I guess if you were to do that you wouldn't be a fanboy anymore.

Ahhh. Choices.

Tuesday, August 07, 2007

Indian "Journalists" strike again

SmartTechie (what a horrible name for a magazine !! ) has an article purportedly written by Roy Singham, CEO of Thoughtworks. Having worked at Thoughtworks and having met and interacted with Roy, I am very skeptical about the attributed authorship. The article has many examples of "Indian English" and is very tortured writing to boot. Roy is a very articulate speaker and writer and speaks perfect "American". So if you read the article and go "WTF?!!" do keep in mind that the writer is probably some Indian hack pretending to be Roy

Here is a sample " To over take other automobile companies and to reach at the helm, Toyota had devised a comprehensive action plan which included the Toyota Production System. " .

"reach at the helm"? WTF? You expect me to believe Roy writes or speaks like that?

I can only conclude that some half baked journalist essentially made up the article and attributed it to Roy.

Thoughtworks is an excellent company, with many world class writers in its ranks and this kind of ghostwriting goes against everything Thoughtworks stands for. And if the editors at the magazine must have someone pretending to be Roy, they magazine ought to get someone who understands how to write English well.

It amazes me that people whose profession is all about writing well don't know the rudiments of the language in which they write.

Saturday, August 04, 2007

On Having Friends Who'll Change the World

A few months ago I and a few friends started meeting at the end of every month for an "iteration review" of how much progress we've made (or not) on our "life work" that month. The structured part of the meeting consists of each participant reporting what went right, what went wrong and what was learned during the preceding month and what the plans for the coming month are. Anyone can ask clarifying questions. This is followed by unstructured discussion over dinner (and drinks, for those who indulge in that particular vice). Apart from the obvious benefits of meeting up with friends regularly, the act of vocalizing what was learned has tremendous value.

The last meeting was focussed, for instance, on the difficulties of transitioning from the habits instilled from working in India's "Silicon Valley" to those needed for doing world class work, particularly in research/scientific software, the price one needs to pay and the metrics of progress. While that was a fascinating discussion, what struck me then was how lucky I am to know people who are unwilling to accept the status quo and exert themselves to become the best they can be.

This extends beyond the attendees of our end of month meetings. I just got back from lunch with another friend I haven't met in a while. I am amazed at how much she has learned in the intervening period and how many different areas of improvement she has targeted for the future. Indian society has the nasty habit of grinding down women who want to excel in any field, but then she has extraordinary potential, so that will be an interesting career to watch. If she ever starts a company, I will be the first to invest in it.

On reflection, I realize that I subconsciously rank people by (a) their potential to excel and (b)the ratio of actual achievement to potential achievement. I pay attention proportional to how high I think they score on these parameters and so I end up ignoring people who, in my subjective opinion, have low scores on both parameters.

I am not very certain that this is the "right" way to judge people or decide who to befriend (I guess I am an unconscious "elitist") but it results in my knowing people who strive to excel. And given the caliber of some of my friends, I effectively end up knowing people who'll change the world.

Sunday, July 08, 2007

Misquoted in the Media

A reporter from the Economic Times asked me for some information about our wargames club, conducted a telephonic "interview" with me and a couple of friends, and then wrote an article in the paper.

So far so good. What is not good is that he has quoted me as saying things I never said , and in horrendous English, to boot.

Here is what I am supposed to have said.

(Apologies for the terrible English and mangled tenses. *I* didn't say *any* of this. The journalist just says I did. The language and ideas are his, not mine. I checked with some journalist friends of mine and apparently this practice of expressing journalists' ideas as "quotes" from the people they interview is common practice in India! And I thought only the Indian Software Industry was a con game!)

Anyhow, onto the quotes (from the Economic Times dated 8th July 2007) - my comments below each quote

"We are an informal group of Wargamers based in Bangalore. We are interested in topics like strategy in wars, the history of warfare, historical re-creation of battles, battles of all times and eras. We do not use miniatures in our games but make do with suitable counters instead,” says Ravi Mohan, group co-ordinator."

[ I never said this. This paragraph is lifted straight from our club website. See the first paragraph].

The report continues to "quote" me.

In the last one year, the group strength has increased substantially. “

[huh? This is outright fiction. The club membership has held steady over many years and there were no additions in the last year. Needless to say, I never said this either! ]

As kids, we all use to play games such as this. So there is a natural interest. And, as awareness spreads, we'll see more people joining the fray,”

[Aargh! This is tortured, atrocious and ungrammatical English , and cliched to boot. Does anyone talk like this? "we'll see more people joining the fray" ?!!

The least a professional journalist could do (even when inventing quotes) is to use correct grammar.]

There are many unintentionally funny errors in the article- E.g: the use of "Canon" for "Cannon"- but it is too much effort to list them all here.

The next time someone wants to interview me for the mainstream media (and may that horrible day never come!) I'll just write the damn article myself. Or even better, run like hell!

Friday, June 22, 2007

Zenter - Working Habits for a succesful startup

I am still "offline" but this was so striking I wanted to record my awe. from here, (emphases mine)

What was a typical day or week like at YC?

We basically lived by the following schedule 7 days a week for 3 months. 10am - Noon: roll out of bed and stumble into the living room to sit at the computer, check email, blogs, news for the day and start coding Noon - 12:30: eat our $2 Lean Cuisine lunch - My personal favorite is Swedish Meatballs 12:30 - 7pm: Heads down coding, music played all day long and we alternated days to pick the play list which worked well 7 - 8: Kick Robby's ass at Tennis on the apartment courts. I think I may have won 3 sets over the entire 3 months. But they were always like 6-4 and it got us out for some exercise. 8 - 9: Make and eat gourmet dinner - mostly tombstone pizza, but occasionally Red Baron when they were on sale. Care packages from family were also extremely helpful to make sure we didn't eat too poorly. 9pm - 4am: Code like the wind - maybe do a design session or two if we are trying work through something particularly hard. 4am - 10am: sleep

I am impressed!

Thursday, June 21, 2007

Archive Visibility Fixed

The archives for this blog were not visible. Now they are.

Thanks to the reader who sent this in.

Friday, June 15, 2007

Blog On Ice For a While

the nutshell version:

I am *extremely* busy and won't be paying too much attention to this blog for the next couple of months. If you need to contact me, write an email or call. Thanks

Longer version:

I just spent an hour or so responding to a comment and an hour a day is something I just can't afford these days. I have a lot of travel coming up. My research has finally "clicked" and while there is a tonne of work to be done, there is no longer any ambiguity about what to do or how to do it. But I really need to buckle down and work. It's all very exhilarating but time is at a premium.

I have a roaming cell phone number and check my email twice a day. So do write or call if anyone needs anything. Friends can almost always ping me on messenger or gtalk.

I will be back in late August/Early September.Thank you for your understanding.

Thursday, June 14, 2007

Rogue Researcher's Route Map - Addendum

I wrote about what I learned when attempting to do Comp Sci research on my own (A Rogue researcher's route map).

Something I've learned since then might help people read research papers- Every (good) research paper asks (and hopefully answers) a question. Try to discover the question being asked and the answer and nail them both down by trying to express them in a couple of sentences each.

This really helps you understand the significance of a paper for your research. And stops you from panicking when you discover papers which seem to cover ground similar to what you are doing).

Paul Graham , talking about startup ideas, says,

Treating a startup idea as a question changes what you're looking for. If an idea is a blueprint, it has to be right. But if it's a question, it can be wrong, so long as it's wrong in a way that leads to more ideas.

Seems to work for research as well, especially for solo hackers attempting research outside institutional frameworks.

Wednesday, June 13, 2007

The Stratal Effect

Dr de Bono defines a "stratal" thus.

"A stratal is a number of parallel statements or observations that are put together as a whole. The statements need not be connected in any way whatsoever. There is no attempt to be comprehensive. There is no attempt to cover all aspects or to be descriptive. There is no attempt to be analytical. Just as a random word is used because you want to use it, different statements are put together as a "stratal" simply because you want to put them together in this way. A stratal is a number of unconnected statements put together solely to form a stratal. "

The key is that the statements are loosely connected or not connected at all. De Bono suggests that a stratal be used for generating ideas or to convey a particular effect.Some of the best poems can be seen as stratals.

But one can also use stratals for different purposes. One of the most fascinating uses (at least for me) is to lay out two (or more) random statements or ideas in parallel, especially in conversation and then see which of the ideas gets picked up. Let us say you are talking to someone who feels has a problem with relationships and you think there might be an empathy skills deficit. How do you check? One way to do it is to lay out two statements in parallel, one which checks for empathy, one which checks for it's opposite(say self centred ness). and see which one gets picked up. Say something like "I feel very frustrated when I talk to you so perhaps you can change that behaviour in the future" There are two ideas here, one starting with "I" and one starting with "you". A person having problems with empathy will probably pick up the sentence beginning with "you" and answer something like "Oh I know I need to think about changing my behaviour". A more empathetic person will place the focus of consciousness outside himself and on the other person say something like "Oh you feel frustrated? Why do you say that?"

There are all kinds of variants of this technique in combination with all sorts of other psychological/counselling tools, but the essence is simple. Layout parallel thoughts.

I picked this up a variant of this technique from John Hundreiser (aka "H", once head of recruiting at Thoughtworks ) who frequently uses a similar technique in his interviews. He would ask you a chain of three or four questions and see which one you'd pick up . He was the head of HR and his interview would come after many rounds of interviews. he'd ask something like "How did the previous interviewers from TW treat you ? Did the explore technical questions in depth? Are you feeling comfortable?" There are three distinct questions here and many people would answer one of these questions, at most two and forget the third. It is the very rare (and very self aware) person who says something like "To answer your questions in order, first ...second , .. third .. "

Of course the big problem with these tools of applied psychology is that they are all very context dependent and to use them properly the user needs to be (relatively) free of complexes and biases himself and also have the ability to evaluate the results properly. But that is the subject for another blog entry.

"Concentration is the Enemy"

A fragment from a (chat) conversation with my friend Abey.Context == Talking about programming,

me: Hey did you know about this " I think maybe concentration is the enemy. Seriously. If you're working on something that is so complex that you actually need to concentrate, there's too much chance that it's too hard. - Ron Jeffries"

Abey: yeah that makes sense[/sarcasm]

me: I guess one could always pair to avoid the "danger" of concentration. Hard to focus if someone is yammering in your ear all the time.

Abey: Yup! Pairing always helps. Instead of one person fretting and strumming the guitar and singing (takes too much "concentration"), you should have one doing the fretting and one doing the strumming

me: Let's "turn the dial up to 10". How about two pairs, one pair on the frets and another on the plectrum. Lots of redundancy and no need to concentrate!

Abey: yeah Extreme Guitar .. perhaps we could write a book?

Monday, June 04, 2007

On an unwillingness to pay the price

This is something I've started noticing recently. A lot of people claim they want something and then balk at paying the price. The pattern is
  1. I want X. I soooooo wish I could have/be X
  2. Sure why not, Do A, B and C and there is no reason you can't have/be X.
  3. Urmm yeah but that's too tough.. I don't want to do that.

Here is an example.

A friend says "Dude I wish I could stop working on enterprise software and work on cool projects like you do". ME :"Sure you can , just work through these books, learn the required math and you can work on these things too. I have more work than I can handle and would be glad to give you some." Friend:" Maths!!! I hate maths!" or "yeah dude but that's gonna take me two years!! That's too long"

A variant on this, particularly applicable to relationships (of any kind) is an unwillingness to reciprocate. If you expect people to care about you and devote significant amounts of time to you, common sense says you have to do the same for them. I've seen many (too many) people who are very focussed on "taking" and not so much on "giving". Which is fine but then I hear complaints of "I am un appreciated/my husband left me/my girlfriend acts remote/ I don't have friends I can trust".

I don't get it. Is it too old fashioned to believe that one has to actively and diligently work for the really good things in life, whether the aim is a good job or a good relationship or something else?

FAQ (from my mail-box) #3 Can we hire you ?

Probably Not.

Some context. Every single day, I get 3-5 emails from people trying to offer me a job. The obvious form letters go into the trash can immediately, but I'm old fashioned enough to write a response to any mail that looks as if it has taken a human being some time to compose (Examples of both type sof mail at the end of this blog entry). Of late however, I find myself writing the same thing one too many times, hence this blog entry.

So, you are company X . Will I work for you ?

If your business model depends on body shopping (where body shopping is defined as "we don't care what projects we work on or for whom and the business model is x number of developers farmed out to random clients for y $/hour"), no, I'll never work for you. Been there, done that, got the T shirt. There is nothing you can offer that I want. I don't want to be an "architect" who does "high level design". I don't want "extensive travel" or "green card sponsorship". I don't want to be a Project Manager type and "lead enterprise changing teams for Fortune 500 clients". I do not want to be an "Agile Coach" (yuck!).

Please don't write to me. You are wasting your time and mine.

If you are a product company with a strong technical focus or even a tiny startup with an interesting idea, while I don't promise to work for you, I'll give your email serious consideration. I don't promise to accept your offer, but you'll get a reply.

Here is an example of a recruiting mail that goes straight into a the trash bin.

Dear Candidate,

I saw your resume in out database and would like to talk to you about some positions with our Direct Client in Naples , FL. If you match to any of the below mentioned positions then please mail me your resume with the job title in the subject line.

Location: Naples, FL, USA

Duration: 2 years +

Start Date: ASAP

Requirement : Java Architect

* 8+ years of software development experience

* Strong OO concepts

* Experience with RDBMS (Oracle and SQL Server)

* experience in leading a development team and working with Fortune 500 clients.

* Good problem solving skills

Please email me your resume if you are interested on [email] or call me at [phone number] if you have any queries.

Regards, [Name]

It boggles my mind to imagine that people expect responses to emails that begin with "Dear candidate"(!!!).

Here is an example of an email that gets answered in the polite negative.

Hi Ravi,

I hope you remember me. We worked together in [company] where I was working as a recruiter. Well I've moved on to [Outsourcing company] and we have a desperate need for senior people. Compensation is not a problem and even if I do say so myself, we have an interesting culture and great projects. if you are looking for a change, do touch base with me.

Regards,

[Name]

This is the kind of email to which I hope to forestall having to reply by writing this blog entry. Let me repeat, if your business model is built on selling developer time by the person hour, I am not interested.

Lastly here is a mail I got from a recruiter in a certain company head quartered in Mountain View. It is still very much a slightly customized form letter and if I wanted to work for the big G, I'd probably ask someone I know who works for them to reccommend me, but this letter got a reply.

Hi Ravi,

I would like to introduce myself. My name is [Recruiter Name] and I am a technical recruiter with Google. I came across your profile online and I thought you would be a good fit for one of our Software Engineering roles on our test tool development teams. If the proposition sounds interesting and you would like to learn more, please contact me directly via e-mail or phone. I would love to share with you the exciting approach Google takes to software testing and the amazing advances we are making in test tool development.

Thank you so much for your time and consideration. I look forward to hearing from you and talking to you about a career with Google. Respectfully,

-- [Recruiter Name] Google Staffing [Recruiter Phone Number]

1600 Amphitheater Parkway Mountain View, CA 94043 [Recruiter Phone Number]

Product Company? Check. Technical focus. Check. So I spent about 10 minutes thinking about it and then wrote a "Thanks but no thanks" email. I don't want to write testing tools, (though I know a few people who are) and I am not sure working for Google now is a good idea. Their stock prices are at unheard of levels and Bangalore (where I am located) is probably very far away from the real technical action in Google, if the "Bangalore centres" of other companies I know (and are competing with Google) are anything to go by. I could be wrong, but I've never come across anyone who worked for Google Bangalore. If I knew someone I admired who worked in Goog Bangalore, then yeah sure I'd consider it. I also hear on the grapevine that the old "Google culture" is fading a bit. I'd rather work for a startup with 5 smart people than for Google.

Which brings me to an interesting point. Beyond a certain level of expertise, I doubt if recruiters can be very effective at all in hiring good developers. Most developers are pulled into new jobs by their network of fellow developers / people they worked with before. So here is a hint for recruiters trying to hire good developers. Ask the best developers you have to contact the best developers they know. Beyond a point, I suspect that's the only way.

Monday, May 28, 2007

FAQ (from my mail-box) #3 I am just starting out in the sw industry/I am still in shool. Can you give me some advice?

Sure. Giving advice is easy. Following it is hard :-)

If you like coding (and technology in general), seriously consider if you want to study further. A B.Tech from most Indian Universities is utterly useless. A good MS or PhD will get you the good technical jobs. If possible get some deep grounding in science or maths. Or if you are the non tech type consider an MBA.

Even if you can't study further, start specializing in a "tough" sub domain of software. If you are working in Java, learn C and assembly. If you are wrestling with java and xml on the job , acquire some expertise in algorithms or networking stacks. which brings me to

Decide on whether you want to be an "enterprise" programmer early. Pros = fairly easy work, easy to get that first(and subsequent) job, plenty of travel. Cons = ultimately unsatisfying if you are a seriously technical person (you may need to move up to be a manager if you want good work or money, but being a manager is not a technically intensive job), it is too easy to get into an endless grind of developing the next website for an arbitrary series of industries.

If possible, join a startup/small company/technically sharp company (like Google) vs one of the behemoths (like Wipro or Infosys). [Useful heuristic - if the company is an ISO/CMM./other process heavy company, run for your life!]. You'll learn more in a shorter period of time. You can always join Wipro or TCS after a couple of years when you are ready to "settle down" (and be mediocre).

Be prepared to work like crazy for the first couple of years.

Be prepared for intensely political environments (the more so if you join a big company). I am not saying be political, just be aware of politics. Politics is a part of every human endeavor which incorporates more than one person. Either scrupulously stay above it or learn to play the game well. Don't get caught in a "middle path" where you play sufficient politics to get hurt but not enough to use it get more money or power.

Be aware that a job is not a continuation of college. It is surprising how many people make this mistake. (Some companies even encourage this in a ludicrous attempt to be "cool". If the company HR asks you to play Dumb Charades on a company outing, or if the company workforce is divided into "houses" which compete against each other in "skits" or "Dance competitions", you are probably in one of these companies) Seriously consider leaving. There is a subtle distinction between a job that's fun and a boring job with pseudo hip "activities" layered around it.

Above all if you don't enjoy coding, for God's sake move on. Do something interesting with your life. There are enough doofuses in the Great Outsourcing Destination without you adding to it.

Thursday, May 24, 2007

FAQ (from my mail-box) #2 Should I apply to Thoughtworks and/or can you help me get in?

This is a question that comes up a lot.

My answer to questions of the form "Hi , I am ... my experience is ..... Do you think I should apply to Thoughtworks?" ( i can't imagine writing a letter like this to someone I've never met, but many people seem to think it is ok, so .. ) is

I have no clue! It is up to you to decide what your career should look like. In general, TW is a good company to work for if (a) you want to work on "agile" (b) you like to travel (more so if you are applying to the TW offices outside India) (c) you like working on enterprise systems (d) you are very good at whatever you do (coding, analysis, dba whatever).

TW is very un hierarchical (less so these days than before but still largely true) and if you are the type who measures your status by what your title says or how many people report to you then you should NOT apply. Oh yeah, you'll find the interviews either very tough or very easy. (Folks who are really good at what they do find the interviews easy. Those who are not, find them correspondingly tough or "unfair"). There are way less idiots in TW (India) compared to almost any company in Bangalore I know of (Google excluded), but there ARE a couple and if you face them in an interview that's your bad luck. Just move on.

In a nutshell, I will **not** reccomend people I don't know (It is amazing how many people ask me to do this). Just for context, I have reccomended exactly one person to TW (needless to say he is very very good) in the last 5 years (hi Sheroy!).

I left TW almost 3 years ago and have no inside information (and if I did I wouldn't share it with people I don't know). If you *have* worked with me in any capacity, please feel free to ping me and I can talk to you about whether TW would be a good fit for you (you'll have to buy me dinner/beer).

PS: the Thoughtworks India recruiting page is here.

I would like to point to the recruiting pages for the other offices , but some moron of a web developer has changed the Thoughtworks Home Page so it redirects to a "Select Country" page (wtf!). So I can't be bothered to find all of them and point to them, but in general, go the appropriate country's hiring page and apply online.

Wednesday, May 23, 2007

FAQ (from my mail-box) #1 What are development costs in Bangalore?

[context] I get all sorts of questions in my email every day. I try to answer all my mail but I am getting tired of answering the same questions again and again. So I am going to post these common answers here and not answer by mail anymore [/context].

The minimum cost of a developer(aka a "coding body") in Bangalore is about 20-25 $/hour. This is the rough rate charged by Wipro/Tcs/other "outsourced enterprise" bottom feeder companies, for a "standard" development project. Of course most of these projects are seriously overstaffed, but that's a different issue. The hard part here is getting a good team who can deliver good code vs process documents or whatever, but at 20-25 $/hr you will get a pool of candidates.

If you need *really good* developers (the situation for folks who are trying to optimize time to market or trying to do something unusual, say a startup (vs crank out umpteen jsp pages or make minor bugfixes to a legacy app or whatever), the cost (in Bangalore) is 40 $ +. How much that "+" represents depends on a lot of factors. I've seen rates of upto 200$/hr for truly exceptional coders/projects, but that's (very very) rare. 40 $ is a good baseline.

It is VERY VERY hard to find good developers in Bangalore, just as is true elsewhere in the world. So the ability/willingness to pay the above rates does NOT guarantee you good developers. 95% of the software "industry" in Bangalore is staffed by people who shouldn't be coding. Think carefully before you spend your money in "outsourcing".

Bangalore is one of the most expensive cities (if not the most expensive city) in India. If you can find good developers in less expensive parts of India, like say Trivandrum or Bhubaneshwar you can expect to pay about 25$/hr for a really good developer and about 15$/hr for a "coding body" type. The density of good developers is much lower in such small cities, but if you can find good people, good for you.

Ok that's one question I don't have to answer by mail anymore.

Sunday, May 20, 2007

Back In Bangalore - A Ramble

After some travel (and more to come soon) I am back in Bangalore. On Saturday, I went to the Thoughtworks "MasterClass" conference. Overall this year's MC was an improvement over its predecessors, because it focussed on people who actually code on a daily basis and instead of high flown abstractions about "agile" etc , the talks were very focussed and drew on their expriences. Less "consultant speak" and more "programmer speak". Nice.

Pramod Sadalage demonstrated database refactoring. Vivek Prahlad,, author of Frankenstein, gave a competent lecture about Evolutionary Testing. Srihari Srinivasan described how his team had created a mini language ( I won't use the over abused "DSL" -- to quote Alan parsons from a comment he made on reddit "It seems anyone with 2 minutes ruby experience calls a method with a inline map, and no brackets, and calls it a "DSL" " :-) ) and then build some IDE like screens around the language. The interesting thingwas that instead of the usual ruby DSL fanboy froth, this was a very sober presentation about an "external DSL" with a proper grammar, parser etc. There was a bit of "reinventing compilers" flavour to the talk but I enjoyed it nonetheless.

Overall fairly interesting and the organization of the conference was top notch.

I thought the presentations were somewhat basic , but I was not obviously part of the intended audience. To illustrate, Vivek asked the crowd how many people had *heard of* Selenium and about 6 people (of maybe 250 or so) raised their hands! 6! Considering they are all "working professionals" that's .... scary.

I also used the conference to poll some of the best programmers in TW about what they thought of "Behaviour Driven Design". I was never very impressed with either the people or the ideas in "BDD", but Dan North seems (from his writings) like a thoughtful fellow, quite an aberration fornm the usual BDD crowd. All the people I asked, dismissed BDD with varying degrees of amusement and derision (think "that'a bull****" to "It doesn't make sense. people are just making noise").

Meanwhile here is something I thought of but can't summon the energy to do. Download JUnit, change the name of "TestCase" to "Context", the part that looks for "testXXX" methods to look for "shouldXXX" methods and "asserts" to various forms of"expect" , or.shouldDotBeDotPseudoDotEnglish methods. (With JUnit 4 one would need to hack the annotations , but the principle is the same). hey presto (almost) "BDD" on the cheap.

I've always thought "BDD" was about consultants trying to create new material out of old to write new books and get a few consulting assignments. It is good to know that most of the capable developers in TWI are equally unimpressed.

The audience questions were dumber than usual. I am not talking of questions that arise because the questioner is ignorant of the subject. Those are all right. No one knows everything. These were questions that came from not listening to what the speaker was saying. In addition, they were thinly disguised statements trying to prove that their half baked "opinions" had some technical merit. (roll eyes).

Vivek in particular handled these ultra stupid questions extremely well. His strategy (which I've noted for future use) seems to be along the order of "acknowledge the question, ignore its latent stupidity, say something useful that benefits the crowd and conclude with a "That was a good question" . I would simply have said something like "duh... is that a question or your untested opinion?" or something equally nasty.

I wish there were some kind of gathering place in Bangalore for people who actually write code, because they LIKE to write code (vs because they want to get paid). I have a suspicion not many of these idiots would attend. And the conversations would be of a higher quality.

Speaking of which, the best thing about the conference was that it enabled me to touch base with an old college mate of mine, Peter Thomas. (In college, Peter was one of the good guys while I was more .... ummm.. radical). Peter is pretty unique in that he is a manager (with an MBA from one of the top institutes in India) who gave up being a suit and is focussed on writing code. Very impressive. He is the author of JTrac and his blog makes compulsive reading. As the conference wound down, Peter I and Siddhartha hit Koshy's for some conversation over beer. We talked of code, music, wargames, etc till Siddhartha had to leave to catch his flight to Chennai.

I also managed to get a sneak peek at Thoughtworks's agile project management app, Mingle. the folks manning the booth mostly weren't developers (or at least they didn't sound like developers) so they couldn't answer some technical questions, but overall I think it's a very good attempt. If they make it free for Open Source projects (as I heard one of the TWers claim) I'll give it a whirl.

All is not sweetness and light. Now that I'm in town,I have one of those "meaning of this relationship" talks coming up with the girlfriend (a force of nature is probably a better description). Urrgh! I'll never understand women! I do NOT intend to marry anybody. do NOT! NOT! Thanks!

(end ramble)

Friday, April 27, 2007

IIT Grads ! (necessarily) == Good Programmers Redux

When I wondered some time ago why the best programmers didn't come from the population of IIT grads, many people claimed I had all sorts of motives (ranging from jealousy to fear) for having such "heretical" thoughts.

Now some other folks seem to offer a degree of vindication.

From the latest Outlook magazine (You can read the first page of the article here - I am not sure how long the url will be valid). For those too lazy to click on the link, an excerpt

What has triggered the discussion within the fraternity is the concern expressed by two distinguished IIT alumni about the general decline in standards of excellence at the institutes in recent years. Their remarks have questioned the calibre of students who make it into the IITs by subjecting themselves to the killing rigours of coaching factories in places like Kota and Hyderabad. The alumni seemed to conclude that these products of coaching factories—who now form, according to Wikipedia, 95 per cent of students at IITs—had a blinkered approach to education, did not recognise new ideas and had lost the spirit of inquiry and innovation. In short, elements that had built Brand IIT over the decades had now gone missing

The first salvo was fired by Tata Steel MD and IIT Madras alumnus B. Muthuraman. Speaking at a Ruby Union meeting of the pioneer batch organized at his alma mater in January 2007, he said that tisco was "not likely to recruit" IIT graduates any longer. He based his opinion on a recent interaction he had had with a set of final year students, who he said did not even know the authors of books they were supposed to have studied. He made many other related statements suggesting that IITs thrive only on their "past reputation" and that he actually preferred other college students who were amenable to company training.

Now before the frothing-at-the-mouth defenders descend on this blog, I am not saying that IIT grads are poor programmers. What I AM saying is that in India there is no correlation between programming ability and the school of the programmer. Any company that hires only IITians AND (boolean AND - do read this sentence carefully before sending off that hate mail) hopes to recruit impressive programming talent by doing so is asking for disaster.

An IIT is *not* Stanford or MIT or CMU. Not even close. If you doubt this, first take a look at a typical PhD paper (in say Robotics) from any IIT you choose vs say Stanford. Then tell me I'm wrong. Thanks in advance.

Tuesday, April 24, 2007

Learning From Sudoku Solvers

Ron Jeffries attempts to create a sudoku solver - here, here, here, here and here. (You really ought to read these articles. They are ummm...{cough} ...err.... enlightening.)
Peter Norvig creates a Sudoku Solver.
Compare. Learn.
Update: Discussion on reddit
somewhat peripherally related but similiar (this about the bowling game) discussion
The devgrind post
Update 2:
(Oct 2009) Peter Norvig spoke about this post in Peter Seibel's book, "Coders at Work". My reaction..
Update 3:
Peter Siebel author of "Coders at Work" weighs in. Some gems there.
"One thing I noticed, reading through Jeffries’s blog posts, was that he got fixated on the problem of how to represent a Sudoku board. He immediately started writing tests of the low-level details of a few functions for manipulating a data structure representing the 9×9 Sudoku board and a few functions for getting at the rows, columns, and boxes of the board. (“Boxes” are what Sudoku players call the 3×3 squares subsquares of the 9×9 board.)
Then he basically wandered around for the rest of his five blog postings fiddling with the representation, making it more “object oriented” and then fixing up the tests to work with the new representation and so on until eventually, it seems, he just got bored and gave up, having made only one minor stab at the problem of actually solving puzzles.
I suspect, having done a small amount of TDD myself, that this is actually a pattern that arises when a programmer tries to apply TDD to a problem they just don’t know how to solve. If I was a high-priced consultant/trainer like Jeffries, I’d probably give this pattern a pithy name like “Going in Circles Means You Don’t Know What You’re Doing”.
.....
(Norvig has) 7 definitions in 12 lines of code and he’s done with data representation. I’m not sure how much code Jeffries ended up with. In his fourth installment he had about 81 lines devoted to providing slightly less functionality than Norvig provided in the code we just looked at. In the fifth (and mercifully final) installment, he started adding classes and subclasses and moving things around but never presented all the code again. Safe to say it ended up quite a lot more than 12 lines; if he’s lucky it stayed under 120.



" Siebel's post is worth reading in its entirety.


Update 4:
Andrew Dalke's Problems with TDD (and the comments, some by eminent TDD proponents) reveal TDD's feet of clay.