The source content for blog.juliobiason.me
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.9 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- Enable responsiveness on mobile devices-->
<!-- viewport-fit=cover is to support iPhone X rounded corners and notch in landscape-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, viewport-fit=cover">
<title>Julio Biason .Me 4.3</title>
<!-- CSS -->
<link rel="stylesheet" href="https://blog.juliobiason.me/print.css" media="print">
<link rel="stylesheet" href="https://blog.juliobiason.me/poole.css">
<link rel="stylesheet" href="https://blog.juliobiason.me/hyde.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
</head>
<body class=" ">
<div class="sidebar">
<div class="container sidebar-sticky">
<div class="sidebar-about">
<a href="https:&#x2F;&#x2F;blog.juliobiason.me"><h1>Julio Biason .Me 4.3</h1></a>
<p class="lead">Old school dev living in a 2.0 dev world</p>
</div>
<ul class="sidebar-nav">
<li class="sidebar-nav-item"><a href="&#x2F;">English</a></li>
<li class="sidebar-nav-item"><a href="&#x2F;pt">Português</a></li>
<li class="sidebar-nav-item"><a href="&#x2F;tags">Tags (EN)</a></li>
<li class="sidebar-nav-item"><a href="&#x2F;pt&#x2F;tags">Tags (PT)</a></li>
</ul>
</div>
</div>
<div class="content container">
<div class="post">
<h1 class="post-title">Things I Learnt The Hard Way - Not Just Function Composition, But Application Composition</h1>
<span class="post-date">
2019-07-15
<a href="https://blog.juliobiason.me/tags/books/">#books</a>
<a href="https://blog.juliobiason.me/tags/things-i-learnt/">#things i learnt</a>
<a href="https://blog.juliobiason.me/tags/composition/">#composition</a>
<a href="https://blog.juliobiason.me/tags/applications/">#applications</a>
</span>
<p>When we were discussing <a href="/books/things-i-learnt/magical-number-seven">the magical number
seven</a>, I mentioned that it made
more sense to actually call the functions in sequence instead of each calling
the next. That's basically a &quot;function composition&quot;, one thing you can also do
with your applications.</p>
<span id="continue-reading"></span>
<p>Unix came with the idea of &quot;applications that do one thing and do it well&quot;.
And then you could just pick the output of one application and plug it as
input of another (and then plug the output of the second into a third, and so
on).</p>
<p>Also, I mentioned that you could use <a href="/books/things-i-learnt/config-file">configuration
files</a> to do the same processing over
different source elements (based on a configuration, that is) instead of
writing an application that would process both in a single shot.</p>
<p>One problem with that approach is that you may need <em>both</em> results to actually
produce a usable result (for example, how would you build a list of common
followings of two Twitter users if you don't have both lists?).</p>
<p>That problem can easily be solved if you write a different application that
just receives both lists and compare them. That would greatly simplify your
general codebase 'cause instead of one massive codebase with lots of moving
pieces, you'd have two small codebases, with less moving pieces. One could
still break the other -- say, if you or someone else changes the result of the
first function -- but you will still get the results of the first without
missing the whole 'cause the second is breaking.</p>
<p>PS: I reckon it's really hard to create application composition with graphical
applications (why would you ask your user to have <em>two</em> applications open at
the same time to make something work?) but you can extrapolate this for almost
everything else.</p>
<div>
<div style="float:left">
&lt;&lt; <a href="&#x2F;books&#x2F;things-i-learnt&#x2F;command-line-options">Command Line Options Are Weird, But Helpful</a>
</div>
&nbsp;
<div style="float:right">
<a href="&#x2F;books&#x2F;things-i-learnt&#x2F;app-composition-stupid">Even for Application Composition, Start Stupid</a> &gt;&gt;
</div>
</div>
</div>
</div>
</body>
</html>