Dmitri Tikhonov writes: > Mortgages may compound differently -- monthly (the most common in the > USA), biweekly, or semi-annually (Canadian).
Or indeed daily: http://www.nationwide.co.uk/mortgage/homebuyers/intro.htm > The common thing between them is that there's still a fixed number of > payments. Sure. But that still sounds like it's common to all loans, not just mortgages. In the UK mortgages many also have a discounted rate for the first few years. I had one which had a discount of 1.2% points for 2 years followed by a premium of 0.8% points for 3 years (so paying out less during the first couple of years after buying a home, but making up for it in years 3-5, by which time you've hopefully got a payrise). And there are interest-only mortgages, where in theory you only pay the interest each month, leaving the main part of the debt exactly the same size, and then also pay into an entirely separate fund to build up some capital to pay off the debt at the mortgage expiry. In practice of course folks mainly seem to get the money to pay it off by suing their financial advisors for persuading them to sign such risky deals in the first place. There have been studies which showed how in the UK it is basically impossible to compare credit card rates, because every supplier has a different way of doing their calculations (and not really making public what they are). It wouldn't surprise me to find something similar going on with mortgages -- certainly I have been in the position of having a choice between two mortgages and the one with the lower rate had the higher monthly payment. > I will make the interface support all of these methods. Great. > The following web site has some formulas and derivations: > > http://www.hughchou.org/calc/formula.html That page mentions amortization, and despite its title I still don't see anything which makes it apply only to mortgages and not to other sorts of loans. Using "Loan" or "Amortize" would seem more sensible to me -- then somebody wanting to look at, say, amortized student loan payments might still think of using the module, whereas she could be put off by having "mortgage" in the name. > I guess I could do Finance::MortgageCalculator and > Finance::MortgageCalculator::US (which would be an empty subclass) and > then people could inherit from Finance::MortageCalculator and create > their own country-specific calculators. Only do that if it makes sense! You asked if anybody could see any problems, and I suggested being specific to a particular country as being a potential one. If your module isn't actually USA-specific then don't bother. My only concern was not to have a module which is only applicable in a particular country not having that as part of its name. (Note that having the ::US module as an empty subclass doesn't really solve this: you still have the problem of a module with a generic name not applying outside the USA.) > (I'd still like the word "Calculator" being present in the name. When > I look at module named "Finance::Mortgage" I think to myself -- > "mortgage *what*?") Finanace::Mortgages obviously deals with mortgages; what else could it do but calculate them? "Calculator" is a little like "Process" or "Do" or "Library" or so on: given that without any help from the name we already know this is a Perl library that does something, it doesn't really add anything. Smylers