Archive for the ‘random thoughts’ Category

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:

http://en.wikipedia.org/wiki/Program_synthesis

http://research.microsoft.com/en-us/um/people/sumitg/pubs/synthesis.html

http://dl.acm.org/citation.cfm?id=2594297

Advertisements

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

Evangelising web

August 14, 2007

web3

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

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

States of matter… idea?

July 2, 2007

finally after a long time, i got some time to blog… (busy with work).

finally bought a laptop and an internet connection. I did not have time to even update the book i am reading, these are pretty much like confessions, so forget it.

recently when some of my friends were talking we came across an intresting idea…

we know there are 3 states of matter, well there are more than that (like plasma etc…) for more details http://en.wikipedia.org/wiki/State_of_matter

on these lines we are trying to establish a collection of states (automata) where matter transitions from one another on some input. So far we are trying to do that with tangible/physical world. Our religions/belief systems have already put the similar theory with intangibles too. on those lines if we say idea is also a state of matter, some thing like e= mc^2 suppose idea is measured IQ and IQ = mc^x how would that be? similarly some matter would tranform into an idea and vice-versa…

I am of the opinion that blog should not become a dairy, so stopping it here, that keeps me wondering why do every one blogs, sharing nature/instinct of the human KIND?

those who do not know should ask questions……

0.999…

May 17, 2007

This number read as .9 recurring is an interesting one. .9 recurring

A wikipedia article http://en.wikipedia.org/wiki/0.999

It leaves me in awe…

If 0.999… = 1

Then what would 0.888… would be is it 0.9, it should not be coz 0.8999… = 0.9

and can 0.8(888…) can this be 0.89? if it is then what is the difference?

 

So is it 0.888… < 0.8999… < 0.9

 

So if we have a class of numbers lets say recurring terminating

0.888… < 0.888…5 < 0.888…5999… < 0.888…6 < 0.9 < 0.999…

 

This is just a vague idea, but probably we will never contemplate the outcomes of our understanding. This faintly reminds me of Gödel’s incompleteness theorems

http://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems