Although I think Perl might not be the most ideal language for discussing OOP, I would be *very* interested in seeing the ideas in this chapter expressed as Perl scripts (preferably objects). That way some of your assertions can be demonstrated so that those of us who struggle with the abstract concepts here can see a concrete example, rather than trying to form our mental image only from words and diagrams.
To that end, you should build as concise a Machine::Turing class as you can, maybe with some very simple methods:
- initialize: accepts a reference to a list to be used as a tape
- cycle: performs one cycle in the machine
- state: so that we can find the tape position, and maybe the result of the last write
With just these three methods I think you would clearly capture everything we want to be able to do with a Turing machine, and you'd have an opportunity to introduce some idiomatic OOP scripting right away. Also, then when you state that we can do anything with multiple Turing machines that we can do with one, you might be able to demonstrate that. You would also be able to show how the Machine::RandomAccess class would look in comparison.
And in this way your conclusion, that all objects are simply Turing or random access machines, is even easier to bear out-- as you can then point to the characteristics that all objects have in common with your example implementations of these two machines (and therefore with the abstract ideas that those Machine::* classes represent).
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.