Re: [QuantLib-svn] SF.net SVN: quantlib:[15598] trunk/QuantLib

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-svn] SF.net SVN: quantlib:[15598] trunk/QuantLib

Luigi Ballabio

On Sep 29, 2008, at 8:00 PM, [hidden email] wrote:

> Log Message:
> -----------
> made RateHelper a real class (it was a typedef) to allow for  
> specialized interface (rate() inspector so far)
>
> Modified: trunk/QuantLib/ql/termstructures/yield/bondhelpers.cpp
> ===================================================================
> --- trunk/QuantLib/ql/termstructures/yield/bondhelpers.cpp
> 2008-09-26 17:05:55 UTC (rev 15597)
> +++ trunk/QuantLib/ql/termstructures/yield/bondhelpers.cpp
> 2008-09-29 18:00:07 UTC (rev 15598)
> @@ -82,6 +81,13 @@
>         return bond_;
>     }
>
> +    Rate FixedRateBondHelper::rate() const {
> +        QL_FAIL("not implemented yet");
> +        // some kind of conventional yield should be calculated
> +        Rate yield;
> +        return yield;
> +    }
> +

I'm not sure about this.  When one has to inhibit a method, it looks  
like a hint that maybe the interface is not general enough to go in  
the base class.  But even if this is only temporary, it is not clear  
to me what the semantics of rate() is.  In other words, how should one  
interpret the returned value when one doesn't know what specific kind  
of rate helper one's inspecting?  Are we not putting different  
specialized methods under the same umbrella in order to add them to  
the base-class interface?

If the results are needed for some kind of analysis, I'd be more  
comfortable by adding a full set of inspectors to each rate helper to  
retrieve their data, make them visitable, and use a visitor to run the  
analysis.  It would also avoid interface bloat if more results were  
needed in the future.

Luigi



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev