Kurt StephensNerd Up! | ||
Data Transform Programming StyleKurt on Sun, 2006-10-22 22:26.
Data Transform Programming Style is somewhere between imperative and functional programming. Data representations flow towards the desired result, from least expressive to most expressive. This allows greater reuse of code on multiple data representations, greater locality of intent and more literal coding. The nested nature of functional application is flattened into an imperative style that reads more like pseudo-code, while retaining functional elements. Imagine a Perl program that takes a list of URIs and turns them into HTML <a href> tags:
# Imperative Example 1:
sub format_uri_as_html
{
my ($uri) = @_;
$uri = qq{<a href="$uri">$uri</a>};
$uri;
}
my $uris = [
'http://kurtstephens.com',
'http://google.com',
'http://digg.com',
];
print map(format_uri_as_html($_) . "\n", @$uris);
Simple imperative programming; we side-effect Now requirements change… |
||
Recent comments
2 weeks 4 days ago
7 weeks 3 hours ago
17 weeks 3 hours ago
18 weeks 4 days ago
20 weeks 6 days ago
20 weeks 6 days ago
24 weeks 1 day ago
24 weeks 1 day ago
26 weeks 11 hours ago
26 weeks 4 days ago