<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8130703190828627205</id><updated>2011-08-01T13:21:34.002-04:00</updated><category term='interface'/><category term='templating'/><category term='generic functions'/><category term='cut-n-paste'/><category term='implementation'/><category term='updated'/><category term='OO'/><category term='update'/><category term='ocaps'/><category term='class'/><category term='perl'/><title type='text'>A Programmer's Rabbit Hole</title><subtitle type='html'>I was just trying to write some code. Then I had to think about it.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aprogrammersrabbithole.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alan Grover</name><uri>http://www.blogger.com/profile/11008964873608998336</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8130703190828627205.post-4959396560767691881</id><published>2010-10-10T15:03:00.016-04:00</published><updated>2010-10-10T16:44:30.291-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='templating'/><category scheme='http://www.blogger.com/atom/ns#' term='cut-n-paste'/><category scheme='http://www.blogger.com/atom/ns#' term='update'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Updated Cut-n-paste Templating Code</title><content type='html'>&lt;p&gt;I updated my perl &lt;a href="http://aprogrammersrabbithole.blogspot.com/2010/07/cut-n-paste-templating-code.html"&gt;cut-n-paste templating&lt;/a&gt; code.&lt;/p&gt;

&lt;p&gt;&lt;ul&gt;&lt;li&gt;No modules if you cutnpaste&lt;/li&gt;&lt;li&gt;All in one method&lt;/li&gt;&lt;li&gt;Draws from a Hash-of-things&lt;/li&gt;&lt;li&gt;Interpolate&lt;/li&gt;&lt;li&gt;Iterate&lt;/li&gt;&lt;li&gt;No "if", no "include&lt;/li&gt;&lt;li&gt;No hash-of-hashes&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;Fixes: some bugs, sigils can be escaped, array element access.&lt;/p&gt;

&lt;p&gt;And revised it a bit. Now 33 lines of perl (not counting comments/blank-lines).&lt;/p&gt;

