Test Driven Program Synthesis

July 9, 2014

The idea of generating a program has been around for quite some time.

Now there are IDE’s which can create the scaffolding code so that programmers need to fill in just the application logic.

What I am thinking is little math and little of code generation. I am trying to link 2 different concepts

  1. Newton–Raphson method (http://en.wikipedia.org/wiki/Newton’s_method): briefly this helps us approximating a function (f) by  going over a given set of x and f(x). the more the set of x -> f(x) the more accurate our f will be.
  2. TDD (http://en.wikipedia.org/wiki/Test-driven_development): here we have a set of tests and we write code so that the tests pass, test is an input/output mapping like x -> f(x)

Clubbing them together:

can we use both of these together to generate the function (f) ?

one issue would be that newton-raphson method works on real numbers, and we can say our functions work on byte arrays or strings.

for this can we map a string to a real number so that test cases are converted from string -> f(string) to x -> f(x)


some links to read further:





circle of life (a short story)

January 31, 2014

two people

jeevan — 30 yrs, well groomed.

buddha — 65 yrs, with untidy shirt and a sweaty face

both boarded a train in a small village.

buddha: where are you heading?

jeevan: this train goes to only one place

budha: that does not answer my question, anyways, what do you do for living

jeevan: hmm.. i work as a teacher in nearby school

budha: this train is always late

jeevan: hmm…

buddha: these untimely rains cause lot of trouble

jeevan: hmm…

buddha: so you are going to visit your relatives?

jeevan — ignores the question

buddha: by talking to each other our destinations becomes closer

jeevan: it seems you are as persistent as me. I concede, probably this is the last conversation i will have honestly.

i am not visiting any relatives

buddha: that will be good, so i am curious to know the purpose of this trip

jeevan: purpose? that is a nice word. purpose of any journey is the journey itself and not destination. do you really want to know the purpose of my journey? or you just want to know the destination i want to reach?

buddha: i would choose both if that is an option

jeevan: interesting, for this journey of mine, both purpose and destination are same and that is end of life.

buddha: not clear, are you trying to hint that we are going to die in this journey?

jeevan: no, to be more precise i am saying that my destination is death and that is purpose too.

buddha: that is baffling, you seem too young to die of any disease, why would death be the destination?

jeevan: that is by my own choice, i want to commit suicide. my plan is to eat sleeping pills after dinner at around 8:15 pm and go and sit at gate around 8:30 pm, this train reaches a valley around 8:45 pm, and because of the effect of pills i will fall into the valley and no one would even notice anything.

buddha: shocked, you seem to have planned a lot for this, why would one plan such a thing so meticulously? why not other simple methods?

jeevan: as it is the reason that satisfies human mind of any existence, i have a reason for this too. it is a long one, you really want to know?

buddha: yes

jeevan: i was a child labour in firework manufacturing company, i was once rescued from there at the age around 7. then i boarded train first time to reach ashram. i felt that like my journey into life. it was my start of life. so i want to end it a similar journey. from oblivion to life and from life to oblivion.

also regarding the method, this i think is the most painless and un-obtrusive method.  also no one would know the difference.

buddha: what would be the reason of this choice?

jeevan: well this is the only choice i am left with

buddha: why you have any problems ? love failure? cash crunch?

jeevan: no.

buddha: you seem intelligent and young enough not to die, why would you opt for such a drastic choice

jeevan: i think, youth is a metric against death just because of social convention.

buddha: you are intriguing, why would you choose death over life? abrupt end to life should not be anyone’s choice, are you having any problems?

jeevan: regarding the end of life, death is not just an end to life, it is completion of life. my choice of death over life is not due to any problems, i think i have lived a contented life and i would like to exercise the choice  which no one exercises.

buddha: all problems can be solved or can be made peace with, one should not choose to escape problems by choosing death, that choice is cowardice, instead of facing, you are escaping

jeevan: i am not escaping any of the problems, i don’t have any of them.

buddha: if not problems, life always has store excitement. why not choose life because of it.

jeevan: life is exciting just because of presence of death at the end. otherwise life would be really boring.

buddha: it seems you are abruptly stopping reading of the book called life, there are so many pages pending to be read.

jeevan: that is a good analogy, but  i think i am a fast reader and completed the book. another analogy is, i have bought ticket to this circus, i have seen all the shows and want to leave now.

you on the other hand seems to be hanging around and watching the shows repeat themselves. you would prefer to be escorted out instead of leaving on your own.

buddha: that is a nice analogy too, i would prefer staying in the circus enjoying the shows as long as someone is not pushing me out of it.

jeevan: precisely, many people would not make that choice to leave the circus and many make the choice for wrong reasons.

buddha: hmm… are you married?

jeevan: no

buddha: in that case i would suggest that you should get married and raise kids, that is like whole new chapter that you have not read.

jeevan: i have read that chapter, but not the same way as you proposed, i have raised kids, adopted a few , took care of them for some time.

buddha: you mean to say you have tried everything in life and now you just want to end it?

jeevan: something like that

buddha: there might be some things new in store for you, why are you not allowing them to happen?

jeevan: that logic is not good enough, that is like tautology that “there might be some thing new in store for you”. you know even people who are dying naturally, will just accept death at least in the last moment, not fight against it. i want to do that now when i am not helpless.

buddha: will try another argument against your thought, if you think you have everything and nothing gives you a high (that life gives). why not dedicate your life to others, life is a resource and it is foolish to waste it.

jeevan: i was a teacher, so in a way i have done what you are suggesting. interesting perspective about life as a resource, i would like to agree it as a resource. if it is the resource who is the owner of it? i would like to be owner of my own life and hence choosing how much to use of it.

buddha: hmm… you think you are free to choose ? don’t you think that there is an implicit responsibility that you live and contribute to society so that overall it makes some progress.

jeevan: that is a nice point, how many do you think will contribute to society’s progress? wouldn’t be very less? most of us take more than give. in that way not taking is also a contribution.

jeevan: tell me about your story, where are you going?

buddha: i have come here to sell off a land i have so that i can start something in the city i had a son who has ditched me, so i am starting my life all over again. isn’t choosing the un-known a more bold choice?

jeevan: yes, in a way it is, but unknown repeats itself after some time.

buddha: hmm… i want to use the money to start some business, my aim is to give livelihood to some others. i think i have failed raising my kid. want to try out raising someone else again.

jeevan: what if you fail in that too?

buddha: that is the beauty of life, you are not lost unless you give up, i will try something else. if i succeed, i will choose a tougher problem, if i fail i will choose an easier problem. that journey is pleasurable in itself irrespective of the outcomes.

jeevan: hmm… we have talked a lot, lets have dinner and go to BED.

buddha: i have got some spicy chicken and rotis, would you like to taste?

jeevan: sure, i have some salad lets share that too.

dinner is completed, jeevan takes out the sleeping pills, buddha asks that can he share that too. they both share it as well. jeevan goes into deep sleep in no time. he wakes up in the morning with briefcase and a letter near him.

BUDDHA’s letter:

you are as persistent as me,  i concede, i think just because of the lifetime of the resource called life. it is optimal that you should live some more years and i should release my own.

your arguments convinces me, but i want my stand convinces you to contradict your stand.

the briefcase contains some cash, i would like to consider that you have ended your life in theory and i have ended mine practically. but if possible, live my life in practice, use this to start some thing which will benefit others.

if not for the above logic sake, just live another decade to fulfill a dying man’s last wish.

if ( programmer version)

March 18, 2013

if you can write code and debug it
if you have not written but can debug
if you can visualize multiple threads and their execution

if you can treat bugs and optimization opportunities same and spend equal effort on both
if you can debug issue for days together without any progress
and still don’t give in but focus and spend more time to make some progress

if you can accommodate change requests and not get frustrated by it
if you can change your/not your’s code without any request but for beautifying it further
if you can feel less about bugs in code but as much as you would not repeat it

if you can treat PM(product manager),QE and your self as equal
and treat all of their suggestions with some importance
but not to give in completely for the whims and fancies of others

air deccan web site woes

November 18, 2007

I had few recommendations (to put them softly) to the air deccan guys regarding their web site. I found a place to send them feedback. But it says it will use my mail program to send them as email, which i do not have installed on my machine. So i am putting them down here If they will find and fix that will be great else some one who reads can be careful about these.

1. previously when i login all my history of booking used to be shown, so that i do not have to remember any thing. Now I can not see my bookings, so to get a ticket i have to remember my pnr number

2. this is very important: when i tried to reschedule my booking, it accepts payment only by credit card (the booking was made using debit card). Also the credit card information is submitted via http not even https

3. If i want to submit them feedback i need to have some mail client, which luckily i do not have so atleast i have one article in my blog.

I do not understand why they ignore their web site so much where as the ROI on that would be huge, they need to spend less money per ticket if the booking is via web. But still many people ignore that. Also web site is face of your company so better have a simple user friendly one then a jazzy advertisement gimmick.

All you guys out there Please do not compromise credit card numbers in http sites. here the ordinary booking is via https but i think the rescheduling was ignored/forgotten.

What consumes my Time

November 5, 2007

I would like to inspect where do i spend most of time…

1. 10-12 hours goes in work…

2. 1-2 hours reading rss feeds

3. eating  1-2 hours

4. rest of time resting sleeping etc…

It is good that i have made a habit of reading blogs, you feel more connected to the world.

I would like to mention on blog which is good and getting better http://weblog.raganwald.com

Also these days indian stock market is doing great, seeing those figures give a different kind of high.

I think as it is suggested to have a portfolio that is diverse in order to reduce the risk, I think your work and activities comprise work portfolio, It is alway good to have them diversified.

Since obstacles/failures are in-evitable and when u have failure in one path u can spend some time on other part of the portfolio. this really eases risk of succumbing to the work wounds 🙂

It will take a long time for me to write some good blog, but till then…. this is oneof my goal… 🙂

gwt form submit mac safari problem

October 13, 2007

This is one nice problem, we at our work observed…

we are creating a web app using gwt, which has a form which has a submit button, onclik of that some validations are done and if successful form is submitted if failed the submit event is cancled.

interestingly this is not working on mac safari, the form gets submitted even if canceled the event explicitly.

The work around we are using is to keep that button out of form and doing submit explicitly.

just wondering what could be the problem..

is the way js is executed in safari different? but it uses the same engine as firefox on which it works

the threading model of the browser could have such an effect? do not know much about it

any ways this I just put it up here so that at least some workaround can be found by people. will update here once know a solution or more information regarding this.

Usability vs Functionality

October 13, 2007

First I must admit the power of entropy, It’s been a long time since I have not updated this, I have not done so many other things which I wanted. Well busy is the excuse I prefer to use 🙂 for now.

For now lets see which one is more important than the other.

I my self am a developer, so my brain is some how trained to appreciate the Functionality than Usability . The example would be I liked spending time to understand the remote of the high end tele-vision which would be one of the least usable gadgets. Where as on the other hand I spend a lot of time on ipod which does not have much functionality.

But like every other debate, this also has several points supporting both sides. Slowly now my scales are tipping towards the usability. Almost all biz opportunities are solving usability issues now a days. I would say 60% usable and 40% functional would be good.

Evangelising web

August 14, 2007


the web with its ever increasing bandwidth and availability, the way it is used has to be changed.

I foresee,

  1. copy-paste kind of functionality at least in java script or web browser so that we will not download/upload we will only copy/paste
  2. ip-tv will be pervasive
  3. services like anti-virus and data back-up will become more reliable/available on internet
  4. internet will become aware of biometrics, so the online security paradigm will change as a whole

reminiscences of independence day celebrations

August 14, 2007
  • primary school– njoying the celebrations at school and the sweets that were distributed
  • secondary school– little bit of revolt on why we have to come to school even on this day
  • college– rebellion watch movies, hangout with friends probably celebrate with beer
  • now– ???

looking back at this pattern as awareness grew the celebration lost it’s charm
now i can conceptualize independence and freedom better than in my childhood days and that brings me to some inferences

  1. independence is impossible we are all interdependent
  2. freedom at a philosophical level is always there
  3. freedom at a physical level is not there
  4. freedom at political level never used
  5. freedom at social level rarely used

After all this I still am impressed with all the freedom-fighters and the entire movement. they were more committed in solving their problem compared to people today. now a days problems don’t get solved much they are transmitted.

I still do not understand why we celebrate independence day when it was freedom movement and freedom fighters were involved (some where some discrepancy).

probably as a whole India wins independence and each of its citizens wins freedom?

This is one amazing video a friend has referred to me on youtube

Satisifaction matrix

July 19, 2007

this is a small idea on basis of satisfaction levels of you and your superior, here by the word superior i mean your work is delivered to him/her and it is at his/her disposal. There are 4 possible combinations and the logical out come of these combinations according to me are the following…

  • u are satisfied and u r superior is not — learning opportunity
  • u r satisfied and u r superior is also satisfied — take up more responsibility
  • u r not satisfied and u r superior is satisfied — job switch on cards
  • u r not satisfied and u r superior is not satisfied — career switch