<?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 Martin Roest on Medium]]></title>
        <description><![CDATA[Stories by Martin Roest on Medium]]></description>
        <link>https://medium.com/@roest.martin?source=rss-8761d65c2bff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2QARZLSw7mgRGzWHzUeDbg.png</url>
            <title>Stories by Martin Roest on Medium</title>
            <link>https://medium.com/@roest.martin?source=rss-8761d65c2bff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 21:43:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@roest.martin/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[Drupal + React “progressively”]]></title>
            <link>https://medium.com/@roest.martin/drupal-react-progressively-b0821dd9df8f?source=rss-8761d65c2bff------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0821dd9df8f</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cms]]></category>
            <category><![CDATA[drupal]]></category>
            <dc:creator><![CDATA[Martin Roest]]></dc:creator>
            <pubDate>Wed, 30 Jan 2019 13:15:15 GMT</pubDate>
            <atom:updated>2019-01-30T13:15:15.822Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bour8pu1jFauMkuH.jpg" /></figure><p><strong>A while ago I wrote about </strong><a href="https://www.ibuildings.nl/blog/2018/09/headless-decoupled-een-traditioneel-cms-wat-de-beste-keuze"><strong>Decoupled, Headless and traditional CMS architecture</strong></a><strong>. The post is about choosing which one is right for you. I wrote about the different architecture characteristics and the consequences it has. Knowing the differences will help you pick the right one for you. Based on that post you could think that you have to choose between Decoupled or Headless. But maybe there is more to choose from.</strong></p><p>Recently we delivered a project with <a href="https://reactjs.org/">React</a> and <a href="https://www.drupal.org/">Drupal</a>. The project required <a href="https://en.wikipedia.org/wiki/Faceted_search">faceted search</a> along with CMS capabilities. To meet the requirements we integrated <a href="http://www.searchkit.co/">Searchkit</a> with Drupal. <a href="http://www.searchkit.co/">Searchkit</a> is a suite of React components with an <a href="https://www.elastic.co/products/elasticsearch">Elasticsearch</a> back-end.</p><p>The faceted search is the main component but we ended up using other React components on the front-end.</p><p>We discovered that integrating <a href="http://www.searchkit.co/">Searchkit</a> was relatively easy and it was actually quite nice to have this rich user experience of Searchkit and React components. Eventually we started to create more React components on the front-end and replicating that rich UI. On the other hand we did not want to lose the benefits of <a href="https://www.drupal.org/">Drupal</a>. We definitely wanted to benefit from Drupal’s front-end theming/rendering of the website structure like the main layout, navigation and user logins etc.</p><h3>Progressively decoupled</h3><p>Knowing that we require CMS capabilities and want to benefit from Drupal’s theming we did not wanted an API-first or Headless approach. However we needed at least to decouple some of the things. We used Drupal’s webservices to build a few API’s and integrate with other applications. For the main layout and navigation structure we used Drupal theming and templates. <a href="http://www.searchkit.co/">Searchkit</a> was hooked into a Drupal page template which was rendered from a <a href="https://www.drupal.org/docs/8/api/routing-system/introductory-drupal-8-routes-and-controllers-example">Drupal page controller</a>. The approach we took is actually called <a href="https://dri.es/the-future-of-decoupled-drupal">“progressively decoupled”</a>. I believe it’s not a real industry standard. <a href="https://dri.es/about">Dries</a> wrote about it back in 2015 and I think he sort-off coined the term. There is even a flowchart that helps you decide the best <a href="https://dri.es/how-should-you-decouple-drupal">approach in decoupling Drupal</a>. Although Dries said “progressively decoupled” is the <a href="https://dri.es/the-future-of-decoupled-drupal#3">future</a> or at least Drupal’s future, I believe it is more like a transition. I think in the current technology landscape with so many different devices the end goal is to have a full-featured pure API-first headless CMS. Today’s headless CMS-es are not as full-featured as CMS-es like Drupal. However Drupal is continually evolving to a decoupled architecture and is therefore an interesting choice.</p><h3>React + Drupal integration</h3><p>So how did we integrate React with Drupal? Let’s take a closer look. For this example I assume you have experience with both Drupal and React. If not read about it first or just skip this part.</p><p>In this example we have a Drupal theme that includes a src folder with Javascript sources. Our projects actually use <a href="https://www.typescriptlang.org/">Typescript</a> because we believe that helps us meet our quality standards. But, for the purpose of this example let’s stick with Javascript. The Drupal theme lives in the (usual) web/themes/custom folder. In the root of the project we have package.json that defines all our JS dependencies. Also other setup tools like webpack are in the root of the folder. This results in having our dev tooling all available from the root folder. So typing “npm install” in the project root will install all node_modules. It will however build (npm build) the javascript sources in a build folder located in the Drupal theme which is publicly accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/0*VdPZ8I-Uz4sr5P5i.png" /></figure><p>The Component.js file basically contains the bootstrapping and rendering of a React component. It is what you expect from a common setup. Like the example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/0*HJWiRgtXH3VrwzVv.png" /></figure><p>We use <a href="https://webpack.js.org/">webpack</a> and <a href="https://babeljs.io/">Babel</a> to build and compile Component.js into the build/component.js. Now running the component is just a matter of including the javascript file on a page. Now here is where the Drupal plays a role. What we did is define a library in our custom Drupal theme that references the javascript component.js. This allows us to “<a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/group/theme_render/8.6.x#sec_attached">attach</a>” the file to a template in for example a <a href="https://www.drupal.org/docs/8/api/render-api/render-arrays">Drupal render array</a>. Once the library is available we can use preprocess hooks or just #attach to include and run the component in basically any template.</p><p>But, the common React bootstrapping like in the above example can cause issues. It expects the root element to be available so we can only run it when the DOM is available. To do this you need the change the bootstrapping a bit and use <a href="https://www.drupal.org/docs/8/api/javascript-api/javascript-api-overview">Drupal’s Javascript API</a>. Drupal.behaviors enables you to do a jQuery(document).ready() equivalent. This is especially important when using <a href="https://www.drupal.org/docs/8/core/modules/bigpipe/overview">Drupal’s dynamic page cache</a> and <a href="https://www.facebook.com/notes/facebook-engineering/bigpipe-pipelining-web-pages-for-high-performance/389414033919">BigPipe</a>. So update Component.js to something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/0*GLgK19KKgQrW0hQ4.png" /></figure><p>The next step is to provide data from Drupal in your React components. Assuming you want pass data from entities or configuration. You can use <a href="https://www.drupal.org/docs/8/api/restful-web-services-api/restful-web-services-api-overview">Drupal webservices</a> to build a REST API and have your React component fetch data from that API. Initially we started with a couple of entities that we wanted to pass to React. So we simply encoded the entities in JSON and included that in our Twig template. It looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/0*mwp5seNXXiJTepN5.png" /></figure><p>You can also use <a href="https://docs.acquia.com/tutorials/fast-track-drupal-8-coding/add-custom-variable-drupalsettings/#">drupalSettings</a> to pass your values. Now it’s just a matter of reading the variable in you React component. Obviously you can improve the bootstrapping a bit and inject the data as props or state into you React component.</p><p>Eventually we created React components that were used as <a href="https://www.drupal.org/docs/8/api/entity-api/fieldtypes-fieldwidgets-and-fieldformatters">FieldWidgets</a> in Drupal’s admin pages. We re-used the components in the Drupal admin to enable configuring the component and show the real-time updated preview.</p><h3>Conclusion</h3><p>Progressively decoupled is maybe not the most purest form of architecture and actually adds coupling. It is however a cost effective and pragmatic approach which brings a lot of opportunities. It enables your creativity to create rich UI components integrated in your favorite CMS. On the other hand it is just a pragmatic approach until the Headless CMS-es ecosystem has matured. Nevertheless, it has proven to us to be successful and we will definitely keep using it in future projects.</p><p>By sharing this example I hope I have triggered your creativity to improve your projects. If you have any questions or feedback just leave a comment below.</p><p><em>Originally published at </em><a href="https://www.ibuildings.nl/blog/2019/01/drupal-react-progressively"><em>www.ibuildings.nl</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0821dd9df8f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keeping track of your dependencies]]></title>
            <link>https://medium.com/@roest.martin/keeping-track-of-your-dependencies-7d4c2b6cdf54?source=rss-8761d65c2bff------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d4c2b6cdf54</guid>
            <category><![CDATA[layered-architecture]]></category>
            <category><![CDATA[deptrac]]></category>
            <category><![CDATA[dependency-inversion]]></category>
            <category><![CDATA[solid]]></category>
            <category><![CDATA[hexagonal-architecture]]></category>
            <dc:creator><![CDATA[Martin Roest]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 14:36:24 GMT</pubDate>
            <atom:updated>2018-11-29T14:36:24.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uuuDssL289jfj6Mg.png" /></figure><p><strong>As a software engineer that mostly practices object oriented programming (OOP) I value principles like </strong><a href="https://en.wikipedia.org/wiki/SOLID"><strong>SOLID</strong></a><strong>. When architecting apps I prefer a </strong><a href="https://en.wikipedia.org/wiki/Multitier_architecture"><strong>layered</strong></a><strong> approach. I have typical layers like Application, Domain and Infrastructure. This helps me separate concerns and build a maintainable codebase. With this post I want to share how I try to create loosely coupled and maintainable software.</strong></p><h3>Layered architecture</h3><p>I usually have a repository layout that reflects the layers. Meaning that I have the folders Application, Domain and Infrastructure. Although I have some exceptions for the infrastructure layer. I consider everything that interacts with the “outside”, infrastructure. Which means that the presentation layer is also infrastructure. Since those responsibilities are, in my case, usually handled by the framework. Depending on the framework, the code I write to extend the framework may not always be in the infrastructure folder. Key in layered architecture is to respect the layer boundaries and have good separation between the layers. Still you should be able to interact between the layers. Managing your dependencies across the layers become very important.</p><h3>Framework separation</h3><p>When working with a CMS like <a href="https://www.drupal.org/">Drupal</a> I also apply the layered approach. Obviously that has some impact on the repository layout. The Drupal codebase is infrastructure but due to the Drupal folder layout it’s not in my infrastructure folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*wS2IgO0O_2yWH5Cu.png" /></figure><p>The <a href="https://en.wikipedia.org/wiki/Dependency_inversion_principle">dependency inversion principle</a> (DIP) enables the separation of the layers. It states that high-level modules should not depend on low-level modules. Infrastructure like your framework is considered a low-level module that interacts with the “outside” and therefore an “outer” layer. Domain is high-level module and an inner layer. Which means that your domain layer should not depend on your framework layer. Which will result in dependencies only going in one direction.</p><p>Let me give an example that demonstrates the separation. For example you have a domain entity that you want to persist as a Drupal entity in order to use Drupal’s theming/presentation layer to display it. So how do you save the domain entity without creating a dependency in the domain layer on your infrastructure (Drupal). The <a href="https://martinfowler.com/eaaCatalog/repository.html">repository pattern</a> will help you solve this. Not to confuse this with the “repository” layout I’ve mentioned before. The repository refers to a collection of entities. The repository is responsible for persisting the domain entity. By creating an interface for the repository in the domain layer, the domain code can “work” with the repository without worrying how to actually persist the entity. Your code in the domain layer now depends on the abstraction of the repository. The implementation of the repository interface is created as part of a custom Drupal module. In the Drupal module you create a repository object that, with the help of the framework, can save the Drupal entity.</p><p>Unfortunately the layers create a bit of extra complexity. Since the repository implementation saves Drupal entities you have to <a href="https://martinfowler.com/eaaCatalog/mapper.html">map</a> your domain entity into a Drupal entity. This can be done by creating a <a href="https://martinfowler.com/eaaCatalog/dataMapper.html">mapper</a> object. Inject the mapper in the repository. Once you call the repository-&gt;persist(DomainEntity) the repository can map the domain entity to a Drupal entity before saving it to the database. Since the mapper is a direct dependency of the repository it belongs to the infrastructure and the domain layer has no knowledge of it.</p><h3>Dependency injection</h3><p>Now that you’ve separated the layers by creating an interface you still need to wire the objects with real implementations. Use your framework’s DI / Service container to do this. Most frameworks like <a href="https://symfony.com/">Symfony</a>, <a href="https://laravel.com/">Laravel</a>, <a href="https://www.drupal.org/">Drupal</a> have this available. Simply create services and inject those in your objects. The result is a loosely coupled codebase. Since your domain is agnostic to the infrastructure it makes testing your domain much easier. With tools like <a href="https://phpunit.de/">PHPUnit</a> and <a href="http://behat.org/">Behat</a> you can now test your domain code without your infrastructure. Simply replace the infrastructure by creating Fake or Stub <a href="https://martinfowler.com/bliki/TestDouble.html">testdoubles</a> based on the interfaces in the domain to remove the dependency of having a real database or remote API when testing.</p><h3>Dependency Tracking</h3><p>Once projects grow bigger you may end up with lots of interfaces/dependencies. As with a proper layered architecture that follows the dependency inversion principle, dependencies can only go one direction. Again, your domain layer should not depend on the infrastructure layer (only on abstractions). To enforce those rules I use <a href="https://symfony.com/blog/clean-software-architecture-with-deptrac">Deptrac</a>. Deptrac is a static code analysis tool that helps enforcing dependency rules between layers. You can define the layers of the app based on namespace or folder location. So if you follow a repository layout like discussed you can easily define the layers in <a href="https://github.com/sensiolabs-de/deptrac">Deptrac</a>. Once you run deptrac it will report violations of the rules you define.</p><p>Deptrac example output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YXqxY2GAl_U54gXu.png" /></figure><p>We run Deptrac on our CI/CD pipeline in a early stage. If you fail to comply with the rules, CI will report a broken build. Especially when apps get bigger it’s very helpful to automatically verify your dependency rules.</p><h3>Conclusion</h3><p>If you know <a href="https://en.wikipedia.org/wiki/Domain-driven_design">DDD</a> you’re probably familiar with the concepts discussed here. Many of them are highly influenced by DDD. Following a layered approach and properly apply <a href="https://en.wikipedia.org/wiki/Dependency_inversion_principle">DIP</a> you actually have a Ports and Adapters or <a href="https://fideloper.com/hexagonal-architecture">Hexagonal</a> architecture approach. I find that these patterns and principles help me create maintainable software. It comes with a bit of extra complexity to properly separate the layers, but it’s well worth the investment. Obviously like all patterns there is an anti-pattern. Be aware of the “Sinkhole” anti-pattern. If all of your requests just flows through the different layers without any logic, layered architecture may be not the best approach. Or at least minimize the number of layers to control the complexity overhead. Since the layered approach is pretty much the same for every app it enables developers to have consistent architecture setup across projects. Due to the separations and abstractions, testing the individual layers is much easier. This will result in a maintainable codebase.</p><p>Thank you for reading this post. I’d like to learn about your experiences as well! Please leave a comment below and share your experience, questions or feedback.</p><p><em>Originally published at </em><a href="https://www.ibuildings.nl/blog/2018/11/keeping-track-your-dependencies"><em>www.ibuildings.nl</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d4c2b6cdf54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we tackle Continuous Delivery at Ibuildings]]></title>
            <link>https://medium.com/@roest.martin/how-we-tackle-continuous-delivery-at-ibuildings-5a0d3a9aadd7?source=rss-8761d65c2bff------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a0d3a9aadd7</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[travis-ci]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <dc:creator><![CDATA[Martin Roest]]></dc:creator>
            <pubDate>Thu, 30 Aug 2018 10:18:53 GMT</pubDate>
            <atom:updated>2018-08-30T10:18:53.692Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MNaTrXu0zb2BYXLu.png" /></figure><p>At Ibuildings we strive to implement Continuous Delivery for all our projects. It helps us build quality software that can be controlled and well managed. My colleague Tom talked about <a href="https://www.ibuildings.nl/blog/2017/11/de-nieuwe-ambitie-stuk-productie-voor-software">Continuous Delivery </a>before. In this article I want to take you through the technical stuff that enables us at Ibuildings to do continuous delivery.<br> But, what is continuous delivery? In my opinion <a href="https://martinfowler.com/">Martin Fowler</a> does a good job in describing the term.</p><p><em>Continuous Delivery is a software development discipline where you build software in such a way that the software can be released to production at any time.<br> — Martin Fowler</em></p><p>When software is releasable at any time, testing and deploying is probably automated. Ideally, deploying should be as simple as pushing a button. In that way it’s fully up to the business whether to release or not. But, be aware. There is a catch. When business keeps postponing deployments is it still “continuous”?</p><p>To me, Continuous Delivery is all about the process on how you manage and prepare the work. By properly refining the work that needs to be done. Is the work, in our case usually a “user story”, ready for development? Is the work clear, testable and shippable as a whole? If not, refine the story and make sure that it is ready in way that you can ship it to production. But, for this article we only focus on the technical tools.</p><p>Once we start developing we’ve basically incorporated three disciplines:</p><ul><li>Coding following the GitHub Flow</li><li>Continuous Integration for Quality Assurance</li><li>Automated deployments</li></ul><p>Continuous Integration and Automated Deployments, are usually implemented with the help of CI/CD pipelines.</p><h3>Coding</h3><p>At Ibuildings we use <a href="https://github.com/">GitHub</a> or <a href="https://about.gitlab.com/">GitLab</a> depending on the project. In both cases we follow the <a href="http://guides.github.com/introduction/flow/">GitHub Flow</a> workflow. We are very keen on code reviews. Pushing changes to a feature branch helps us to review and improve the code before it gets merged. We require at least one reviewers’ approval. In order to prevent wasting someone else’s time you have the responsibility to first test your work before you request a review.</p><p>A reviewer obviously reviews the code. We look at things like the <a href="https://en.wikipedia.org/wiki/SOLID">SOLID</a> principles and <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a> to improve the code where we can. Another responsibility for the reviewer is to do manual functional test. This means that the reviewer has to have a working instance of the software. For people on the team this is usually not an issue. In the other case it is the responsibility of the requester to provide a working instance. Ideally, we’ve set this up with so-called <a href="https://docs.gitlab.com/ee/ci/review_apps/">Review Apps</a> but that is, unfortunately, not always the case. The use of Review Apps enables you to show your progress to team members. Think of product owners that can have a quick look to verify this is what they want.</p><h3>Continuous Integration</h3><p>When software should be deployable at any time you have to make sure that with every change you can guarantee the quality of the software. While code reviews help guarantee quality, Continuous Integration helps it even further. In our case we’ve automated CI with the help of <a href="https://travis-ci.org/">Travis-CI</a> or <a href="https://about.gitlab.com/gitlab-ci/">GitLab Pipelines</a>. For every change or feature we integrate the code and run the tests. We have a number of static code analysis tools like <a href="https://github.com/squizlabs/PHP_CodeSniffer">code style rules</a>, <a href="https://github.com/JakubOnderka/PHP-Parallel-Lint">lint checking</a>, <a href="https://phpmd.org/">mess detection</a>, <a href="https://github.com/sensiolabs-de/deptrac">dependency tracking</a> and checking <a href="https://security.sensiolabs.org/">security vulnerabilities</a>. After running code analysis, we run the tests. Starting with the Unit tests.</p><p>Secondly, we run functional tests. This requires a running instance of the software but still mocked with external services. I prefer writing functional tests with <a href="http://behat.org/">Behat</a> but we also use <a href="https://symfony.com/doc/current/testing.html#id1">Symfony’s browser kit</a> for Symfony projects and occasionally <a href="https://www.browserstack.com/">Browserstack</a>.</p><p>If one the tools or tests fails, the build is reported broken and cannot be merged into the main codebase. If all is OK, we finally remove all development dependencies which leaves us with a releasable build artifact.</p><h3>Automated Deployments</h3><p>The final step is to deploy the releasable artifact. We use <a href="https://www.ansible.com/">Ansible</a> for automating the deployments. It integrates nicely with our CI/CD pipelines and often we re-use some of the tasks and roles to provision local development VM’s.</p><p>Deployments usually consists of a number of tasks like copying the code, creating release directories running database migrations and clearing caches. There is a nice ansible <a href="https://docs.ansible.com/ansible/latest/modules/deploy_helper_module.html">deployment helper</a> that helps managing the release directories. Most projects have a testing, staging and production environment. Since the environment and deployment steps are practically the same we only have to set it up once. Due to its flexibility I prefer to use the GitLab CI/CD pipelines and with the help of <a href="https://docs.gitlab.com/ee/ci/environments.html">GitLab CI/CD environments</a> we can easily track and manage deployments.</p><p>We create a deploy job for every environment in the deploy stage. The job is triggered manually. We use job policies to only allow deploys from builds on the master branch to production. Setting up the jobs and configuring the environments in the GitLab pipelines provides a nice UI on GitLab that enables us releasing to any environment at any time with a simple mouse click.</p><h3>Continuous Improvement</h3><p>I hope you found this an interesting read. It describes the way how we at Ibuildings implement continuous delivery. We found that it works best for our teams. Still, we are always looking for ways to improve. We run retrospective meetings order see if we need to improve and change our process. If you have any questions or feedback please leave a comment below.</p><p><em>Originally published at </em><a href="https://www.ibuildings.nl/blog/2018/08/how-we-tackle-continuous-delivery-ibuildings"><em>www.ibuildings.nl</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a0d3a9aadd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Example mapping]]></title>
            <link>https://medium.com/@roest.martin/example-mapping-d0a4d9af6460?source=rss-8761d65c2bff------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0a4d9af6460</guid>
            <category><![CDATA[example-mapping]]></category>
            <category><![CDATA[bdd]]></category>
            <category><![CDATA[gherkin]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Martin Roest]]></dc:creator>
            <pubDate>Mon, 20 Aug 2018 14:10:59 GMT</pubDate>
            <atom:updated>2018-08-20T14:10:59.004Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>In this article I want to talk about the use of </strong><a href="https://en.wikipedia.org/wiki/Behavior-driven_development"><strong>behavior driven development</strong></a><strong> (BDD) frameworks. BDD Frameworks let you create executable specifications which you can use for automated testing and documentation. Popular frameworks include </strong><a href="https://cucumber.io/"><strong>Cucumber</strong></a><strong>, </strong><a href="http://behat.org/"><strong>Behat</strong></a><strong>, </strong><a href="https://github.com/behave/behave"><strong>Behave</strong></a><strong>, etc. They all implement </strong><a href="https://docs.cucumber.io/gherkin/"><strong>Gherkin</strong></a><strong> as a specification language.</strong></p><p>If you have never heard of BDD or you have never played with BDD frameworks before then please go read the <a href="https://docs.cucumber.io/">Cucumber documentation website</a> and learn how it can help you in developing software.</p><p>At <a href="https://www.ibuildings.nl/">Ibuildings</a> we do not practice BDD a lot. But we do use Behat in most projects. We do believe that projects benefit from BDD, but the required collaboration with the customer is often difficult to achieve. Tom talked about this challenge in his <a href="https://www.ibuildings.nl/blog/2018/05/gherkin-laat-software-engineer-en-klant-samen-software-ontwikkelen">article about Gherkin</a>.</p><h3>Creating Gherkin scenarios</h3><p>In our case the Gherkin scenarios are usually created by developers. They extract the acceptance criteria from the user story and define a number of scenarios that test the business rules. We discuss the scenarios with other developers on the team to check we’ve covered the important parts. That is of course not ideal and not how it should work. But we still benefit from having a test that verifies the correct behavior of the story. As a side effect Gherkin scenarios often end up being way too technical and abstract to be useful for our customers.</p><p>Only until recently I had some practical experience with <a href="https://docs.cucumber.io/bdd/example-mapping/">Example Mapping</a>. I found it an approachable way of working. With example mapping you work on extracting the acceptance criteria by examples. The acceptance criteria will eventually be written as Gherkin scenarios. It’s a simple technique that does not require a technical, BDD or any other kind of background. Anyone on the team can participate and have valuable input.</p><h3>Example Mapping in practice</h3><p>So, how does example mapping work? It uses a pack of 4 coloured index cards to capture the output. You start by with writing the story on a yellow index card and put it somewhere on top of the board or table. Let’s say we have the story:</p><p><em>“Register user account”</em></p><p>Now, let the product owner describe the story. While talking about the story look for the (business) rules. In this case the product owner explains that when you register for an account an email with additional info on the account is sent as a confirmation message. You get a blue index card and capture the rule:</p><p><em>“Valid email address required”</em></p><p>When the story is described and you have captured the rules you’re going to illustrate these rules by examples. You capture examples on green index cards and put them below the rule. Come up with as many examples you need to fully cover the rule. Keep in mind to be as explicit as you can. Give people or users names and try to use real life examples. To help create the examples you can use the “<a href="https://www.quora.com/Why-do-the-names-of-all-the-episodes-of-Friends-start-with-the-one-with">Friends episode naming convention</a>”. So, in this case you should have examples of:</p><p><em>The one where John registers with a valid email address</em></p><p><em>The one where John registers without an email address</em></p><p><em>The one where John registers with an invalid email address</em></p><p>An example:</p><p><em>John registers for an account with the email address </em><a href="/service/mailto:john@example-mapping.org"><em>john@example-mapping.org</em></a><em> and gets an email confirmation message.</em></p><p>A question could be “What is a valid email address?” If nobody can answer that question you capture it on a red index card and put it on the board. This will eventually give you a good insight in the things you don’t know and have to be addressed later.</p><p>When you’re done creating examples, the cards on the table will tell you something about the story. If you have many red cards on the table maybe this story is not ready for development yet. If you have many blue cards on the table maybe this story is too big and you should break it up. If you have many green cards for a specific rule, the rule is maybe too complex.</p><p>The examples can easily be written as Gherkin scenarios in the Given, When Then syntax. I think it is best to do that with a developer and tester after the example mapping session.</p><h3>Conclusion</h3><p>Example Mapping provides a very useful tool to work together with the customer when capturing the desired functionality and behaviour of the application you are building.</p><p>If you want to learn more about example mapping go and read the <a href="https://cucumber.io/blog/2015/12/08/example-mapping-introduction">Introducing Example Mapping</a> post from <a href="https://twitter.com/mattwynne">Matt Wynne</a>. If you have experience, questions or feedback please share and leave a comment below.</p><p><em>Originally published at </em><a href="https://www.ibuildings.nl/blog/2018/07/example-mapping"><em>www.ibuildings.nl</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0a4d9af6460" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>