<?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 Greg Wright on Medium]]></title>
        <description><![CDATA[Stories by Greg Wright on Medium]]></description>
        <link>https://medium.com/@gregwright_1301?source=rss-aae03f21edd7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*62_D976yJUoTopC8.</url>
            <title>Stories by Greg Wright on Medium</title>
            <link>https://medium.com/@gregwright_1301?source=rss-aae03f21edd7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 15:05:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gregwright_1301/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 Development Between the Low-Code and Generative AI Ages]]></title>
            <link>https://medium.com/@gregwright_1301/software-development-between-the-low-code-and-generative-ai-ages-8429eefea3c1?source=rss-aae03f21edd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8429eefea3c1</guid>
            <dc:creator><![CDATA[Greg Wright]]></dc:creator>
            <pubDate>Thu, 22 Feb 2024 11:55:43 GMT</pubDate>
            <atom:updated>2024-02-22T12:07:47.823Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Recent advances in Generative AI suggest that profound change is in the air for software development. In this article I will be looking at some of the lessons learned from Software Engineering and the recent advances in Low-Code solutions that suggest the path forward in adopting AI in Software Development. I will then look at how AI will impact the entire development process and the ongoing need for sound engineering practices.</p><h3>How we got Here</h3><p>Software Engineering is, in the global scheme of things, a very young discipline. Better ways of doing things (agile, tailwind) are still regularly emerging while old ways (waterfall, jQuery) are deprecated. From the earliest days we have had to deal with the issues of correctly understanding the problem space, clearly and accurately specifying software requirements and finding effective ways to meet and test the implementation of those specifications. Much of what we do is ensuring that we build the right thing that meets the user’s needs. This is why things like UX/UR and good development practices have always been and will continue to be important. As we approach the AI revolution in Software Development, we have to take care that the AI does not simply allow us to develop the wrong thing faster, and instead helps us find the right solution quicker (potentially by removing wrong answers / requirements faster).</p><h3>Where we are Now</h3><p>Recent years has seen the rise of low-code solutions. These trade off development time and skill against flexibility: It’s easy for even a non-technical person to do stuff, but difficult for them to get it right in terms of future proofing and flexibility. Low-code abstracts away a lot of the role of the Solution Architect. For example, products like Power Platform ask us to just trust the vendor for meeting scalability and availability requirements.</p><p>As use of AI in coding takes off — will we see less skilled developers using AI to build software? If so, what’s happening now in low code solutions could provide a hint as to where we are going.</p><h3>The Existing Impact of Low-Code</h3><p>Recently I’ve been involved with a low code project where we used Power Platform to develop a Model-Driven App which is used to manage the customer’s back-end business processes.</p><p>Architecture is about compromise — we’re always looking for the “Least Bad” solution. For this project our primary concern was to meet a politically imposed deadline. Low-code for the back-office system was a no-brainer.</p><p>However, in adopting a low-code solution we sacrificed flexibility (for example accessibility was very difficult to achieve) for developer speed. It is fascinating to note that it is only the developer speed part of the entire agile process that is affected. Everything else in the agile process takes the same amount of time. UX/UR/BA Agile practices, testing etc all take the same amount of time. Code reviews were no longer a speed-bump, but were offset by not having flexible development environments. We gained speed of development until we needed bespoke code — then things slowed down quite a lot.</p><p>“Developer Speed is very different to Development Speed ”</p><p>The important thing is that only a small part of the process was sped up. Rather like putting a super-powerful engine in an old car, if you want it to really perform you also have to upgrade the chassis, suspension, brakes, aerodynamics etc. The same goes for low-code solutions: if your coding goes quicker, you need to spend extra effort on automated testing, backlog generation and prioritisation, maintenance practices etc.</p><h3>Using AI to Optimise the Entire Development Process</h3><h3>Start at the Beginning: User Research</h3><p>AI can already impact not just the code generation stage but the whole end-to-end software development process. It starts with User Research, where AI can help with transcribing interviews and extracting themes. AI can have a huge impact on User Story generation.</p><h3>Suggesting best practice for User Story generation and identifying gaps</h3><p>You can ask AI to help produce high quality user stories, with clear acceptance criteria, applying best practices. The output I’ve seen is outstanding. As you develop the user story, catalogue the Business Rules in a central repository. Relate your acceptance criteria to your business rules.</p><h3>Converting Acceptance Criteria to Executable, Human-Readable Feature Specs</h3><p>If the Acceptance Criteria are expressed as executable feature specifications, then they can be used as part of the automated acceptance test and regression suites. This enforces high level test-first development, and results in great acceptance and integration tests, guaranteeing business rule coverage. Ask the AI to give you acceptance criteria as executable feature specifications using a language like Gherkin which can be user to translate desired behaviour into test code.</p><h3>Identifying and Cataloguing Business Rules in a Central Repository</h3><p>It is extremely useful to have a business rule catalogue, a single source of truth for business rules. Combining this with suitable testing it is possible to generate 100% business rule coverage — giving us huge confidence that our code is functionally correct.</p><p>Linking our Feature Specs, which are the basis for our automated acceptance and regression tests, to the business rules enables us to achieve 100% business rule test coverage.</p><h3>Generating Test Outlines from the Feature Specs</h3><p>Given a good set of feature specs that test the happy path, failure modes and edge cases, we can use the AI to generate outline step definitions in the required format (e.g. Cucumber) for our automated tests.</p><h3>Generating Application Code that Causes the BDD Tests to Pass.</h3><p>Once our high-quality user stories are ready and prioritised, we can bring them into the developer phase. As the AI improves less and less manual coding will be required. The AI will take our Specs and produce working, tested application code. We should not see the restrictions of low-code because the AI will have access to Turing-Complete programming languages. The effect should be something like Terraform for platforms engineering, where we specify the target state and Terraform takes care of the rest.</p><p>We’re not there yet and the human in the loop still has important roles to play. So, what should the approach be in an AI assisted developer world?</p><p>The AI currently assists the developer to write code, suggesting code snippets with great effect. It can help with understanding of legacy code, renaming and refactoring code to make it easier to understand and change. We have not left the realm where code needs to be comprehensible to a human developer.</p><h3>Sound Engineering Principles Still Apply</h3><p>Some of these include:</p><p>· Understand the problem</p><p>· Break the problem into small easy to solve chunks</p><p>· Use test first development, preferably using the techniques of TDD</p><p>· Unit tests suites should run super quickly and not couple to external services or databases</p><p>· Read-optimise the code</p><p>· Use platform engineering to rapidly deploy copies of environments and a CI/CD pipeline</p><p>· Release fully tested software into a production-like environment regularly (ideally at least daily)</p><p>· Measure Throughput and Stability so you know how quickly you can deliver working software, and optimise these metrics.</p><h3>Explaining Code and Making Code Read-Optimised.</h3><p>In order for us as humans to understand the AI generated code it has to be read optimised. There’s no particular reason why AI should produce read optimised code, or even use a high-level language. Currently its reference data is unlikely to be read optimised. However, if it produces code we can’t easily understand, we can ask it to explain or refactor it. Remember that our primary motivation for unit tests should be so we can refactor. If you’re interested in understanding or refactoring a piece of write-optimised (unintelligible) code, ask the AI to explain and document it. If it is not covered by unit tests create tests that test the application code’s behaviour (be careful if you use the AI to do this — you could entomb bugs in the tests). Run the unit test suite and loop until you have a green build. You can now get the AI to help you with refactoring. Ask it to split the code out into smaller files, improve the naming and structure of the code. Make sure the tests still pass then review the code as the ‘Human in the Loop’ applying common sense.</p><h4>Finding Security Defects in Code and Being Careful not to Create Them</h4><p>Remember that the AI’s training data will contain security defects, so ask the AI to look for defects, suggest improvements and best practices. The developer still needs good knowledge of secure development techniques 1,2,3 and we should ask the AI to apply these techniques (for example avoiding primitive obsession and using validated domain objects). AI can already reflect successfully suggesting reasons for test failure or defects in the application code.</p><p>Automated security testing will remain a first-class citizen of every delivery pipeline.</p><h3>Creating or Refining Checklists</h3><p>Checklists are a super-important part of many industries2.</p><p>You can ask the AI to generate checklists e.g. how to correctly validate a JWT, how to do a really good code review, what a great user story looks like etc.</p><p>Try asking the AI to suggest your Definition of Ready and Definition of Done. If they are already in place, ask the AI to critique them.</p><h3>The Role of the Human Coder in the Loop</h3><h4>Does the Code Make Sense?</h4><p>Currently the Human in the Loop has a really important role: making sure that good engineering practices are followed, and that the AI produces sensible output. Here’s a simple example of where the AI slipped up:</p><p>The code snippet below was generated by Copilot. What happens if “numbers” is an empty array?</p><pre>// A function to calculate the mean of an array of numbers<br>function mean(numbers: number[]): number {<br>  return numbers.reduce((a, b) =&gt; a + b) / numbers.length;<br>}}</pre><p>I asked Copilot Chat to find the bug. It is pretty convinced everything is ok. It knows there is an issue if the input array is empty but it does not handle the edge case.</p><blockquote>“There doesn’t appear to be a bug in the mean function in example1.ts. The function takes an array of numbers as input, uses the reduce method to sum up the elements of the array, and then divides the sum by the length of the array to calculate the mean. This is a correct implementation of the mean function, assuming that the input array is not empty.</blockquote><blockquote>If you are encountering an error or unexpected behavior when using the mean function, please provide more information about the issue so that I can help you debug it.” — Copilot Chat</blockquote><p>Nevertheless, AI is extremely useful for suggesting reasons why code fails to compile, work or test. The human needs to make sure that the AI does not go down a rabbit hole, for example, you point out some compilation errors and it goes off on a tangent.</p><p>(Humans coders need to avoid this too: senior developers should watch themselves and junior developer to ensure they don’t go down a rabbit-hole — a typical sign would be someone saying “it’ll be ready tomorrow” in several consecutive stand-ups)</p><p>With good specification and future improvements in the AI the human in the coding loop will become less important (see future improvements, below).</p><p>So where does this leave developers?</p><h3>How AI will Impact the Software Engineer</h3><p>AI will certainly have an impact that has parallels with low-code: greatly improving the efficiency of coders. It can also be used to improve the quality and speed of our whole development process.</p><p>User Researchers can use AI to transcribe interviews and extract themes and summaries in a tiny fraction of the time they can without AI. AI will improve the quality of our user stories, acceptance tests and documentation. In short, by using AI we will be able to deliver better value to our customers faster.</p><h3>The Role of the Software Engineer in Specifying Software</h3><p>Humans have not always been great at specifying software. It’s an area where there are still gains to be made and AI will certainly help. As AI becomes better at coding developers need to become better at specification. Without good specification both the human and AI coder run serious risk of failure. AI’s advantage is that it can fail faster. This means that regardless of AI, coders will have to work ever closer with Product, BAs and Testers to clearly specify the functionality required.</p><h3>The Future Role of Software Engineering</h3><p>Good software engineering practices are not going away. If you take the fundamental pillars like modular separation, automated testing and continuous delivery into production-like environments away, no amount of AI is going to save you in all but the simplest of systems. Software Engineers are still going to have to understand what good engineering looks like even if they do less actual coding.</p><h3>Future Enhancements</h3><p>Generative AI has brought us a very long way in a very short space of time. There are still some problems to be solved from the Software Engineer’s point of view.</p><h3>Better User Interface Comprehension</h3><p>AI built into IDEs does not currently see the web pages generated by code. AI that understands the output from React, say, would be much easier to work with — you could ask it to move stuff around and change the UI on the fly. This would be a huge step forwards and is, I hope, only a matter of time.</p><h3>Better Accessibility Comprehension</h3><p>With better understanding of the UI will come better Accessibility and WCAG compliance.</p><h3>Language learning and agnosticism</h3><p>In the short term, AI makes it much easier for coders to learn new languages and frameworks. In the long term, AI is quite happy producing code in low-level languages like C, Rust and even assembly language. As long as we can specify software well, future AI generated code does not necessarily have to be human readable and could in principle be machine code or even binary. The AI is more than capable of explaining it in a human-readable way. A separate AI could be used to reverse-engineer this process, translating the binary code to high level language then checking that it meets the specifications.</p><h3>Recommendations</h3><p>Sound engineering principles still apply. You could use generative AI to write code that is “write optimised” — difficult for other people to understand and change — but don’t do that — put the effort into good structure and naming things well. Start by writing a failing test, then get the AI help you write code that makes it pass and continue in small iterations of that loop. Get feedback on your code form the AI. Ask it about code quality, reusability, coupling and security.</p><h3>References</h3><p>1. <a href="https://medium.com/@gregwright_1301/why-is-nobody-talking-about-business-rule-coverage-8e56d23c385d">Why is nobody talking about business rule coverage?</a></p><p>2. <a href="https://www.amazon.co.uk/Checklist-Manifesto-Things-Right-Gawande/dp/1846683149/ref=tmm_pap_swatch_0?_encoding=UTF8&amp;qid=1689153751&amp;sr=8-1">The Checklist Manifesto — by Atul Gawande</a></p><p>3. <a href="https://www.amazon.co.uk/Secure-Design_p1-Dan-Bergh-Johnsson/dp/1617294357/ref=sr_1_1?crid=2X2SHN11UF5V3&amp;keywords=secure+by+design&amp;qid=1689237031&amp;sprefix=secure+by+design%2Caps%2C86&amp;sr=8-1">Secure by Design</a></p><p>4. <a href="https://owasp.org/">OWASP</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8429eefea3c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ten Properties of Good Unit Tests]]></title>
            <link>https://medium.com/@gregwright_1301/ten-properties-of-good-unit-tests-3bbd49222754?source=rss-aae03f21edd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bbd49222754</guid>
            <dc:creator><![CDATA[Greg Wright]]></dc:creator>
            <pubDate>Wed, 15 Nov 2023 16:40:44 GMT</pubDate>
            <atom:updated>2023-11-15T16:40:44.456Z</atom:updated>
            <content:encoded><![CDATA[<p>1. Independent<br>Each test can be run independently, the order of running does not matter so tests can be run in parallel.</p><p>2. Well named<br>The name of the test clearly states what is being tested.</p><p>Good: Test_when_lid_opens_printer_stops()</p><p>Bad: Test2()</p><p>3. Not coupled to anything<br>Unit tests have no dependencies. Mock out dependencies ideally at the data access layer. (It is easier to mock a data access layer than to mock a remote service/database)</p><p>4. Independent of the implementation<br>Do not couple the test to the implementation otherwise if the implementation changes the test has to change too. Test behaviour not implementation.</p><p>5. At least one assertion<br>One assertion per test could be good practice — then there is a specific reason for the test to fail. No assertions is a massive no-no. (Assertion in some test frameworks can be implied in annotations)</p><p>6. Clear failure message<br>Make it easy to work out which test failed and what went wrong.</p><p>7. Consistent<br>Run the test suite twice (or a thousand times) and you get the same result each time. Testing code that involves DateTime() or Rand() can be very problematic.</p><p>8.Fast<br>Unit test suite should run quickly (within a few seconds) — otherwise developers won’t use them and long running tests are not ‘Green Software’.</p><p>9. Remember — good unit tests are another way of documenting the code.<br>Code needs to be read-optimised.</p><p>10. Start by Writing a Test<br>TDD results in better design, decoupled tests and supports CI/CD.</p><p>One final piece of advice — don’t fixate on coverage. <a href="https://medium.com/@gregwright_1301/why-is-nobody-talking-about-business-rule-coverage-8e56d23c385d">Business Rule Coverage</a> is I think a better metric.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bbd49222754" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why is Nobody Talking About Business Rule Coverage?]]></title>
            <link>https://medium.com/@gregwright_1301/why-is-nobody-talking-about-business-rule-coverage-8e56d23c385d?source=rss-aae03f21edd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e56d23c385d</guid>
            <dc:creator><![CDATA[Greg Wright]]></dc:creator>
            <pubDate>Wed, 01 Jun 2022 13:39:22 GMT</pubDate>
            <atom:updated>2022-06-08T08:43:47.124Z</atom:updated>
            <content:encoded><![CDATA[<h4>How business rule coverage is a game-changer for software development</h4><figure><img alt="My secret plan to rule the software development world" src="https://cdn-images-1.medium.com/max/1024/1*6ZNIWM6KR-WYqGJzZsKEoQ.jpeg" /><figcaption>Photo by Ann H: <a href="https://www.pexels.com/photo/my-secret-plan-to-rule-the-world-book-1765033/">https://www.pexels.com/photo/my-secret-plan-to-rule-the-world-book-1765033/</a></figcaption></figure><p>Where to you keep your business rules? Over the years I’ve seen them everywhere: front-end, back-end, domain objects, business-rule layer, database access layer, in stored procedures in the database — everywhere.</p><p>What if we could have one source of truth for business rules and for that source of truth to drive our tests?</p><p>We would only have one place to look for business rules. We would not have to trawl through the code at each layer trying to work out what is actually going on.</p><p><em>If we had 100% business rule test coverage, and a green build, we would have huge confidence in the functional correctness of our application. We would be able to refactor or even rewrite our application in a new language and have huge confidence that it was still correct.</em></p><p>If a business rule changed a BA would update the rule and corresponding tests on a branch, causing a test failure on that branch (because the test has changed but the application has not). A developer could then take over to make the build green again.</p><p>Focusing on business rules at an early stage of User Story development leads to stories where testing has been considered early in the development process. These tests both elucidate the User Stories and lead to better estimation.</p><p>The business rules can be tested via Feature Specs using Behaviour Driven Development (BDD). Those Feature Specs can be drawn out as the User Story is developed. Then the availability of those specs can be part of the “Definition of Ready” and feed directly into the development process.</p><p><strong>Practical Learnings<br></strong>We implemented Business Rule-Based Testing using precisely this process, following a fairly simple recipe:</p><ul><li>All tests must be capable of running individually and independently. This allows the tests to be run in parallel. To do this we tagged each test with a unique ID and business rule IDs of the business rules under test. The test runner could take a tag (or set of tags) as input and run only that one test or a set of tests covering a particular business rule.</li><li>Put the business rules into the feature specs as comments. Each Business Rule can have one or more tests, but the tests should be tagged with the business rule’s number.</li><li>The tests need to be robust. Flakey tests (often due to poor handling of eventual consistency) cause problems.</li><li>Keep an eye on long-running tests. Log the time each test takes to run, so you know which your long running tests are and work to split them up or optimise them. (If you could do massively parallel testing, and every test started at the same time, then the length of time your test suite took to run would be the length of your longest test.) Since we are looking for fast feedback we need the tests to be efficient.</li></ul><p>We developed our User Stories in a number of simple stages:</p><ol><li>In the first stage BA and tester would work together on the Business Rules and Feature Specs in Jira, as well as any other supporting information. Feature specs can be developed in Jira or on a git branch such as ‘feature/Jira-1234&#39;</li><li>‘3-Amigos in’ : The Tester, BA and Developer discuss the requirements</li><li>Developers would then refine and plan development based on the testing requirements in the Jira tickets. We would then do technical analysis and estimate the work needed to write the implementation of the tests and application code</li><li>Developers write both the test and application code, ensuring we have a green build</li><li>‘3-Amigos out’: The developer demonstrates the new functionality to the tester and BA for signoff</li></ol><p>We found that the tests were both great integration tests and acceptance tests. After a while we had to build a system to run the tests in parallel in order to give fast feedback to developers. Focusing on parallelisation sounds expensive, and its certainly not cheap, but it is much cheaper than the cost of manual testers. In practice our manual tester was roughly part time, focusing mainly on developing User Stories and manual acceptance checking. A human can apply common sense in ways that an automated test never could. That one tester was supporting a team of 14 developers. The parallel test solution, though expensive, cost much less than the cost of a manual tester’s salary, and was much more precise and efficient.</p><p><strong>Do Business Rule Tests Make Unit Tests redundant?<br></strong>Absolutely not. Unit tests are still extremely important and it is important that they are proper unit tests (not coupled to a database or external service, not coupled to the actual implementation and that they test behaviour) and that they are super-quick to supply the developers with fast feedback. One annoyance is developers waiting for the whole test suite to run when running the unit test suite could provide fast evidence of a problem.</p><p>Business rule tests are part of your test-driven strategy but are not TDD as such. The tests are larger and less iterative than TDD tests. They do however have the advantage that they describe the desired behaviour of the system, are never coupled to implementation.</p><p><strong>Do Business Rule Tests take a long time to run?<br></strong>They can do — but you shouldn’t let that get out of control. You are aiming for fast feedback. You need to keep an eye on test times, deal with long running tests and run the tests in parallel.</p><p><strong>What other advantages did you find?<br></strong>The process made BAs, testers and developers work closely together. We were much more aware of User Stories under development and put much more thought into the testing requirements. We got better at estimation and we knew that whenever we had a green build we had a very good release candidate. We did continuous delivery into a production-like environment and did some manual verification (applying common-sense) before releasing.</p><p>In the next article I will describe the parallel test solution and its architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e56d23c385d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>