<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by David MacCallum on Medium]]></title>
        <description><![CDATA[Stories by David MacCallum on Medium]]></description>
        <link>https://medium.com/@davidjohnmaccallum?source=rss-15ea3b7c8589------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*dgP_bCP2-l0tZcZO4SC1RA.jpeg</url>
            <title>Stories by David MacCallum on Medium</title>
            <link>https://medium.com/@davidjohnmaccallum?source=rss-15ea3b7c8589------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 00:10:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@davidjohnmaccallum/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Software that is easier to change]]></title>
            <link>https://medium.com/@davidjohnmaccallum/software-that-is-easier-to-change-dcd673edbde1?source=rss-15ea3b7c8589------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcd673edbde1</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[David MacCallum]]></dc:creator>
            <pubDate>Sat, 03 Oct 2020 15:41:47 GMT</pubDate>
            <atom:updated>2020-10-03T15:42:47.216Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xjDepTcwGyJFaOBS" /><figcaption>Photo by <a href="https://unsplash.com/@gpthree?utm_source=medium&amp;utm_medium=referral">George Pagan III</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Software tends to become more difficult to change over time. When this happens the software cannot keep up with the evolving requirements of the business and ultimately requires a big expensive version two project. What can we do to make software easier to change?</p><h3>Nice obvious seams</h3><p>Module boundaries should be obvious. A developer should have no trouble seeing that the system is composed of modules, what the modules are responsible for and where the module boundaries lie. This should be clear from the system documentation and also from looking at the organisation of the source code. This immediately makes the task of changing the system easier, because you don’t need to understand the entire system, just the relevant module.</p><p>A module boundary is like an implicit contract. Anything that the module exposes publicly to the rest of the system must not change if we are to avoid impacting the rest of the system. A helpful pattern from SOA is the Service (ie module) Definition Document. This document tells us the business reason for the module and it clearly defines the interface that this module presents to the rest of the system. I think every module should have a module definition. This can be a documented in comments at the top of the module. Taken together, the module definitions should form a comprehensive set of documentation for the system.</p><h3>Database considerations</h3><p>One challenge is that there are so many ways to get around module boundaries. Most programming languages have the ability to hide implementation details and present only a subset of functions as a public interface to the rest of the system. Very often this does not extend to the database however. The database becomes a set of global variables without any clarity on which module owns which table or which tables should be considered private and which public.</p><p>You should apply the same principles of information hiding to the database as you do to your code. Certain tables are actually private implementation details of a modules. They should not be accessible to other modules. You can use database access rules to enforce this. Other tables are part of the public interface, or contract, of the module. You can think of these as interface tables. These tables must be clearly documented in the module definition.</p><p>Remember to apply the same approach to reports. A SQL report created with a reporting tool can easily create hidden dependencies because the reporting tool often does not follow the same development workflow as the rest of the system.</p><h3>Module that make business sense</h3><p>A system that is modularised in a way that makes sense to the business (eg sales, fulfilment, inventory) will be easier to change when the business changes. The inverse is also true. A system that is modularised along technical lines (eg view layer, data access layer) will be easier to change when technology changes (eg creating a new view for mobile displays). This is not an either-or. You can define module boundaries along business lines and at the same time use layers within your modules to separate view and data access.</p><h3>Conclusion</h3><p>If a system is clearly modularised. If modules have a clear contract with the rest of the system. If they do not have hidden side effects like using the database to modify data that other modules depend on. And if modules are aligned with business functions this will make a system easier to change down the road.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcd673edbde1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Travelling light. JavaScript for enterprise software development.]]></title>
            <link>https://medium.com/@davidjohnmaccallum/travelling-light-javascript-for-enterprise-software-development-737699922202?source=rss-15ea3b7c8589------2</link>
            <guid isPermaLink="false">https://medium.com/p/737699922202</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[David MacCallum]]></dc:creator>
            <pubDate>Wed, 30 Sep 2020 15:18:50 GMT</pubDate>
            <atom:updated>2020-09-30T15:18:50.576Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScript is not a popular choice for enterprise software development in South Africa. This is unfortunate because JavaScript is ideally suited to the rapid pace of change of the modern world. The key to unlocking the benefits of JavaScript on the backend is a microservice architecture.</p><h3><strong>Change is not a constant. It’s accelerating.</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B-uYtEG0rIrNgJar" /><figcaption>Photo by <a href="https://unsplash.com/@veri_ivanova?utm_source=medium&amp;utm_medium=referral">Veri Ivanova</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Imagine a company that invests millions on a cutting edge IT system to gain a competitive advantage. A few years later the business is calling it a legacy system because it is preventing the business from adapting to change. The problem is not that the system was badly designed or poorly built. <strong>The problem is that the system was not able to adapt to change.</strong></p><p>Albert Toffler’s book <a href="https://www.amazon.com/Future-Shock-Alvin-Toffler/dp/0553277375">Future Shock</a> speaks about the unprecedented acceleration on change in modern life. For example: Think of history as a series of 800 lifetimes. The first 650 of them were lived in caves. Only in the last 60 lifetimes did we have writing. Only in the last 7 lifetimes did the printing press make written information generally available. Only in the last 3 lifetimes did we have electric power. Only in the last 1 or so lifetimes did we have computers.</p><p>Another example: For nearly 3600 years the fastest way to travel long distance was a chariot at 20mph. It was only 140 years ago that the steam train broke that record travelling at 100mph. Today jet planes can travel at 4800mph.</p><h3>The rise of modularism</h3><blockquote>“Modularism may be defined as the attempt to lend whole structures greater permanence at the cost of making their sub structures less permanent.”</blockquote><blockquote>Albert Toffler, Future Shock</blockquote><p>I recently interviewed for a job with a company looking to move to a microservices architecture. They have a monolithic system doing electricity metering which, quite frankly, works fine. <strong>The problem, they said, is that it takes months for new developers to get up to speed on the system.</strong></p><p>Modular software design is nothing new. What is new is the ability to easily package modules into lightweight containers using Docker. This has give the microservice architecture style a real boost.</p><blockquote>“A structure is stable if cohesion is strong and coupling is low.”</blockquote><blockquote>Constantine’s Law, Larry Constantine</blockquote><p>Docker containers alone are not enough to deliver the benefits of modularisation. To make modules easy to replace you have to take Constantine’s Law seriously. In fact, if you do, <strong>you can build effective modular software in a monolithic style too. What containers do is make it a bit harder to couple components together</strong>, <strong>a barrier to coupling, </strong>which forms a natural safeguard against violating this law. If you don’t take this law seriously and build a tightly coupled microservice system you are asking for trouble.</p><h3>Travel Light</h3><blockquote>“To survive amidst the uncertainties of rapid change you must learn to travel light.”</blockquote><blockquote>Albert Toffler, Future Shock</blockquote><p>This is where I think JavaScript really shines. Provided modules remain small, which a microservice architecture make possible, JavaScript can reduce the overhead of change.</p><h3>Lightening the suitcase: No more threads</h3><pre>const express = require(&#39;express&#39;)<br>const app = express()<br>app.get(&#39;/my-profile&#39;, getMyProfileFromDatabase)<br>app.listen(80)</pre><p>The four lines of code above illustrate how easy it is to create a server using JavaScript. When I first saw this code, coming from a Java background, it seemed too good to be true. Where is the application server?</p><p>The answer has to do with how programs do tasks in parallel. I think we have all experienced the frustration of front ends that freeze up for a few seconds after you push a button. This is because the program is not parallelising work properly and it is having a negative impact on user experience (UX). The same problem exists on the backend.</p><p>Java and C# solve the problem of concurrency using threads. If you take a look at the size of the chapter on threading in a Java textbook you will see the complexity this introduces.</p><p>The designers of JavaScript opted to not use threads to achieve concurrency. Instead <strong>JavaScript embraces an asynchronous style of programming. This makes doing things in parallel safer and easier.</strong> Because microservice backends are inherently asynchronous, communicating with one another through messages, JavaScript is a perfect fit.</p><p>Once you have gotten used to an asynchronous way of programming, JavaScript provides a light wight way of writing backend components because it avoids the complexity of multi threading.</p><h3>Lightening the suitcase: Database access</h3><pre>async function getMyProfileFromDatabase(request, response, next) {<br>  try {<br>    const profile = await db.query(<br>      `select * from profiles where id = ${request.params.id}`)<br>    response.render(&#39;my-profile-template&#39;, profile)<br>  } catch(err) {<br>    next(err)<br>  }<br>}</pre><p>Another task that is much lighter with JavaScript is reading and writing to a database. This is because of another decision the JavaScript designers made. They chose not to include static types in the language. Static types allow development tools to give developers a lot more help when refactoring (changing) their code. While static typing is essential for a large program it is not necessary for a small program.</p><p>In a statically typed language like Java or C# before you read data from a database you need to explicitly describe the data by writing a type definition. This means more code, more theory to hold in your head as you code and it makes the code more sensitive to database changes.</p><p>With JavaScript on the other hand the lack of static types makes the code much faster to write. It reduces the cost, in terms of time and effort, of interacting with a database. And we interact with databases all day, every day.</p><p>Another interesting option that JavaScript is ideally suited for is NoSQL databases. Document databases like MongoDB are a natural fit for JavaScript. Key-value databases like DynamoDB or Redis are also a really good fit. These databases allow you to store more complex data structures in your database without the need for an Object Relational Mapping (ORM) layer. This certainly reduces the cognitive weight of the language.</p><p>Without static types we sacrifice error detection tooling but we get a lighter language with some great new database options. Provided code size remains small this tradeoff works.</p><h3>Lightening the suitcase: Outsourcing</h3><p>Besides the code there are many other things involved in running software in production. You need hosting, scaling, testing, release management, documentation, project management, security, databases, message brokers, CDNs, proxy servers etc etc. JavaScript aligns very well with Platform as a Service (PaaS) cloud offerings and has an incredibly rich ecosystem of tools and libraries.</p><p>Using the Serverless framework you can run your backend JavaScript modules on AWS, Google Cloud or Azure very easily. These serverless hosting platforms will give you very low startup costs and will manage scaling automatically. Another great option is Heroku for backend services. Both Serverless and Heroku have excellent release management features (CI/CD) built in.</p><p>For front end JavaScript (ie React, Vue and Angular) Netlify provides an excellent service. Netlify will host your code and manage the CDN for you. It also provides excellent CI/CD features including options like A/B testing and preview releases.</p><h3>A two language approach</h3><p>One of the big benefits of modularising using Docker containers is that you can build your modules in just about any language. This gives you the option of taking a two language approach when building your system. You can use JavaScript for light weight modules and if a module does become too big for JavaScript you can rewrite it in your favourite statically typed language. TypeScript is an excellent option. It is JavaScript with static types.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=737699922202" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The problem with flow…]]></title>
            <link>https://medium.com/@davidjohnmaccallum/the-problem-with-flow-8791e6bec7c?source=rss-15ea3b7c8589------2</link>
            <guid isPermaLink="false">https://medium.com/p/8791e6bec7c</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[David MacCallum]]></dc:creator>
            <pubDate>Mon, 21 Sep 2020 20:39:29 GMT</pubDate>
            <atom:updated>2020-09-29T12:51:18.124Z</atom:updated>
            <content:encoded><![CDATA[<h3>The problem with sprints</h3><p>A colleague once said to me, <strong>“If you work consistently at 70% you will end up burned out. Rather, work at 100% for a while and then pull back to 20% to recover.”</strong> Agile sprint cycles have the danger of running a team at 70% capacity indefinitely. Can we recover a more natural, work hard-achieve-rest cycle to software development? I believe that effective software development should naturally fall into this type of pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mbZ4d3IzTmi46SzfihlJqw.jpeg" /></figure><p>Here is a real life example of a high value IT project that has this push-hard-and-rest characteristic. The client has a growing debtor’s book. The problem is that they have two sales systems. Each customer gets a credit limit but without a single system managing the customers credit limit there is no way to enforce it. A piece of systems integration work is required to set up a master data system for the credit limit. This project required relationship building, convincing, patience and technical skill. Notice the variety of the tasks involved: sales, diplomacy, finance and technical. Once the work was complete there was a sense of achievement. The financial value to the client was big.</p><p>I would argue that this type of project, though it might require intense effort and some late nights (100% effort), is more likely to result in sustainable job satisfaction. The next step after a piece of work like this is some low energy work (20% effort) while you look for the next high value problem to solve. Bench time, to use consulting language.</p><p>Many types of work have these natural cycles. In sales you work intensely preparing a sales pitch and then (hopefully) get to celebrate winning the deal and relax for a week while you qualify leads ahead of the next big push. The seasonal working cycles of farming have periods of planting, periods of waiting and then periods of harvesting.</p><p>Information technology, and software development specifically, has been applying lessons from the manufacturing industry. In the popular book <a href="https://www.oreilly.com/library/view/the-phoenix-project/9781457191350/">The Phoenix Project</a> a stressed out, fire fighting IT manager is mentored by a Yoda like factory manager. The factory manager teaches the IT manager about the <a href="https://en.wikipedia.org/wiki/Theory_of_constraints">Theory of Constraints</a> and <a href="https://en.wikipedia.org/wiki/Continuous-flow_manufacturing">Single Piece Flow</a>. The fires go out and a sense of order and productivity sets in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KlSEFFBTjyZKovSoQ0NnEw.png" /></figure><p>I think we can learn a lot from our colleagues in manufacturing but we must remember that <strong>software development is fundamentally different from manufacturing</strong>. A manufacturing process is a repeatable process producing units of the same thing. Software development is almost always producing something new. <strong>Software development has a lot more in common with management consulting.</strong> The software developer is working with the client to solve a business problem. We should not be measuring the productivity of software developers but rather their effectiveness at solving business problems.</p><p>To be successful we need to think more like management consultants and less like assembly line workers. This is a challenge. It requires us to develop consulting skills. But it will result in more effective IT solutions and will help us escape the ineffective and high stress production line approach to software development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8791e6bec7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices. Some lessons learned.]]></title>
            <link>https://medium.com/@davidjohnmaccallum/microservices-some-lessons-learned-19fdef74d105?source=rss-15ea3b7c8589------2</link>
            <guid isPermaLink="false">https://medium.com/p/19fdef74d105</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[soa]]></category>
            <dc:creator><![CDATA[David MacCallum]]></dc:creator>
            <pubDate>Fri, 11 Sep 2020 12:21:25 GMT</pubDate>
            <atom:updated>2020-09-21T20:50:18.130Z</atom:updated>
            <content:encoded><![CDATA[<p>I came to microservices from a background in Service Oriented Architecture (SOA). I found this experience very rewarding. However, as microservices reach the top of Gartner’s Hype Cycle, it is worth reflecting on a few preconditions for a successful microservices project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WLR82UXyVKMhwCGRpBIMVg.jpeg" /></figure><p><strong>From SOA to MA</strong></p><p>My journey began in the Enterprise Architecture (EA) team of a large traditional media company. The goal was to use Service Oriented Architecture (SOA) to enable the company to make the formidable transition from analogue to digital media workflows. Using SOA we sought to expose the data and functions of the legacy systems as web services and use these to build the new digital workflows as middleware.</p><p>A Microservices Architecture is different from a SOA in a few ways. SOA tends to concern itself with <strong>integrating existing monolithic systems</strong>. Central to SOA is the Enterprise Service Bus (ESB), a kind of Grand Central Station through which messages flow providing validation (passport control), enrichment (grabbing lunch along the way), routing (proceed to platform B sir), logging (CCTV) and error handling (rest rooms). We know that <strong>tightly coupling systems reduces independence. This creates a coordination overhead making changes more difficult</strong>. The job of the ESB is to provide a rich toolkit to try to work around this. As a result SOA is sometimes referred to as a “smart pipes” architecture.</p><p>A microservice architecture tends to be <strong>build from the ground up as a distributed system of collaborating but independent</strong> <strong>programs</strong>. A key enabler of this architecture is containerisation. The ability to easily create and run little programs. Central to a microservice architecture is the concept of independent deployability. Or simply independence. To understand this we need to understand the reason why one would want to build software in this elaborate style at all.</p><p>I think the reason why MA is popular is because it is a fundamental part of the how the cloud works. Remember that the biggest cloud platform AWS is a byproduct. As Amazon built its business it made architectural decisions according to its needs. It had a massive development team and the coordination overhead became a problem so they broke their architecture up into small independent pieces. It also had massive and elastic scaling requirements and small independent pieces can be scaled more efficiently. So the driver is scale both in terms of number of developers and in terms of traffic. If you do not have these needs you should think carefully before adopting a MA.</p><p><strong>Essential Ingredients</strong></p><p>Doing SOA we learned to <strong>use automation</strong> to manage the proliferation of components that make up a distributed system. We experienced the <strong>coordination overhead problem of tightly coupling</strong> systems together. And we learned the importance of <strong>centralised logging</strong> <strong>and error handling</strong>.</p><p>Release automation is a nice to have if your application is monolithic. A monolithic system is deployed as a single unit. Releases are typically infrequent and contain a <strong>large batch </strong>of changes. This is slow but it is also easy to keep track of. A shared folder of Change Request documents will do. A microservices system on the other hand may have tens or hundreds of components which are released independently. Releases happen frequently and contain <strong>small batches</strong> of changes. This is a key benefit of microservices but keeping on top of a large number of small grained releases requires two things: <strong>A</strong> <strong>tool to manage releases</strong> (eg Jenkins + Git) and <strong>automated testing</strong>. Without these two things you have chaos. Thankfully, some cloud platforms have excellent release automation built in (eg Heroku, Netlify and Serverless).</p><p><strong>Test automation</strong> must be custom built and this takes a significant amount of time. I think test automation is important for most systems but for MA systems it is essential if you are to maintain an acceptable level of quality with such a high rate of change. Test scripting is not a skill all developers have. <strong>Ensure that you hire developers with Test Driven Development (TDD) skills.</strong></p><p>Perhaps the most important thing to get right in a microservice architecture is <strong>loose coupling and high cohesion</strong>. This allows teams to steam ahead without constantly stepping on one another’s toes. Even when team size is small a loosely coupled, highly cohesive component is easier to reason about and make changes to. Loose coupling enables test automation because mocking out dependencies is one of the challenges when writing tests.</p><p>Loose coupling has some uncomfortable tradeoffs. The biggest one is that <strong>two microservices cannot directly access the same database schema</strong>. If they do then they are tightly coupled to the schema and therefore to one another. Neither service owner can make a schema change without coordinating with the other service owner. This is a big change from monolithic systems.</p><p>Rails, a popular monolithic application framework, builds the application around a domain model which is directly reflected in the database. This is a much loved approach with significant advantages not least of which is the ad-hoc reporting that the central database allows. A MA takes a very different approach. If microservices are to be independent they need their own databases. This means redundant data and <a href="https://martinfowler.com/articles/microservice-trade-offs.html#consistency">eventual consistency</a>. I have found <a href="https://www.youtube.com/watch?v=vs_XiP5Lkgg">Fred George’s talks</a> very helpful in getting my head around this.</p><p>It is tempting to have microservices communicate with one another by directly invoking one another using HTTP calls. This creates a coupling between the two microservices. Sometimes this is unavoidable in which case the dependency needs to be managed using a <a href="https://martinfowler.com/bliki/ContractTest.html">Contract Test</a>. Often however, microservices can interact in a less tightly coupled way using events and the <a href="https://www.enterpriseintegrationpatterns.com/patterns/messaging/PublishSubscribeChannel.html">publish-subscribe pattern</a> and <a href="https://martinfowler.com/eaaDev/EventSourcing.html">event sourcing pattern</a>.</p><p>Loose coupling has to be designed in from the start. I have found the patterns in Eric Evan’s excellent book <a href="https://www.oreilly.com/library/view/domain-driven-design-tackling/0321125215/">Domain Driven Design</a> to be very helpful here. <a href="https://martinfowler.com/bliki/BoundedContext.html"><strong>Bounded Context</strong></a> groups together related microservices and helps you think through the high level data flows between component groupings. <a href="https://martinfowler.com/bliki/UbiquitousLanguage.html"><strong>Ubiquitous Language</strong></a> provides a consistent glossary of domain terminology which helps the system remain consistent despite being built by many people.</p><p>Finally there are operational considerations when running a MA system. A traditional monolithic system has a single log file ordered in time sequence. A MA system has multiple log files. These need to be collected into a single log database which has the ability to filter the log by service. A very useful pattern is to use a <a href="https://medium.com/@scokmen/debugging-microservices-part-ii-the-correlation-identifier-552f9016afcd">log correlation ID</a> to allow the log to the filtered by transaction. The tricky thing about log correlation IDs is that they have to be passed consistently in every message otherwise their are gaps in the log. This can be enforced by creating a logging library that all microservices will use. Using meaningful values as the correlation ID, for example a transaction ID or a HTTP session ID, can make the log even more meaningful. I have used Elasticsearch as a log database but be careful how you define your indexes, it can end up costing quite a lot.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19fdef74d105" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>