Monday, December 12, 2005

Intent & Proze

Early versions of  Intent and Proze are out on RubyForge.

I am developing Intent to allow the expression of intents, rather than tests, whereas Proze is use to produce prose out of those intents.

I am going to write more on this, but allow me to give you an early example.  This is an excerpt of code specifying the intent of different measures of interest rates

intent_of( "Defining Financial Yield Units of Measure" ) {
    #We are using a notation, where a number is
    #followed by its unit of measure;
    #for example:
    we_ expect 0.7, to_be_equal_to_( 70.percent )
    we_ expect 0.01, to_be_equal_to_( 100.bips )
Using Proze I can produce this kind of specification from the intents:

intent of  "Defining Financial Yield
            Units of Measure"
  

    We are using a notation, where a number is
    followed by its unit of measure;

    for example:
    we  expect 0.7, to be equal to   70 percent 
    we  expect 0.01, to be equal to   100 bips 
   
    We also use some alternative names for
    the same concepts.

    we  expect 2 bips, to be a synonymous
      of 2 bps 

   
    These measures can also be used
    interchangeably with one another.

 
    consider that:

    we should  expect 2 percent,
       to be equivalent to   200 bps 


...

Now let's try something slightly tougher..
let's play with present value


intent of  "Specifying Money Currency"  
    First of all, we must be able to define Money
    we  expect 3, to be the "Money(3).amount"
    we  expect "EUR", to be "Money(3).currency"
    by default
but we  expect "USD", to be
    the "Money(3,"USD").currency" 


...

intent of  "Using Cashflows"  
    Let's now deal with cashflows

    with  Conventional discount =
          continuously compounded yield


    we  expect about 271.67748, as the
        present value of 
                  Cashflow  [
                        100 at 1 year ,
                        100 at 2 years ,
                        100 at 3 years 
                  ]    ,

        with interest rate at 5 percent  

I don't know about you, but I can read this stuff out aloud with the expectation of being understood by domain experts.


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?