&lt;p&gt;Get it from github (you must right-click/download or you'll just get it displayed): &lt;a href="http://github.com/awgrover/awgPerl/raw/master/cutnpaste_template.pm"&gt;cutnpaste_template.pm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll see that the file has some extra stuff in it. You can run it to process input as a template, run it to process the example template, or "use" it and call render(...).&lt;/p&gt;

&lt;p&gt;The __DATA__ template in the github file documents the full usage/behavior.&lt;/p&gt;

&lt;p style="font-weight: bold;"&gt;Example&lt;/p&gt;

Assuming data:&lt;pre&gt;
%data = (
simple =&gt; "some text",
iterate =&gt; [ { name =&gt; "Amy", pet =&gt; "Dog" }, { name =&gt; "Bob", pet =&gt; "Cat" } ],
);&lt;/pre&gt;

&lt;p&gt;Here's a simple example template:&lt;/p&gt;&lt;pre&gt;
Interpolate $simple
@iterate[I'm $name, I like $pet.]&lt;/pre&gt;

&lt;p&gt;Is there a way to use Text::Balanced to parse out the @word[...] chunks? That would make the code more compact.&lt;/p&gt;

&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Here it is&lt;/span&gt;, but I think I'll stop posting the source and let you get it from github from now on:&lt;pre&gt;# version 2: supports escaping the sigils
# version 3: supports catenation, $_ in iteration, and $0..$9 for arrays&lt;/p&gt;

use strict; use warnings; no warnings 'uninitialized';
use Text::Balanced qw(extract_bracketed);
sub render {
my ($template, $data) = @_;

my @rez;
# 1st iteration: head@name[block]rest...
# $template = "rest" for next split
# Split gives just "head" if no "@", so processes each piece
# avoid $' with a split
# We actually split on \@ or @, so we can remove the \
while (my ($head, $escape, $field_name, $block) = split(/(\\?)@([a-zA-Z]\w*|_)(?=\[)/, $template,2)) {

    # this was a \@word[..., so remove the \
    if ($escape) {
      $head = $head."@".$field_name;
      }

    # fix bracket escapes
    $head =~ s/\\\[/[/g;
    $head =~ s/\\\]/]/g;

    # interpolate scalars in the "head"
    # Have to capture the \ so we can do the right thing
    my $interp = sub {
      # escape, fieldname
      if ($1) { '$'.$2 } # escaped, so remove /
      elsif (index('0123456789',$2) &gt;= 0) {
        $data-&gt;{'_'}-&gt;[$2];
        }
      else { $data-&gt;{$2}; } # interp
      };
    $head =~ s/(\\?)\$([a-zA-Z]\w*|_|[0-9])/&amp;amp;$interp/eg;
    push @rez, $head;

    last if ! $field_name;

    # this was a \@word[..., so next on ...
    if ($field_name =~ /^\\(.+)/) {
      $template = $block;
      next;
      }

    # Get the "block" and "rest"
    my $bracketed;
    ($bracketed, $template) = extract_bracketed( $block, '[');
    $bracketed =~ s/^\[//;
    $bracketed =~ s/\]$//;

    # Repeat the block
    my $list = (ref($data-&gt;{$field_name}) eq 'ARRAY') ? $data-&gt;{$field_name} : [$data-&gt;{$field_name}];
    foreach my $sub_data ( @$list ) {
        # recurse on this block with our block's data
        push @rez, render( $bracketed, {%$data, (ref($sub_data) eq 'HASH' ? %$sub_data : ()), '_' =&gt; $sub_data});
        }
    }

join("",@rez);
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8130703190828627205-4959396560767691881?l=aprogrammersrabbithole.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aprogrammersrabbithole.blogspot.com/feeds/4959396560767691881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/2010/10/i-updated-my-cut-n-paste-templating.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default/4959396560767691881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default/4959396560767691881'/><link rel='alternate' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/2010/10/i-updated-my-cut-n-paste-templating.html' title='Updated Cut-n-paste Templating Code'/><author><name>Alan Grover</name><uri>http://www.blogger.com/profile/11008964873608998336</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8130703190828627205.post-11809927423560537</id><published>2010-07-15T16:53:00.004-04:00</published><updated>2010-10-10T16:07:49.753-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updated'/><category scheme='http://www.blogger.com/atom/ns#' term='templating'/><category scheme='http://www.blogger.com/atom/ns#' term='cut-n-paste'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Cut-n-paste Templating Code</title><content type='html'>&lt;p&gt;I needed a templating engine for a Perl script, but I couldn't install any modules, and I needed everything in one file. So, I wrote one in about 40 lines of Perl. Suitable for cut-n-paste into other projects.&lt;/p&gt;

See the &lt;a href="http://aprogrammersrabbithole.blogspot.com/2010/10/i-updated-my-cut-n-paste-templating.html"&gt;updated version&lt;/a&gt;.

&lt;p&gt;It only has to be really simple. Normally I hate having to construct a hash-of-hash-of-hashes for template engines, but the data model was also simple.&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;hash-of-hash data input&lt;/li&gt;&lt;li&gt;scalar interpolation&lt;/li&gt;&lt;li&gt;iterate on a list&lt;/li&gt;&lt;li&gt;No "if," no "include"&lt;/li&gt;&lt;li&gt;No escaping/quoting of interpolated values&lt;/li&gt;&lt;li&gt;No literal $&lt;/li&gt;&lt;li&gt;Efficient? Not very. For non-large templates.&lt;/li&gt;&lt;li&gt;Safe? Not very: interpolated values could get re-processed.
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;Key technology: Perl 5.10 and Text::Balanced::extract_bracketed.&lt;/p&gt;

&lt;pre&gt;
use strict; use warnings; no warnings 'uninitialized';
use Text::Balanced qw(extract_bracketed);
sub render {
my ($template, $data) = @_;
# replace $x with $data-&gt;{'x'}
# replace @x[...] 
#    with foreach my $x (@{$data-&gt;{'x'}}) { ... }

# repeats, 1st, recurse
my @rez;
# avoid $' with a split
while (my @repeats = split(/@(\w+)(?=\[)/, $template,2)) {
    push @rez, $repeats[0];
    last if ! $repeats[1];
    my $field_name = $repeats[1];
    # warn "During '\@$field_name'";
    my $bracketed;
    ($bracketed, $template) = extract_bracketed( $repeats[2], '[');
    $bracketed =~ s/^\[//;
    $bracketed =~ s/\]$//;
    # warn "To repeat '\@$field_name', ".@{$data-&gt;{$field_name}}." times";
    foreach my $sub_data ( @{$data-&gt;{$field_name}} ) {
        # recurse on this block with our block's data
        push @rez, render( $bracketed, {%$data, %$sub_data});
        }
    # warn "Finished '\@$field_name'";
    }

my $rez = join("",@rez);

# scalars
$rez =~ s/\$(\w+)/$data-&gt;{$1}/eg;

return $rez;
}

&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8130703190828627205-11809927423560537?l=aprogrammersrabbithole.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aprogrammersrabbithole.blogspot.com/feeds/11809927423560537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/2010/07/cut-n-paste-templating-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default/11809927423560537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default/11809927423560537'/><link rel='alternate' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/2010/07/cut-n-paste-templating-code.html' title='Cut-n-paste Templating Code'/><author><name>Alan Grover</name><uri>http://www.blogger.com/profile/11008964873608998336</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8130703190828627205.post-6554403870253396100</id><published>2009-04-01T17:15:00.003-04:00</published><updated>2009-04-02T11:33:00.163-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='class'/><category scheme='http://www.blogger.com/atom/ns#' term='interface'/><category scheme='http://www.blogger.com/atom/ns#' term='OO'/><category scheme='http://www.blogger.com/atom/ns#' term='implementation'/><title type='text'>Separate Implementation and Interface</title><content type='html'>&lt;p&gt;I&amp;#39;ve been chafing at the limitations of OO programming, particularly v-table style. And interfaces is one of the problem areas, because I want to re-use implementations.&lt;/p&gt;

&lt;p&gt;I&amp;#39;m reading &lt;a href='http://onward-conference.org/files/steimannessay.pdf'&gt;&amp;quot;The Paradoxical Success of Aspect-Oriented Programming&amp;quot;&lt;/a&gt; by Friedrich Steimann, and he talks about modularity. Parnas&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO1' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO1' title='Go look it up. What? Am I your research assistant?'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt; defined modularity as restricting the number of programmers that have to know about some implementation&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO2' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO2' title='So says Steimann. http://onward-conference.org/files/steimannessay.pdf'&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;. That&amp;#39;s right, not a textual, or language issue. A person issue. This leads Stiemann to talk about interfaces, and leads me to distinguishing interface from implementation.&lt;/p&gt;

&lt;p&gt;First, &amp;quot;class&amp;quot; should be the public-interface (the API), and inheritance should be on the basis of interfaces only. Because we want Liskov substitution&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO3' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO3' title='Complexity could be another characteristic of the interface, or any other trait about behavior.'&gt;&lt;sup&gt;3&lt;/sup&gt;&lt;/a&gt;. The interface is how you can use an object, or, if you prefer, how it behaves. Typically, the interface is a list of method signatures. There is no implementation. Interestingly, some of the functional languages define class this way (e.g. Clean, and I think Haskell). Unfortunately, while some languages like Java can support this, it is a bit tedious, though much of Java&amp;#39;s standard libraries are done this way. Even PHP has interfaces for things like the standard Array behavior.&lt;/p&gt;

&lt;p&gt;This use of &amp;quot;interface&amp;quot; is different than the historic understanding related to modules, according to Stiemann&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO4' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO4' title='Steimann[3] p. 8, footnotes 13 and 14. See &amp;quot;Gautheir &amp;amp; Pont,&amp;quot; and, of course Parnas.'&gt;&lt;sup&gt;4&lt;/sup&gt;&lt;/a&gt; (&amp;quot;class&amp;quot; being a restricted form of module). We should remember that this use is a a shorthand for &amp;quot;class interface,&amp;quot; or some such.&lt;/p&gt;

&lt;p&gt;Second, an &amp;quot;implementation&amp;quot; is a data-structure plus procedures that provide the interface&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO5' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO5' title='And, perhaps, like StdC++Lib, complexity descriptions.'&gt;&lt;sup&gt;5&lt;/sup&gt;&lt;/a&gt;. All this, I would say, in a module, since we want to localize the implementation and let other programmers be oblivious. You don&amp;#39;t inherit from implementations, though you should be able to re-use them.&lt;/p&gt;

&lt;p&gt;The StdC++Lib is built this way. If you haven&amp;#39;t studied this library (particularly the &lt;a href='http://www.sgi.com/tech/stl/'&gt;original STL documents&lt;/a&gt;), you should. Interesting that a language with poor support for the separation of interface/implementation should have the premier example. Note that part of the interface, e.g. complexity-guarantees, are not expressible in C++.&lt;/p&gt;

&lt;p&gt;Any algorithm that is polymorphic could be provided as a default implementation in the interface. For example, &amp;quot;map&amp;quot;, &amp;quot;filter&amp;quot;, and &amp;quot;foreach&amp;quot; can be written in terms of &amp;quot;fold&amp;quot; without caring about the actual data-structure. An implementation can specialize any of these algorithms for optimization, or whatever. Clean (and Haskell?) do this.&lt;/p&gt;

&lt;p&gt;Why this distinction between implementation and interface? Because, I can now do what we all want to do: re-use implementations. I believe that&amp;#39;s what 90% of OO programmers do when they use inheritance. And, they get frustrated when they want to re-use implementation, but it&amp;#39;s not compatible with class-inheritance. And, it is now clear that they are 2 different things. This separation is more natural in a multi-method language, since methods don&amp;#39;t have to belong to the class&amp;#39;s module, and polymorphic methods are more common (and easier).&lt;/p&gt;

&lt;p&gt;When I re-use implementation by common class-inheritance, I want the vast majority of the implementation to stay the same, and change a few bits of it. For example, you make Model objects by inheriting from ActiveRecord. And in one case, I needed to customize the PK behaviors.&lt;/p&gt;

&lt;p&gt;Or, more radically, haven&amp;#39;t you been tempted to use multiple inheritance to get the implementation of something (say a hash/dict) but to use it as extending a some class? I know, &amp;quot;delegation&amp;quot; or some-such is the purported solution here, but it&amp;#39;s tedious and annoying.&lt;/p&gt;

&lt;p&gt;Third, there is one more level of distinction. When an algorithm for a method is complex enough, you&amp;#39;ll naturally factor it into helper functions. Someone re-using your implementation should be able to override relevant helper-functions. And that is dangerous, because there is no agreement that the implementation is made up of so-and-so helper-functions, interacting in such-and-such an order. Our assumption is that the implementation is changeable (e.g. RoR&amp;#39;s ActiveRecord changed between versions).&lt;/p&gt;

&lt;p&gt;We need an analog of &amp;quot;interface&amp;quot; for algorithms. Which means we need something like the idea of &amp;quot;module&amp;quot; for the method and its helpers, with a declaration about behavior and what can be overridden&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO6' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO6' title='This all applies to the polymorphic methods that are the default implementations mentioned above.'&gt;&lt;sup&gt;6&lt;/sup&gt;&lt;/a&gt;. Steimann calls this the protocol, &amp;quot;the sequence in which procedures can be called.&amp;quot;&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO7' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO7' title='Steimann[3], p.8 footnote 14.'&gt;&lt;sup&gt;7&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, imagine some data from a web-form for the fields of a Model object _and_ some of its related Model objects. Highly normalized Person and Address comes to mind. So, represented as a dictionary/tree you would have something like:
        Person =&amp;gt;
                first_name =&amp;gt; &amp;quot;Bob&amp;quot;
                last_name =&amp;gt; &amp;quot;Jones&amp;quot;
                Address =&amp;gt;
                        street =&amp;gt; &amp;quot;123 Main St.&amp;quot;
                        city =&amp;gt; &amp;quot;New York&amp;quot;
                        ...
I wrote an implementation to populate Model objects from this, handling foreign-keys for the relations, etc. Naturally, it&amp;#39;s a bit more than 10 lines of code, and wants to be factored into a set of helper functions.&lt;/p&gt;

&lt;p&gt;And, naturally, there is some warped Model object that wants to mess with the algorithm. So, I&amp;#39;d like to declare what pieces of this algorithm are available (and reliable) for overriding. We already do this, of course, in documentation. Which is fine, and is the evidence for this last distinction of &amp;quot;algorithm interface.&amp;quot;&lt;/p&gt;

&lt;p&gt;Documentation and code have a hard time staying in sync, so some language support would be nice (at least annotations). Something like annotations in the interface-method, saying &amp;quot;these helpers can be tweaked, they are used in this way.&amp;quot; Essentially a description of the method. Forcing strategies (functional style) can help express this too&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO8' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO8' title='I read some blog entry on this, which I now can&amp;#39;t find.'&gt;&lt;sup&gt;8&lt;/sup&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I would like to program more using these distinctions, but most languages make it gruesome (Java, I&amp;#39;m looking at you). What disciplines/strategies have you used in a language to gain the benefit of these distinctions?&lt;/p&gt;

&lt;a href='#foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO1' name='footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO1'&gt;[1]&lt;/a&gt; Go look it up. What? Am I your research assistant?&lt;br /&gt;
&lt;a href='#foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO2' name='footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO2'&gt;[2]&lt;/a&gt; So says Steimann. &lt;a href='http://onward-conference.org/files/steimannessay.pdf'&gt;http://onward-conference.org/files/steimannessay.pdf&lt;/a&gt;&lt;br /&gt;
&lt;a href='#foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO3' name='footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO3'&gt;[3]&lt;/a&gt; Complexity could be another characteristic of the interface, or any other trait about behavior.&lt;br /&gt;
&lt;a href='#foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO4' name='footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO4'&gt;[4]&lt;/a&gt; Steimann&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO2' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO2' title='So says Steimann. http://onward-conference.org/files/steimannessay.pdf'&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt; p. 8, footnotes 13 and 14. See &amp;quot;Gautheir &amp;amp; Pont,&amp;quot; and, of course Parnas.&lt;br /&gt;
&lt;a href='#foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO5' name='footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO5'&gt;[5]&lt;/a&gt; And, perhaps, like StdC++Lib, complexity descriptions.&lt;br /&gt;
&lt;a href='#foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO6' name='footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO6'&gt;[6]&lt;/a&gt; This all applies to the polymorphic methods that are the default implementations mentioned above.&lt;br /&gt;
&lt;a href='#foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO7' name='footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO7'&gt;[7]&lt;/a&gt; Steimann&lt;a href='#footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO2' name='foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO2' title='So says Steimann. http://onward-conference.org/files/steimannessay.pdf'&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;, p.8 footnote 14.&lt;br /&gt;
&lt;a href='#foot-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO8' name='footer-note-LVMHSYDNCPIQWFLOMIWVKXCUDRLOPO8'&gt;[8]&lt;/a&gt; I read some blog entry on this, which I now can&amp;#39;t find.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8130703190828627205-6554403870253396100?l=aprogrammersrabbithole.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aprogrammersrabbithole.blogspot.com/feeds/6554403870253396100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/2009/04/seperate-implementation-and-interface.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default/6554403870253396100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default/6554403870253396100'/><link rel='alternate' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/2009/04/seperate-implementation-and-interface.html' title='Separate Implementation and Interface'/><author><name>Alan Grover</name><uri>http://www.blogger.com/profile/11008964873608998336</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8130703190828627205.post-5237358642413202356</id><published>2009-03-15T12:32:00.008-04:00</published><updated>2009-04-02T14:47:18.382-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='generic functions'/><category scheme='http://www.blogger.com/atom/ns#' term='ocaps'/><category scheme='http://www.blogger.com/atom/ns#' term='OO'/><title type='text'>OO Terminology, or V-Tables Are So 1980</title><content type='html'>&lt;p&gt;What should be a focused idea will often lead me to some major
(essential) digressions in fundamentals. For example, while writing
notes for a small essay&lt;a href='#footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH1' name='foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH1' title='An essay on managing capability-security-model graphs when trying to share data: e.g. the file-system. Aka &amp;quot;Deep Attenuation.&amp;quot;'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt;, I had to think hard about a couple of
things, one of which was the idea of objects. I have spent some effort
over the years trying to understand what OO really means, and thought I
had a good handle on it&lt;a href='#footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH2' name='foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH2' title='I thought I had identified all the orthogonal pieces of OO.'&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The capability-security-model uses objects&lt;a href='#footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH3' name='foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH3' title='Name change claimed by http://c2.com/cgi/wiki?ObjectCapabilityModel as of 2009.03.03'&gt;&lt;sup&gt;3&lt;/sup&gt;&lt;/a&gt; (and is now properly known
as the object-capability-model, aka ocaps), and the issue I was exploring lead
me into some difficulties. I have a prejudice for generic functions, and
thus the separation of type and behavior&lt;a href='#footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH4' name='foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH4' title='Cf. the dualism of single-dispatch vs generics and monkey-patching...'&gt;&lt;sup&gt;4&lt;/sup&gt;&lt;/a&gt;. Simula-like (e.g. Java)
languages package the two together. I found it easy to think about ocap
issues with Simula-like objects, but confusing with generic methods.&lt;/p&gt;

&lt;p&gt;I wanted to use the correct terminology in my notes, and ultimately in
any resulting writings. That would help me keep the ideas straight, and
my readers wouldn&amp;#39;t have to decode my private language. However, I
believed that the current usage was terribly confused.&lt;/p&gt;

&lt;p&gt;Specifically, the popular understanding of &amp;quot;class&amp;quot; is wrong, and makes
it difficult to talk about generic functions. I managed to restrain my
impulse of correcting the wayward and imposing my meanings. I tried to
look it up.&lt;/p&gt;

&lt;p&gt;Apparently, Armstrong, &amp;quot;The Quarks of Object-Oriented Development&amp;quot;&lt;a href='#footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH5' name='foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH5' title='See http://wiki.gsi.de/pub/Personalpages/RootTips/RClasses_2.ppt, and http://portal.acm.org/citation.cfm?id=1113040.'&gt;&lt;sup&gt;5&lt;/sup&gt;&lt;/a&gt;,
thinks OO means Simula-like objects, and wants &amp;quot;class&amp;quot; to mean
type+methods. I believe this is a typical hierarchical approach to
definitions, and I&amp;#39;ve found it more fruitful to consider orthogonal
elements. Armstrong&amp;#39;s apparent archetype is only one popular assemblage
of the elements.&lt;/p&gt;

&lt;p&gt;Rees, &amp;quot;JAR on Object Oriented&amp;quot;&lt;a href='#footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH6' name='foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH6' title='See http://mumble.net/~jar/articles/oo.html'&gt;&lt;sup&gt;6&lt;/sup&gt;&lt;/a&gt;, takes the orthogonal, or chinese-menu
approach of definition and slyly notes that the Simula-style OOP is
impoverished, yet widely considered the definition&lt;a href='#footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH7' name='foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH7' title='If you only know Simula-style OOP, you are hereby required to prefix all of your mentions of OO with &amp;quot;Simula-style&amp;quot; or &amp;quot;v-table hack style.&amp;quot;'&gt;&lt;sup&gt;7&lt;/sup&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On c2.com, there is a lovely concept to bring in focus the meaning of
OO: &amp;quot;that an expression in a program, consisting of a function
identifier and one or more arguments, can stand for multiple
implementations.&amp;quot; Similarly, &amp;quot;the basic idiom is to identify an object
and then act upon it,&amp;quot;&lt;a href='#footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH8' name='foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH8' title='The author of that statement intended it to contradict the previous quote, but I see them as equivalent: &amp;quot;coherent objects that interact .... The rest is stylistic elaboration.&amp;quot; http://c2.com/cgi/wiki?DiscussAlternateObjectOrientedProgrammingView, as of 2009.02.15'&gt;&lt;sup&gt;8&lt;/sup&gt;&lt;/a&gt; though that excludes multi-dispatch.&lt;/p&gt;

&lt;p&gt;There seems to be a conflict between two camps: the v-table crowd
(C++/Java) which tends to be reactionary (&amp;quot;that&amp;#39;s not OO!&amp;quot;), and the
crowd with wider experience (e.g. CLOS) that sees the v-table style as a
special, and impoverished case. In the professional community, the
v-table crowd dominates to the point of exclusion.&lt;/p&gt;

&lt;p&gt;So, while there is some support of the taxonomies I prefer (cf. &amp;quot;wider&amp;quot;
above), nobody will understand me if I use it. I&amp;#39;ll have to use the
popular definitions and complicate the explanation by qualifications and
exceptions. And, probably have side-bars to explain multi-methods, etc.&lt;/p&gt;

&lt;p&gt;I haven&amp;#39;t found a good entre into the academic discourse, nor do I want
to read pointless, hyperfocused papers on irrelevant minutiae.&lt;/p&gt;

&lt;a href='#foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH1' name='footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH1'&gt;[1]&lt;/a&gt; An essay on managing capability-security-model graphs when trying to
share data: e.g. the file-system. Aka &amp;quot;Deep Attenuation.&amp;quot;&lt;br /&gt;
&lt;a href='#foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH2' name='footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH2'&gt;[2]&lt;/a&gt; I thought I had identified all the orthogonal pieces of OO.&lt;br /&gt;
&lt;a href='#foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH3' name='footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH3'&gt;[3]&lt;/a&gt; Name change claimed by &lt;a href='http://c2.com/cgi/wiki?ObjectCapabilityModel'&gt;http://c2.com/cgi/wiki?ObjectCapabilityModel&lt;/a&gt;
as of 2009.03.03&lt;br /&gt;
&lt;a href='#foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH4' name='footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH4'&gt;[4]&lt;/a&gt; Cf. the dualism of single-dispatch vs generics and monkey-patching...&lt;br /&gt;
&lt;a href='#foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH5' name='footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH5'&gt;[5]&lt;/a&gt; See &lt;a href='http://wiki.gsi.de/pub/Personalpages/RootTips/RClasses_2.ppt'&gt;http://wiki.gsi.de/pub/Personalpages/RootTips/RClasses_2.ppt&lt;/a&gt;, and &lt;a href='http://portal.acm.org/citation.cfm?id=1113040'&gt;http://portal.acm.org/citation.cfm?id=1113040&lt;/a&gt;.&lt;br /&gt;
&lt;a href='#foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH6' name='footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH6'&gt;[6]&lt;/a&gt; See &lt;a href='http://mumble.net/~jar/articles/oo.html'&gt;http://mumble.net/~jar/articles/oo.html&lt;/a&gt;&lt;br /&gt;
&lt;a href='#foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH7' name='footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH7'&gt;[7]&lt;/a&gt; If you only know Simula-style OOP, you are hereby required to prefix
all of your mentions of OO with &amp;quot;Simula-style&amp;quot; or &amp;quot;v-table hack style.&amp;quot;&lt;br /&gt;
&lt;a href='#foot-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH8' name='footer-note-WSOUHDHYBIKVBTRCKWVHVLTOPUTBGH8'&gt;[8]&lt;/a&gt; The author of that statement intended it to contradict the previous
quote, but I see them as equivalent: &amp;quot;coherent objects that interact
.... The rest is stylistic elaboration.&amp;quot;
&lt;a href='http://c2.com/cgi/wiki?DiscussAlternateObjectOrientedProgrammingView'&gt;http://c2.com/cgi/wiki?DiscussAlternateObjectOrientedProgrammingView&lt;/a&gt;, as
of 2009.02.15&lt;br /&gt;
&lt;p&gt;References
&lt;a href='http://en.wikipedia.org/wiki/Object-oriented_programming'&gt;http://en.wikipedia.org/wiki/Object-oriented_programming&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8130703190828627205-5237358642413202356?l=aprogrammersrabbithole.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aprogrammersrabbithole.blogspot.com/feeds/5237358642413202356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/2009/03/what-should-be-focused-idea-will-often.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default/5237358642413202356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8130703190828627205/posts/default/5237358642413202356'/><link rel='alternate' type='text/html' href='http://aprogrammersrabbithole.blogspot.com/2009/03/what-should-be-focused-idea-will-often.html' title='OO Terminology, or V-Tables Are So 1980'/><author><name>Alan Grover</name><uri>http://www.blogger.com/profile/11008964873608998336</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
