When oh when will someone come up with inheritance examples that aren't based on geometry or phylogenetics.

About twenty years ago I worked on a system written in C++ that dealt with various financial instruments (fixed term deposits (with fixed or variable interest rates), stocks, bonds, options, futures and all that financial soup). The original architects had decomposed the different instruments into distinct classes (class Bond, class Option and so on).

Sadly, they completely missed the concept of ISA hierarchies. A lot of these instruments build on existing things, with an added twist. Yet the architects had merely cut'n'pasted code from class to another, for things like yield and amortisation calculations. Which meant that you had to chase down similar bugs in many similar classes.

Having learnt object-oriented programming a few years previously with such toy examples as decried by BrowserUK, it struck me that here was a real world example that was easy to explain, easy to code, produced tangible results and probably one of the few textbook cases where true inheritance hierarchies really make sense (insofar as compositional has-a architectures are much more frequent).

Fortunately enough for me, I left the project and moved on to greener pastures, and since then I have managed to forget just about everything I had learnt about the subject, but someone who has kept up with the field should be able to produce a simple example to demonstrate the basic concepts.

• another intruder with the mooring in the heart of the Perl


In reply to Re^2: Perl 6 shocking revelations #1 by grinder
in thread Perl 6 shocking revelations #1 by John M. Dlugosz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.