<?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 Bruno Berstel-Da Silva on Medium]]></title>
        <description><![CDATA[Stories by Bruno Berstel-Da Silva on Medium]]></description>
        <link>https://medium.com/@bruno.berstel?source=rss-5d1eb5897d5b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*ZizK0Ig1mRBParC-wb9IhA.png</url>
            <title>Stories by Bruno Berstel-Da Silva on Medium</title>
            <link>https://medium.com/@bruno.berstel?source=rss-5d1eb5897d5b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 00:33:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bruno.berstel/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[You don’t have to use GenAI to win an AI award]]></title>
            <link>https://medium.com/@bruno.berstel/you-dont-have-to-use-genai-to-win-an-ai-award-4f90502a4ab8?source=rss-5d1eb5897d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f90502a4ab8</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[hr]]></category>
            <category><![CDATA[scheduling]]></category>
            <category><![CDATA[collaboration]]></category>
            <category><![CDATA[awards]]></category>
            <dc:creator><![CDATA[Bruno Berstel-Da Silva]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 13:51:44 GMT</pubDate>
            <atom:updated>2024-12-20T13:51:44.016Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Some reflections on the French AI &amp; HR Award that was recently received by a scheduling operations research project. And on the necessity for software engineers to work closely with their end users.</strong></p><p>Since before the summer, I have been part of the organizing committee for the French AI &amp; HR Award just created by <a href="https://hub-franceia.fr/">Hub France IA</a>. As this was the first edition of the award, we had no clue about its reception. Success was beyond our hope: not only did we receive more than 50 applications in two months, but the proportion of interesting ones was really high.</p><figure><img alt="Me and Charlotte Caseris during the panel discussion" src="https://cdn-images-1.medium.com/max/1024/1*VOebAbfIt0skqL8AoK5QZw.jpeg" /><figcaption><a href="https://www.linkedin.com/in/charlotte-caseris-%E2%98%80%EF%B8%8F-aa161225?lipi=urn%3Ali%3Apage%3Ad_flagship3_profile_view_base_contact_details%3BsNzl47YPS%2B6NzLEfFFvKNg%3D%3D">Charlotte Caseris</a> and myself during the panel discussion</figcaption></figure><p>Fast forward: on December 10th, the award presentation was held. Among the many memories, I’d like to talk about the winner project and about the panel discussion that was held just before the award presentation, in which I spoke.</p><h3>Why does GenAI make HR and IT work together?</h3><p>Everyone agrees that GenAI in the enterprise is a subject that requires debunking. No, it’s not magical. No, you cannot replace any job with an LLM. But neither is GenAI just a gadget that you can afford ignoring. It raises important questions about how we work, some would even say existential questions.</p><p>But who should lead this debunking—or let’s call it explanation? Some argue that the HR department should have a central role; some ask “isn’t it why we have a CIO?” Others point out the occasion for these two functions to work together. Indeed, in companies that have implemented AI projects, collaboration between HR &amp; IT was a key factor of success.</p><p>Honestly, it does not come as a surprise to me that a project benefits from the IT department and the “user” department working together. I’m the CTO of DecisionBrain. Working with the users, getting to know them, understanding their day-to-day work and pain points, is at the heart of our <a href="https://decisionbrain.com/professional-services-methodology-pdf/">project methodology</a>, long before we write the first line of code. Yet, even if everyone out there agrees on the need for such a collaboration, it seems that GenAI made it happen in situations where it was absent before. Why is that?</p><p>My take is that it is linked with two elements. On the one hand, contrary to previous waves of digitalization, GenAI really threatens the very nature of several jobs, including for the first time software engineering jobs. On the other hand, behind its apparent simplicity, how GenAI works and what it can actually do is far from obvious, and evolves rapidly. As a result, it is frequent to see “all good wills” in a company to join into a task force, aimed to put their understanding, findings, and ideas in common.</p><p>Granted, such a task force is close to useless if there is no company strategy in the adoption of AI that leads to an actual collaboration on actual projects. However, what we witness is another example of organic initiatives that foster good practices.</p><h3>You can win an AI award without GenAI</h3><p>As I mentioned, most of the 50+ applications we received for the AI &amp; HR award were quite interesting. We were a bit afraid about the number of “FAQ chatbots” that would be submitted. Not only was this number low, but some of the knowledge-retrieval chatbots were quite advanced. In one instance, significant work has been put on the quality and reliability of the knowledge base; the chatbot uses a fine-tuned LLM; and it is not used by the company’s employees, but by the HR specialists themselves to navigate a complex and ever-evolving regulation.</p><p>However, among interesting uses of GenAI, we also saw a number of projects where “AI” was represented by other flavours of artificial intelligence—a term which, as a reminder, refers to the techniques by which software tries to perform tasks that are otherwise considered reserved to human intelligence. We had one project combining LLMs and business rules to select resumes in a job application process. We had a number of projects that used machine learning for classification or forecast—for example to predict the risk of resignation.</p><p>We also had a handful of project using Operations Research. This is the kind of artificial intelligence that Mike Watson calls <a href="https://miketalksai.substack.com/p/what-ceos-leaders-and-investors-need">Practical AI</a>. It is also one of the core techniques that we use at DecisionBrain to solve the <a href="https://decisionbrain.com/">planning and scheduling problems</a> of our customers. So it was a pleasant surprise for me to see the jury quickly come to a consensus to name the <a href="https://innovation.keolis.com/projets-actualites-nouvelles/organisation-du-temps-de-travail-des-plannings-conducteurs-personnalises-testes-a/">Kustomize</a> project as the winner of this award.</p><p>The Kustomize project computes the schedules of bus drivers of the transportation company <a href="https://www.keolis.com/en/">Keolis</a> for the greater area of Dijon, Burgundy. And contrary to the top-down historical approach, it starts from the driver constraints and preferences. If I’m a single mother, I may not be able to work on Wednesdays (when most kid activities happen in France). If I play in a sports team, it’s important to me to be available on Thursday evenings and every other Sunday. If I’m putting priority on earning bonuses, I will apply for night or week-end shifts. Solving a scheduling problem with such hard and soft constraints is what mathematical optimization techniques as used in this project have been designed for.</p><p>And guess what? In their reception speech, the project members stressed the importance of dialogue and collaboration between the software engineers and the final users. Things come full circle.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f90502a4ab8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leveraging the macOS clipboard on the command line with ‘pbcopy’ and ‘pbpaste’]]></title>
            <link>https://medium.com/decisionbrain/leveraging-the-macos-clipboard-on-the-command-line-with-pbcopy-and-pbpaste-f61e1df72f67?source=rss-5d1eb5897d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f61e1df72f67</guid>
            <category><![CDATA[clipboard]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[macos]]></category>
            <dc:creator><![CDATA[Bruno Berstel-Da Silva]]></dc:creator>
            <pubDate>Wed, 17 Jan 2024 14:49:12 GMT</pubDate>
            <atom:updated>2024-01-17T14:49:12.712Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36xxlDWXWp9G8x4cXwTcqA.jpeg" /><figcaption>Collage — Photo by <a href="https://unsplash.com/@gareth_david?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Gareth David</a> on <a href="https://unsplash.com/photos/yellow-and-white-arrow-sign-XcaOZzleORA?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>Do you know these killer macOS Terminal commands: <em>pbcopy</em> and <em>pbpaste</em>? Here, <em>‘pb’</em> stands for <em>paste bin</em>, a.k.a. the clipboard, that is, the memory buffer to which you copy things with ⌘C and from which you paste them with ⌘V. These commands allow you to combine the comfort of copy-paste with the power of the command line.</p><h3>A few examples</h3><p>These are just some use cases that I happened to cross lately. You will probably find yours by chance. (Usually after struggling with ⌘C/⌘V.)</p><p><strong>Saving an API key.</strong> For security, an API key is not stored by the web application that issues it. As a consequence, it is shown to you only once and you have to copy it (many applications provide a <em>Copy to clipboard</em> button) and save it somewhere. In my recent usage, I wanted to save the API key into a text file. I did that with</p><pre>pbpaste &gt; api-key.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hrgUU-jlUkGDCD9e1LqSw.png" /><figcaption>API Key creation dialog in <a href="https://decisionbrain.com/db-gene/">DB Gene</a></figcaption></figure><p><strong>Pasting to Excel.</strong> Another task I wanted to achieve was to copy the output of a command line to an Excel spreadsheet. For the sake of this example, imagine that you want to measure the weight of the sub-folders in your Documents folder, and copy that to Excel. Here is your command line:</p><pre>du -sh ~/Documents/* | pbcopy</pre><p>That line stores the output of the du command into your clipboard. All you have to do then is to select a cell in your spreadsheet and type ⌘V.</p><p><strong>Deduplicating lines.</strong> Before I learnt about the <a href="https://support.microsoft.com/en-us/office/find-and-remove-duplicates-00e35bea-b46a-4d5d-b28e-66a552dc138d#:~:text=Remove%20duplicate%20values&amp;text=Select%20the%20range%20of%20cells,want%20to%20remove%20the%20duplicates.">Excel feature to deduplicate values</a>, I would typically copy the cells I want to deduplicate into the clipboard, run the following command line, then paste the clipboard back to Excel.</p><pre>pbpaste | sort -u | pbcopy</pre><p>Note that, as a side effect, the command line above sorts the values alphabetically. I’ll discuss this and alternatives in another post.</p><h3>Why use commands rather than ⌘C/⌘V?</h3><p>The examples above can in most instances be performed using the keyboard shortcuts for copy/paste (or the menu entries for the mouse-inclined). However, there are two main reasons why I would want to use the <em>pbcopy</em> and <em>pbpaste</em> commands.</p><p>One reason is that it makes command lines self-contained. What I mean is that, by reading the command line, you can clearly see when the transfer between the clipboard and the command line happens. Granted, this argument is a matter of style, and may be discarded for one-shot commands. It becomes more relevant when you need to repeat the command several times in your workflow.</p><p>The other reason is that these commands preserve the exact content of the clipboard. This is especially important when such distinctions as between tabs and spaces matter—typically when copy-pasting in Excel. If you use your mouse and keyboard to select and copy the output of the du command above, you will get a variable number of space characters between the first and second columns. With pbcopy, you will get the exact output of du, that is, a tab character.</p><p>In the same vein, I noticed that when the content of the clipboard is too long, pasting it into the Terminal does not work well. This is typically a case where pbpaste is better suited.</p><p>That’s it for this post. Have fun with <em>pbcopy</em> and <em>pbpaste</em>, and share your smartest uses in comments!</p><p>Bruno is CTO at DecisionBrain. <a href="https://decisionbrain.com/">DecisionBrain</a> delivers custom decision support software that is used to solve the world’s hardest planning, scheduling &amp; logistics optimization problems. With over 400 person-years of experience in operations research and mathematical optimization, DecisionBrain helps where packaged applications fall short.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f61e1df72f67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decisionbrain/leveraging-the-macos-clipboard-on-the-command-line-with-pbcopy-and-pbpaste-f61e1df72f67">Leveraging the macOS clipboard on the command line with ‘pbcopy’ and ‘pbpaste’</a> was originally published in <a href="https://medium.com/decisionbrain">Decision Optimization Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Factor Test Code the JUnit 5 Way (That Is, Without Inheritance)]]></title>
            <link>https://medium.com/decisionbrain/factor-test-code-the-junit-5-way-that-is-without-inheritance-9ba2784d34?source=rss-5d1eb5897d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ba2784d34</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[junit-5]]></category>
            <dc:creator><![CDATA[Bruno Berstel-Da Silva]]></dc:creator>
            <pubDate>Fri, 18 Sep 2020 10:57:37 GMT</pubDate>
            <atom:updated>2020-09-21T08:29:59.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*MA3dLzbQZOggoSkzqS4_fQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@lastnameeaster?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">La-Rel Easter</a> on <a href="https://unsplash.com/s/photos/blocks?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>You write Java code, hence you write JUnit tests. Easy. But you write Java code with Spring, and testing is now getting complicated. However, you can work it out: you’re not the only one, there are good resources out there. It takes a bit of an effort, but you succeed in writing JUnit tests for your Spring services. Say you want to package this effort, to avoid duplicate code, and for next time. So you write a base class that all your Spring-based test classes inherit from. In this class, you perform the required Spring configuration, you install the JUnit hooks to execute before each test, and you add a few utility methods, too. And then your colleague tells you that inheritance in JUnit test classes is a code smell…</p><p><em>Side note: To be fair, Spring is not the cause of the complexity here. The culprit would rather be dependency injection, that is, the ability to define beans (components, controllers, services, repositories, etc.) declaratively, and have them reference each other without having to manage their instantiation and wiring. In this picture, Spring is just one way (and admittedly a good one) to implement dependency injection, and the efforts to configure that would be required with other dependency injection frameworks, too.</em></p><h3>Writing Spring-based Tests With JUnit 5</h3><p>Imagine that you are responsible for a Spring-based µ-service that manages a stock of books. The Spring components in your µ-service can roughly be divided into:</p><ul><li>The REST controllers that implement the endpoints called by the UI and/or other µ-services;</li><li>The services that implement your business logic;</li><li>The repositories that provide persistence of your entities to the database of your choice;</li><li>Additional out-bound components, such as a REST client to access your supplier’s inventory, or a web socket or information bus client to notify sibling µ-services.</li></ul><p>Among your JUnit tests, you have some simple ones that check the low-level functions of your business logic implementation, such as VAT computation. But you also have some more complex ones that aim at checking your service from a more global viewpoint. For example, that when a customer buys a book, there is one less in stock after than before; that if it was the last in stock, an alarm is raised; etc. You can recognise those tests by the fact that you probably had debates with your teammates about whether they could legitimately be called “unit tests”.</p><p>The challenge for these complex tests is that you want the code of your Spring services to execute, including when they call each other, as if they had been stimulated by a user interaction. However, you do not want to set up a real database, you have nowhere to send notifications, and you do not want to really connect to your supplier’s API. This is where the SpringRunner of JUnit 4, and the SpringExtension of JUnit 5, come into play. (Actually, the latter is specific to JUnit Jupiter, one of the engines for JUnit 5.)</p><p>In short, the two axes that you have to work along are: ensure that the Spring machinery runs, including bean instantiation and wiring; and ensure that it stops at the boundaries of your code under test. The first point is usually achieved by annotating your test class with</p><pre>@ExtendWith(SpringExtension.class)<br>@ContextConfiguration(classes = ComplexTestConfiguration.class)</pre><p>where ComplexTestConfiguration is a Spring configuration class in which you install the services under test and you mock the rest. It may look as follows</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10dc703ab56371d7f08aed5fff76fe97/href">https://medium.com/media/10dc703ab56371d7f08aed5fff76fe97/href</a></iframe><p>On line 2, we install the Spring services that we want to test. Lines 3–4 configure our MongoDB repositories to be used with an embedded implementation of the database, such as <a href="https://www.baeldung.com/spring-boot-embedded-mongodb">Flapdoodle’s one</a>. Lines 6–7 provide a stub to be used in lieu of the REST client to our supplier’s inventory. Similarly, lines 9–10 ensure that our notification service will run, although no message will be sent anywhere. Still, we will be able to check what this service sent to the web socket, using <a href="https://www.baeldung.com/mockito-verify">Mockito’s </a><a href="https://www.baeldung.com/mockito-verify">verify methods</a>.</p><h3>Introducing a Base Class for Test Classes (Wrong!)</h3><p>With the ComplexTestConfiguration configuration class (tailored to your needs) and the two annotations on the test class, you can write and run some tests that check the behaviour of the services that implement your business logic from end to end. Still, as you write more and more such complex tests, you will soon notice that you are duplicating code between test classes and methods, be it set-up code to install a starting environment for your tests, or some code patterns that you would like to factor.</p><p>In my case, for example, one of the repositories had been mocked in memory and needed to be emptied before each test. Also, I had written a couple of utility methods to decode the messages sent to the web socket and check that they matched my expectations. This resulted in some code that I wanted to share between all my test classes, do I ended up with having these test classes extend the ComplexTestBase class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17cb0eba84462d12bfe092941ffe6a5d/href">https://medium.com/media/17cb0eba84462d12bfe092941ffe6a5d/href</a></iframe><p>As a result, the test classes could read as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e7cf386d5e0123d6aa339b617372f51/href">https://medium.com/media/1e7cf386d5e0123d6aa339b617372f51/href</a></iframe><p>The ComplexTestBase class above gathers the Spring configuration annotations, the definition of JUnit hooks, and the utility methods. It is ready for use as a superclass by test classes that want to benefit from all these. Yet, <strong>it is not the recommended way to go</strong>. Why that?</p><p>To be honest, in simple cases, gathering the boilerplate in a superclass is not a problem in my opinion. It gets the job done, in a clean way, it is readable, maintainable, etc. However, as soon as you no longer are in a <em>simple case</em>, you hit the single inheritance wall. Then, if you want to stick to the inheritance model, you will start piling up superclasses in an arbitrary order, introducing unwanted dependencies, and basically ruining the encapsulation and maintainability properties just mentioned.</p><p>In my case, the situation occurred when we introduced an access control system to our services. We rapidly wanted to provide testing utilities that would allow the developers of all our µ-services to write tests against various permission set-ups. Without surprise, these testing utilities included: Spring configuration, JUnit hooks, and a handful of utility methods. This is precisely why JUnit 5 switched to the extension model.</p><h3>Switching to Extensions (and Annotations)</h3><h4>JUnit Extensions in Two Words</h4><p>Technically speaking, the role of an extension is to provide JUnit hooks. This includes the typical @BeforeEach, but also hooks for other points of the testing life cycle, including the injection of parameters to test methods, which is quite powerful and elegant. In addition, extensions introduce the <em>extension context</em>, a clean mechanism to store and convey state information across the tests life-cycle, and even between extensions, as we will see further below.</p><p>Here are three links that helped me:</p><ul><li><a href="https://www.baeldung.com/junit-5-extensions">https://www.baeldung.com/junit-5-extensions</a>: the basics</li><li><a href="https://blog.codefx.org/design/architecture/junit-5-extension-model/#Extension-Points">https://blog.codefx.org/design/architecture/junit-5-extension-model</a>: a detailed explanation and example</li><li><a href="https://stackoverflow.com/questions/56904620/junit-5-inject-spring-components-to-extension-beforeallcallback-afterallcall">https://stackoverflow.com/questions/56904620/junit-5-inject-spring-components-to-extension-beforeallcallback-afterallcall</a>: how to connect your extension with Spring</li></ul><h4>Putting Extensions Into Play</h4><p>The goal here is no different from above: package and deliver Spring configuration, JUnit hooks, and utility methods to test classes. What is new is that we are going to do it in a <em>composable</em> way.</p><p>We start by introducing an annotation that will replace the inheritance:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/909cea339abaf125c0a55062578a1d72/href">https://medium.com/media/909cea339abaf125c0a55062578a1d72/href</a></iframe><p>This is nothing revolutionary: we simply moved the two annotations from previous section into the @ConfigureComplexTest annotation (lines 3–4). Lines 1–2 are standard in annotation definitions, except perhaps the inclusion of ANNOTATION_TYPE in the targets. This is to leverage the <a href="https://blog.codefx.org/design/architecture/junit-5-extension-model/#Custom-Annotations">meta-annotation mechanism</a> in JUnit.</p><p>Using this annotation achieves the Spring configuration just as the base class, through to the unchanged ComplexTestConfiguration class. To also provide the JUnit hooks and our utility methods, we introduce a specific JUnit extension, which we include in the annotation (look at line 3):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7784956203a2af758c4790bdfb215a1/href">https://medium.com/media/f7784956203a2af758c4790bdfb215a1/href</a></iframe><p>In our case, all of the hooks in our extension will be dealing with Spring components. The first item in our agenda is thus to grasp a link to Spring’s application context. To this end, we add a hook that is called just after the test class instance is initialised, in which we retrieve the application context from the Spring extension.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2717b12aaf9b8ff0cb02eda3b97bb928/href">https://medium.com/media/2717b12aaf9b8ff0cb02eda3b97bb928/href</a></iframe><p>By having our extension class also implement BeforeEachCallback, we can add the hook that will execute before each test. Similar life-cycle hooks are added by implementing <a href="https://www.baeldung.com/junit-5-extensions#3-lifecycle-callbacks">the corresponding interfaces</a>.</p><p>To provide our utility methods, we will gather them in a Spring service and put this service at the disposal of test methods through a parameter. Let’s first introduce our service class. It is not very different from the base class of previous section:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90e64dd469cad3988cdb1791d78a5f8d/href">https://medium.com/media/90e64dd469cad3988cdb1791d78a5f8d/href</a></iframe><p>The last step is to augment our extension class so that it triggers the reset() method above before each test, and it provides the service as a parameter to methods that request them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3af8b3640fff8fdf5e7da0973360e3f3/href">https://medium.com/media/3af8b3640fff8fdf5e7da0973360e3f3/href</a></iframe><p>For line 17 above to actually return our helper service, you will need to augment ComplexTestConfiguration so that it scans the ComplexTestHelper class, typically by adding its package to @ComponentScan.</p><p>As a result of the above, here is how our test class would now read:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ae534babf854900bc2e2934dc840775/href">https://medium.com/media/9ae534babf854900bc2e2934dc840775/href</a></iframe><p>The main differences with the superclass version are:</p><ul><li>The inheritance is replaced with an annotation. Obviously, this can be repeated ad lib, while inheritance could not.</li><li>The inherited fields and methods are now accessed though the helper parameter.</li></ul><h3>Conclusion</h3><p>While the base class pattern is ok in simple situations, it is limited by the single inheritance model of Java. With annotations and extensions, JUnit Jupiter provides a composable solution to factor Spring configuration, JUnit hooks, and utility methods. (However, the hard part remains to properly configure dependency injection, in both cases.)</p><p>On our project, we applied the above pattern to the complex tests that address the business logic of each µ-service. We also applied it to package some testing utilities of our access control system. As a result, we could easily write tests that check the business logic of a µ-service under various permission settings: the test class simply bears two @Configure... annotations, and the test method takes to helper parameters.</p><p><em>Special thanks to my colleague Adrien Estran for pointing out the subject, for helping me in its implementation, and for proof-reading this story.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ba2784d34" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decisionbrain/factor-test-code-the-junit-5-way-that-is-without-inheritance-9ba2784d34">Factor Test Code the JUnit 5 Way (That Is, Without Inheritance)</a> was originally published in <a href="https://medium.com/decisionbrain">Decision Optimization Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Parallel Between Time Zones and Radices]]></title>
            <link>https://medium.com/decisionbrain/a-parallel-between-time-zones-and-radices-e5e185ace257?source=rss-5d1eb5897d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5e185ace257</guid>
            <category><![CDATA[timezone]]></category>
            <category><![CDATA[developer-blog]]></category>
            <category><![CDATA[radix]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Bruno Berstel-Da Silva]]></dc:creator>
            <pubDate>Mon, 03 Aug 2020 08:31:01 GMT</pubDate>
            <atom:updated>2020-08-03T08:31:01.619Z</atom:updated>
            <content:encoded><![CDATA[<p>Consider the total number of fingers of as many persons as there are fingers in one of your hand. That number exists independently of how you call it. In English, you call it <em>fifty</em>.</p><h3>50 = 101</h3><p>However, <em>fifty</em> is how you pronounce this number. How do you write it down, apart for this five-letter word?</p><p>In Roman numeration, you note it D. By the way, this is how it was noted in Europe until as late as the 13th century, when Leonardo Fibonacci popularized the <a href="https://en.wikipedia.org/wiki/Hindu%E2%80%93Arabic_numeral_system">positional numeral system</a> invented in India, based on the description by Muhammad al-Khwarizmi in the Arabic mathematics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*z56Yb7NoT33eh6NPntaJXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*pClGCMVxMfALwYppaigUag.jpeg" /><figcaption><a href="https://en.wikipedia.org/wiki/Muhammad_ibn_Musa_al-Khwarizmi">Muhammad al-Khwarizmi</a> and <a href="https://en.wikipedia.org/wiki/Fibonacci">Leonardo Fibonacci</a></figcaption></figure><p>In the decimal positional system, fifty is noted 50. Meaning 5 times ten plus 0 times one. The symbols 0 and 5 are a conventional notation, the factors one and ten come from the choice of the <em>decimal</em> system. Also called “radix ten”.</p><p>Let us choose another number as our radix, for example seven. To know how to write fifty in the radix seven positional system, we have to decompose it along the powers of seven. Fifty equals fourty-nine plus one, that is, 1 time seven times seven, plus 0 times seven, plus 1 time one. Hence, fifty is noted 101 in radix seven.</p><h3>Instants and their notations</h3><p>The previous example illustrates that on the one hand we have the numbers, such as fifty; and on the other hand we have the notations for the numbers, such as D, 50, 101, etc. There are many different notations for a given number, but it’s always the same number, independently of the notation system or of the radix if you choose a positional system.</p><p>In the same way, we have the instants and the notations for the instants. Consider for example the birth of <a href="https://en.wikipedia.org/wiki/Nadia_Com%C4%83neci">Nadia Comăneci</a>, which occurred in Romania on November 12, 1961 at <a href="https://www.astrotheme.com/astrology/Nadia_Comaneci">10 am</a>. At the very same moment in Papeete, French Polynesia, it was <a href="https://www.timeanddate.com/worldclock/converter.html?iso=19611112T080000&amp;p1=49&amp;p2=278">November 11, 1961 at 11 pm</a>. Different dates and time, but the same instant.</p><p>Here, time zones act in a similar way to radices in the previous example. The lead to a different notation, giving the impression that we’re not talking of the same thing. But regardless of the radix or time zone, it’s the same number or instant we’re taking about.</p><p>One additional thing that makes things even more difficult in the case of dates and time, is the fact that we have no common way of referring to an instant independently of any location. In the case of numbers, we can resort to the written form of the way we pronounce the number, like <em>fifty</em> (as opposed to 50, which assumes radix ten). In the case of instants, the best we can do it refer to the instant by something that happened then, like <em>the birth of Nadia Comăneci</em>. What we’re missing is Star Trek’s <a href="https://en.wikipedia.org/wiki/Stardate">“stardate”</a>.</p><p><em>This story reflects a discussion I had with my colleague Guillaume Vantroeyen while I was preparing a presentation on </em><a href="https://medium.com/decisionbrain/dates-time-in-modern-java-4ed9d5848a3e"><em>Dates &amp; Time in Modern Java</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5e185ace257" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decisionbrain/a-parallel-between-time-zones-and-radices-e5e185ace257">A Parallel Between Time Zones and Radices</a> was originally published in <a href="https://medium.com/decisionbrain">Decision Optimization Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dates & Time in Modern Java]]></title>
            <link>https://medium.com/decisionbrain/dates-time-in-modern-java-4ed9d5848a3e?source=rss-5d1eb5897d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ed9d5848a3e</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[timezone]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[date]]></category>
            <category><![CDATA[time]]></category>
            <dc:creator><![CDATA[Bruno Berstel-Da Silva]]></dc:creator>
            <pubDate>Thu, 14 May 2020 07:22:10 GMT</pubDate>
            <atom:updated>2020-05-18T12:56:35.697Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why do we have a hard time programming with dates and time?</h3><p>The answers to this question are numerous, but what we need in order to handle dates and time clearly is what in Star Trek is called “Stardate”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*zz6MfsOBXjIcSY3WmrFlCA.gif" /><figcaption><strong>Captain’s log, stardate 1313.8. </strong><a href="https://tv.getyarn.io/yarn-clip/5161947b-3d2a-47d0-8623-801ff54cbeb7">tv.getyarn.i</a></figcaption></figure><p>What a “stardate” provides is a way to refer to events in time independently of the location in space where these events are referred to. Without such a location-independent reference, we tend to confuse the actual moment where an event occurred with its description through days, hours, and — the most harming part — time zones.</p><p>How to properly handle time in software has always been a challenge. Here are only a few infamous bugs that occurred due to bad handling of time:</p><ul><li><a href="https://solarsystem.nasa.gov/missions/deep-impact-epoxi/in-depth/"><strong>NASA Deep Impact probe</strong></a><strong>: </strong>“Communication was unexpectedly lost” on August 11, 2013, 00:38:49 due to overflow in time measurement.</li><li><a href="https://www.iro.umontreal.ca/~mignotte/IFT2425/Disasters.html"><strong>US Army counter missile</strong></a><strong>: </strong>Rounding error due to bad representation of time caused a hostile missile get through the defensive line.</li><li><a href="https://appleinsider.com/articles/17/12/02/new-ios-bug-causes-some-devices-to-crash-on-dec-2-heres-how-to-fix-it"><strong>iOS 11.1.2 crash loop</strong></a><strong>: </strong>Daylight Saving Time causes reboot loop because of “missing” hour.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0sDPYdH0XcLqLYRb" /><figcaption>Photo by <a href="https://unsplash.com/@youssefsarhan?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Youssef Sarhan</a> on <a href="https://unsplash.com/s/photos/iphone?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>The Good News</h3><p>The good news is that modern Java (8 or later) gives us the tools to properly handle time concepts. The Date class before Java 8 was so confusing that, after being introduced, it was already reworked in Java 1.1. In 2005, the well-known third-party <a href="https://www.joda.org/joda-time/">JodaTime</a> introduced clear concepts and APIs for Java 5 to 7. In Java 8, the<strong> </strong><a href="https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html">java.time</a> package was openly inspired by JodaTime though totally re-architectured. (By the way, <a href="https://www.joda.org/">joda.org</a> recommends migrating to java.time if you are using Java 8 or later.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QOZdyDj61NYoRJHV" /><figcaption>Photo by <a href="https://unsplash.com/@clemhlrdt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Clément H</a> on <a href="https://unsplash.com/s/photos/java?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Instants vs. Calendar Points</h3><p>One of the key contributions of the Java 8 model is to separate instants from all sorts of calendar points. An <strong>instant</strong> is a moment in life, by nature independent of any location. It is often referred to as “a point on the timeline”. On the other hand, a calendar introduces all the usual concepts of human representation of time, from minutes to centuries. A <strong>calendar point</strong> is a combination of calendar concepts. Some of these combinations have names in the Java 8 model, like <strong>local dates</strong> such as March 24th, 2020, or <strong>local times</strong> such as 16:30.</p><p>While instants refer to a precise and unique point on the timeline, a calendar point is an element of discussion that refers to a more or less precise span in the representation of time of the persons who take part in the discussion — typically users of a software system. Take a precise enough calendar point, add a time zone to it, and you can translate it into an instant; and vice versa.</p><h3>How does Java 8 handle instants?</h3><p>An instant is a point on the timeline and is measured, as a Unix time (aka Posix time, aka Unix/Posix timestamps), by the number of seconds (or milliseconds) since Jan 1st, 1970 UTC.</p><p>There are two ways to handle instants with Java 8:</p><ul><li>Long integers, as returned by the good old System.currentTimeMillis(), are a good way to manage timestamps if you just need to store a timestamp and you don’t need to perform operations on timestamps beyond comparison or simple differences.</li><li>The java.time.Instant class in Java 8 encapsulates a unique timestamp and offers a collection of methods to create, handle, and compute on instants. Instants are typically built with<strong> </strong>.now() or with .ofEpochMillis(long).</li></ul><h3>How does Java 8 handle calendar points?</h3><p>The Java 8 model recognizes that in many cases, we want to talk about a date or a time without it relating immediately to an actual point on the timeline. Consider the following sentences: “France’s national day is July 14.” “All our shops across the world open at 9am and close at 6pm.” “This certification expires on Dec 31, 2021.” In all these sentences, the dates and times are expressed independently of any location. Symmetrically, they require a location to be mapped onto actual instants.</p><p>Java 8 provides three central classes (and many more useful enums and types) to express, handle, and perform computations on dates and times that do not correspond to a given instant:</p><ul><li>LocalDate: a date without a time, like April 28th, 2020.</li><li>LocalTime: a time without date, like 15:13 (or 15:13.30.123456789).</li><li>LocalDateTime: a date and time without a time zone, like April 28th, 2020 at 15:13.</li></ul><h3>The link between instants and dates, in real life</h3><p>The human-readable representation of instants requires calendars and time zones.</p><p>There are different calendars around the world: the one probably most commonly used has been standardized as the <a href="https://en.wikipedia.org/wiki/ISO_8601"><strong>ISO 8601</strong></a> calendar, and introduces minutes, days, months and years as follows:</p><ul><li>1 minute = 60 seconds. 1 hour= 60 minutes.</li><li>1 day = 24 hours = 86,400 seconds (modulo leap seconds—see below).<br>1 month = 28 to 31 days. 1 year= 12 months = 365 or 366 days.</li><li>1 day = 1 rotation of the Earth. 1 year = 1 revolution.</li></ul><p>The last two bullets above illustrate that there are two ways of defining days and years. The importance of taking into account both the mathematical definition and the astronomical one is because everything just works better if the two match.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/0*MFNqlAxo2-sKIIR5" /></figure><p>Let’s just take a side step and talk about a few different standards to <em>measure</em> time:</p><ul><li><strong>TAI</strong> (Temps Atomique International) is a precise measure of seconds as defined by the International System of Units.</li><li><strong>UT1</strong> (Universal Time 1) relies on the observation of the rotation of the Earth to define time using the average duration of one day. It tends to be somewhat slower than TAI.</li><li><strong>UTC</strong> (“Coordinated Universal Time”) increases at the same pace as TAI and is adjusted so that it does not differ from UT1 by more than 0.9s, by adding a leap second when needed. To date, it has been adjusted by 34 seconds.</li><li><strong>Unix time</strong> counts seconds from Jan 1st, 1970 UTC, without the leap seconds. It is the job of the instant-to-UTC converter to take leap seconds into account.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/0*X9CyY3R6aU8U27gC" /></figure><h3>Time zones</h3><p>A <strong>time zone</strong> is a set of rules for a region in the world in which it has been decided that the time is the same:</p><ul><li>UTC is the most neutral translation of instants in the ISO 8601 calendar. It is the primary time standard with respect to which time zones are defined.</li><li>A <strong>time-zone offset</strong> is the difference (in hours and minutes) from UTC. For example on January 1st, 2020: Paris = +01:00, Rio de Janeiro = -04:00, Hong Kong = +08:00.</li><li>A <strong>time zone</strong> is a function that provides an offset <a href="https://en.wikipedia.org/wiki/Time_in_France#History">for a given date</a>. It considers the time zone definition and daylight-saving time rules on the given date. It is denoted by a <strong>zone ID</strong>, such as Europe/Paris, America/Rio de Janeiro, Asia/Hong Kong. Time zones are political and can change over time.</li></ul><p>Converting between UTC and/or time zones is then “just” a matter of adding the offset provided by the definition of the time zone of interest, at the moment of interest.</p><h3>How does Java 8 handle dates?</h3><p>Now that we have addressed instants and calendar points separately, addressing human-readable dates with a time zone seems to become seizable.</p><p>For this, Java 8 introduces two classes:</p><ul><li>ZoneId implements the IDs of time zones. For example: ZoneId.of(&quot;Europe/Paris&quot;).</li><li>ZonedDateTime implements the human-readable representation of an instant in the ISO 8601 calendar, in a given time zone. For example: Instant.now().atZone(zoneId).</li></ul><p>The ZonedDateTime class provides lots of accessors such as .getMinute() or .getMonth() or .getYear() to retrieve the individual elements of the representation of a date.</p><p>Conversion from/to a string is provided by .format(DateTimeFormatter) and .parse(String, DateTimeFormatter). Conversion to another time zone is implemented by .withZoneSameInstant(ZoneId).</p><p>Importantly, there are methods that provide a safe way to perform operations on dates (and simplify programmers life!), such as .plusSeconds(long) or .minusDays(long).</p><h3>Good practices</h3><p>You may often read the following recommendation:</p><blockquote>“Many applications can be written only using <strong>LocalDate</strong>,<strong> LocalTime</strong>, and <strong>Instant</strong>, with the time zone added at the UI layer.”</blockquote><p>I share this point of view, even if application development in real-life brings some questions for this statement, such as:</p><ul><li>Which time zone? The browser’s time zone or the back-end time zone? And if the back-end’s: where does it come from? Does it depend on the user, on some other data? (You probably don’t want to depend on the time zone in which the server that hosts your application is running…)</li><li>In addition to the UI layer, time zone considerations will happen in the persistence layer. The representation of dates in databases is not always as clean as the Java 8 model. And the time zone of the database server should not have an influence.</li><li>Similar issues will happen when integrating with external systems, or even external file formats (who said “Excel”?).</li></ul><p>These questions, and others, will arise. Still, the reference representation in the application logic should usually be instants (or timestamps), or local date/time. Beyond implementation, I found this to be a guideline for a clearer design.</p><p>Moreover, it is important to understand and use the dates and time concepts and tools that Java 8 offers in order to correctly handle time in our software, and avoid errors that would result in undecipherable bugs, unpaid technical debt, and developer headaches.</p><p><em>This article was co-authored with my colleague Alexa Salles. Many thanks to her for her contribution.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ed9d5848a3e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decisionbrain/dates-time-in-modern-java-4ed9d5848a3e">Dates &amp; Time in Modern Java</a> was originally published in <a href="https://medium.com/decisionbrain">Decision Optimization Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When to (not) use mavenLocal() in your Gradle build script]]></title>
            <link>https://medium.com/decisionbrain/when-to-not-use-mavenlocal-in-your-gradle-build-script-6da03902f9df?source=rss-5d1eb5897d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6da03902f9df</guid>
            <category><![CDATA[nexus]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[gradle]]></category>
            <dc:creator><![CDATA[Bruno Berstel-Da Silva]]></dc:creator>
            <pubDate>Mon, 04 May 2020 08:26:08 GMT</pubDate>
            <atom:updated>2020-05-04T08:41:17.453Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j3G9dGLE81YrV13H.png" /><figcaption>Photo by Lavi Perchik on Unsplash</figcaption></figure><p>If you’re like me and you work in a company that uses <a href="https://gradle.org/">Gradle</a> as its build tool, you may have wondered, while writing the build scripts for your project, what exactly should go into that repositoriesblock. And in particular whether or not to include mavenLocal(), and if so where: as the first element? the last one?</p><blockquote><em>The short answer is that you don’t want to include it.</em></blockquote><h3>Repositories</h3><p>As you most probably know if you’re reading this, Gradle can leverage the <a href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">Maven system of components</a> (such as Java libraries) and repositories (such as <a href="http://sonatype.com/">Sonatype</a>’s Nexus). Using those, you just need to declare a dependency like the following in the build script of your Java application:</p><pre>dependencies {   <br>  implementation &quot;com.fasterxml.jackson.core:jackson-core:2.9.9&quot; <br>  <em>// ...</em> <br>}</pre><p>and Gradle will take care of retrieving version 2.9.9 of the core library of Jackson provided by FasterXML, and include it in the appropriate class paths when compiling or running your application.</p><p>This, provided Gradle knows where to look for this library. And that is precisely the point of the repositories block, that could typically read as follows:</p><pre>repositories {<br>  maven { <br>    url &quot;http://nexus.mycompany.loc/repository/internal&quot;  <br>    mavenCentral()<br>  }<br>}</pre><p>In therepositories block above, you state that when looking for a dependency, Gradle should first query the internal Nexus repository of your company, then the <a href="https://central.sonatype.org/">central Maven repository </a>at https://repo1.maven.org/maven2/ .</p><p>The central repository is where Gradle will find all publicly available libraries, such as Jackson. Your company may also use an internal repository to store the software components shared between projects, or between modules of a project.</p><p>Imagine that your application, in addition to Jackson, uses code from a shared library of DTOs for your project. Its dependencies could then read:</p><pre>dependencies {<br> implementation &quot;com.mycompany.myproject:common-dtos:1.0.0-SNAPSHOT&quot;<br> implementation &quot;com.fasterxml.jackson.core:jackson-core:2.9.9&quot;<br> // ...<br>}</pre><p>When compiling your application code, Gradle will look for the common-dtosand jackson-corelibraries, first in its <a href="https://docs.gradle.org/current/userguide/dependency_resolution.html#sec:dependency_cache">dependency cache </a>in your home directory, then in your company’s internal repository, then in the central Maven repository.</p><h3>Now, what about mavenLocal?</h3><p>Up to here, everything works as expected. Yet, you may come across some Gradle build scripts with a repositories block that would read as follows:</p><pre>repositories {<br>   maven {<br>     mavenLocal()<br>     url &quot;http://nexus.mycompany.loc/repository/internal&quot;     <br>     mavenCentral()<br>   } <br>}</pre><p>At first, this looks sensible: don’t query the internal or central repository if the dependency is already present in the local repository. Whatever “the local repository” may actually mean…</p><p>It turns out that the mavenLocal() repository is not the Gradle dependency cache. It is a repository where you can deploy components with ./gradlew publishToMavenLocal (assuming you use the maven-publish Gradle <a href="https://docs.gradle.org/current/userguide/publishing_maven.html">plugin</a>). Now, why would you like to deploy to a local repository? My take is, you don’t.</p><p>The typical case where I would consider using a local repository is to test a change in a shared library without publishing it to a repository visible to other people than me, so that I’m sure of what I publish, when I publish it. However, there are better ways to achieve that.</p><p>First case: the shared library that I want to test is in the same Gradle build as the code that uses it. (Let me remind that in Gradle parlance, a ‘build’ is the code base that is considered when running a command such as ./gradlew build. This is what Eclipse refers to as a workspace, or IntelliJ IDEA as a project.) In that case, where the common DTOs library is built from, say, a common-dtos subfolder of the project root, specifying the dependencies of the application <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:project_dependencies">as a project dependency </a>) is enough:</p><pre>dependencies {<br>  implementation project(&quot;:common-dtos&quot;)<br>  implementation &quot;com.fasterxml.jackson.core:jackson-core:2.9.9&quot;<br>  // ... <br>}</pre><p>Second case: the shared library is in a different Gradle build, typically its source code is in a different Git repository (let us name it common-components). Then I will use the <a href="https://docs.gradle.org/current/userguide/composite_builds.html#composite_builds">composite build </a>feature to instruct Gradle to use the version of the common components that I cloned, rather than the one from the repository, when building my application. To this end, assuming that I have cloned the two Git repositories next to each other on my disk (if not, it’s just a matter of setting up the right relative path), I simply have to add the following line in the settings.gradle file at the root of my application:</p><pre>includeBuild &quot;../common-components&quot;</pre><h3>Conclusion</h3><p>Although you may come across some Gradle build scripts that include mavenLocal() in the list of repositories where to look dependencies from, I cannot think of a good reason to do so. There are use cases where mavenLocal()could look like a solution, and maybe it was at a time when <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html#sub:project_dependencies">project dependencies </a>and <a href="https://docs.gradle.org/current/userguide/composite_builds.html#composite_builds">composite builds </a>were not available in Gradle. But now they are. Even worse: the official Gradle documentation warns about <a href="https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:case-for-maven-local">different issues </a>that could arise when using mavenLocal().</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6da03902f9df" width="1" height="1" alt=""><hr><p><a href="https://medium.com/decisionbrain/when-to-not-use-mavenlocal-in-your-gradle-build-script-6da03902f9df">When to (not) use mavenLocal() in your Gradle build script</a> was originally published in <a href="https://medium.com/decisionbrain">Decision Optimization Center</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>