<?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 Francesco Barbera on Medium]]></title>
        <description><![CDATA[Stories by Francesco Barbera on Medium]]></description>
        <link>https://medium.com/@barberaf84?source=rss-48ee12493a6b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eCG28i15wjgkPlomhPlMZg.jpeg</url>
            <title>Stories by Francesco Barbera on Medium</title>
            <link>https://medium.com/@barberaf84?source=rss-48ee12493a6b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 16:36:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@barberaf84/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[AI from the perspective of a non-tech person]]></title>
            <link>https://medium.com/@barberaf84/ai-from-the-perspective-of-a-non-tech-person-910735447747?source=rss-48ee12493a6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/910735447747</guid>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Francesco Barbera]]></dc:creator>
            <pubDate>Tue, 25 Apr 2023 08:56:45 GMT</pubDate>
            <atom:updated>2023-04-25T08:56:45.294Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1TO_ejB6KDdS7J88" /><figcaption>Photo by <a href="https://unsplash.com/@isword?utm_source=medium&amp;utm_medium=referral">Muha Ajjan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The exposition acquired by ChatGPT highlights to everyone (and with everyone, I mean people that do not have a pc, but only a smartphone) that there is another player in the technological world. The name of this player is artificial intelligence.</p><p>I am a software developer. But I don’t have specific knowledge or experience with artificial intelligence. Most of the projects in my career are related to what we can call ‘old fashion software’, two main kinds:</p><ul><li>projects where the goal was to provide an interface for the users to insert and view information</li><li>data exchange services.</li></ul><p>As mentioned, in these fools times when everyone has an opinion (or some doubts) about AI, I had many opportunities to talk with non-tech people, primarily friends, trying to answer their questions because I am the one able to whisper to computers.</p><p>So, I’m grabbing this opportunity to do some social analysis to understand a non-tech person&#39;s perception of AI and, in general, computers and software.</p><h3>A little bit of context</h3><p>We are talking about a small subset of all the AI software. Not only ChatGPT, but we can also talk about other services. Let’s give a little bit of context about the most known players:</p><ul><li><a href="https://en.wikipedia.org/wiki/DALL-E">DALL-E</a>: an image generation platform revealed by OpenAI in a blog post in January 2021.</li><li><a href="https://en.wikipedia.org/wiki/Midjourney">Midjourney</a>: another image generation platform first entered open beta on July 12, 2022.</li><li><a href="https://en.wikipedia.org/wiki/ChatGPT">ChatGPT</a>: a chatbot launched in November 2022. Our star.</li></ul><p>The list above includes only three of the hundreds of AI software released in recent years, but they are functional to my goal of describing the perception of a non-tech person because they are the software that most people know.</p><h3>The current state of the art</h3><p>Nowadays, everyone knows something about AI and how it is changing the world. Is it true? What is the current state of the software? How many of them are powered by AI? Let’s go a little deeper.</p><p>We can start taking a look at the <a href="https://www.thoughtworks.com/radar">ThoughtWorks Technology Radar</a> volume 27. The sections Tools and Platforms list some exciting resources, and, I believe, it can highlight how AI is used in the software industry.</p><p>Incredibly None of the tools and platforms actively use artificial intelligence to provide their services. Instead, six products enable future implementations, like tools to manage machine and deep learning models better. For this reason, we can argue that the listed tools are in preparation for a future full of artificial intelligence powered platforms.</p><p>We can continue with a list of the best software, products and tools of 2023 made by <a href="https://www.g2.com/best-software-companies/top-products">G2</a>. Only three products are somehow related to AI.</p><p>Of course, thousands of other applications on their site claim that AI is the beating heart of their features and that AI provides incredible value to the users. But probably, it is only a way to collect attention.</p><h3>The general perception</h3><p>An assumption is necessary: this analysis is not a well-done scientific report. people interviewed are only a few and related to each other. So I break down every basis of statistics, and the result should not be a complete picture. But it is acceptable for now. At least to explain some concepts I have in mind.</p><p>Back to our audience, everybody knows what ChatGPT is, and they have tried to use it. The questions asked are far away to involve a little intelligence. Something like: <em>what is the best Italian football team? </em>or <em>who is the president of the United States? </em>It is nice to see how these easy to answer questions manifest how powerful ChatGPT is to someone that does not have previous experiences with AI, but it also seems that the current power of IT, without AI, is not well known by the majority.</p><p>A special mention must be made about image generation platforms. The impact of those tools is incredible. Seeing the quality of the generated images is astonishing.</p><p>Furthermore, they listened to many and many news about how AI is changing the world and how everything will be different in the following years. Some of this news has a positive meaning, but some are full of suspicion.</p><h3>Doubts and fears</h3><p>Our culture is full of sci-fi movies proving that AI is bad. I don’t remember a book or a film that highlights the possible and incredible uses of it. But probably it is because they would be pretty dull.</p><p>So the main questions asked me are:</p><ul><li>Are these tools smarter than me?</li><li>Can they replace me at work?</li><li>I saw Terminator a couple of times. Is this Skynet?</li></ul><p>Of course, we don’t know how the future could be. Nowadays, many entrepreneurs and experts are asking to stop the research about AI, waiting to understand better the possible consequences and how to avoid the most catastrophic scenarios. But we can try to answer.</p><h3>Are doubts and fears real?</h3><blockquote>Are these tools smarter than me?</blockquote><p>Probably not, not now, at least. Questions that require only knowledge to be answered fit well with the current state of the tools. The images generated are great, but they could be better, and they require some adjustment by a human. Another example is that ChatGPT cannot explain if a truffle is a mushroom or tuber. Solving the puzzle is sufficient to check if the truffle looks like a potato or not. The truffle itself is similar, but the analysis of the entire plant (stem, flower) highlights that it is a different thing. So, with a little bit of elementary science:</p><ul><li>all the tubers have stems and flowers</li><li>the truffle does not have a branch or flowers</li><li>the truffle is not a tuber</li></ul><p>ChatGPT may be able to answer the question tomorrow, but for now, it is evident that it cannot perform complex reasoning.</p><blockquote>Can they replace me at work?</blockquote><p>Yes, definitely (And I hope so).</p><p>It is evident how AI powered tools are better than us solving repetitive jobs. And it is obvious as well how they can easily access all the knowledge they require. Question: is it not the same for computers?</p><p>In my humble opinion, computers have been replacing us since ’70. How many times have we implemented software to calculate the mortgage payment? Or how many applications are better than us solving complex math problems? These implementations have progressively moved the knowledge of the processes from people to machines. If you go to a bank today, I believe that none of the banking can calculate the repayment of a loan. Please do not take me wrong, but many of the people that work with computers are the interface between them and consumers because the interfaces are not good enough to be used by consumers by themselves. But, in the last years, interfaces of the web and mobile platforms improved a lot, so most of these kinds of operations can be done without the assistance of a human.</p><p>In these terms, the contribution of AI is to increase the number of problems a computer can solve. <strong>AI is another arrow developers can use</strong>, but for the final user, the <em>only</em> relevant aspect is the increase in the number of problems applications can solve. With standard algorithms, we can solve deterministic problems. Still, with AI, we can face more complex and non-deterministic problems, like driving a car or diagnosing an illness with incredible precision.</p><blockquote>I saw Terminator a couple of times. Is this Skynet?</blockquote><p>I do not have an answer to this question. I believe that no one has it.</p><h3>My 2 cents</h3><p>In my opinion, for now, AI is not changing how people interact with technology. It is a big step further, maybe a jump, but it is only a movement in a long walk. We need other paradigms, other tools and another mindset to really change something.</p><p>Instead, They can change how we write applications and the quality and possibility of these applications. As developers, writing an application faster and less costly will be possible.</p><p>About the fact that AI is replacing me, I hope so. I like IT, but I wouldn&#39;t say I am staying at work 8X5. In the future, it may be possible to decrease the working hours in favour of time spent with my family. Of course, it is a social problem we have to face as a society. Today is already possible to work less, our current production support that. But we must catch up with the need for a paycheck and have enough jobs for most of the community. In addition, work is still linked to the number of hours, so a conspicuous reduction in hours, at the same wage is impossible in this mechanism.</p><p>Maybe AI can help solve that issue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=910735447747" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The bright experience of building and using a design system in our application]]></title>
            <link>https://medium.com/design-bootcamp/the-bright-experience-of-building-and-using-a-design-system-in-our-application-436c323ac754?source=rss-48ee12493a6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/436c323ac754</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Francesco Barbera]]></dc:creator>
            <pubDate>Wed, 22 Mar 2023 14:05:40 GMT</pubDate>
            <atom:updated>2023-03-24T03:17:40.495Z</atom:updated>
            <content:encoded><![CDATA[<p>Design systems (DS from now) have become increasingly popular in recent years, and for a good reason, I can share. They provide fantastic benefits to the development process:</p><ul><li><strong>A standardised approach</strong> to designing and building products.</li><li><strong>Consistency and efficiency </strong>across teams and projects.</li><li><strong>Scalability</strong> because of their nature of building blocks.</li><li><strong>Collaboration</strong> on a visual artefact with different members of the team and the company.</li></ul><p>Beyond their practical benefits, building and using a DS can also be a bright and fulfilling experience for devs and designers.</p><p>Let me explain why.</p><figure><img alt="A design system is like the building blocks used to create incredible architecture." src="https://cdn-images-1.medium.com/max/1024/0*fTO6xuFLwb1-YB5k" /><figcaption>Photo by <a href="https://unsplash.com/@lh1me?utm_source=medium&amp;utm_medium=referral">HONG LIN</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>It’s not a product. It’s an asset (in the economic sense)</h3><p>What is the process of creating a DS? Is it the same process we implement to produce an application? Or is it somehow different?</p><p>To answer that question, it is crucial to understand that a DS has no value itself (of course, it is not valid if your company’s goal is to produce and sell a components library). It is not something your customer appreciate and care about. Most of the time, it is something invisible outside your organisation.</p><p>Starting from what an asset is, a standard definition is:</p><blockquote>An <a href="https://www.investopedia.com/terms/a/asset.asp">asset</a> is a resource with economic value that an individual, corporation, or country owns or controls with the expectation that it will provide a future benefit.</blockquote><p>A DS is not a traditional product but rather a collection of elements that can be used to create consistent, high-quality designs across a range of products or applications. It does not have a direct economic value, probably, it cannot be sold, but it can concur in generating other value in the future.</p><p>It typically includes things like visual style guides, UI components, design patterns, typography, colour palettes, and other elements that define the look and feel of an application or product. Designers and developers can use it to ensure that all aspects of an application are consistent and follow a unified design language. By creating them, organisations can help to ensure that their products and applications have a consistent and cohesive user experience, <strong>regardless of who is working on them</strong> or how they are being built. This can help to improve user satisfaction, brand recognition, and overall product quality.</p><p>So, to answer the question about creating a DS, I can say that the process is different. We need to balance the time spent implementing the components without falling into premature optimisation and without creating unnecessary elements that can be useful in the future.</p><p>Also, the users are different. Are our colleagues. It means that we have a faster feedback loop because the result of our effort can be appreciated (or criticised) by the company&#39;s developers.</p><h3>As a developer, why should I collaborate in the implementation?</h3><p>One of the most rewarding aspects of building a design system is the sense of ownership and pride that comes with it. When working on a product or project, it can be easy to feel like you’re just one small part of a more significant effort. But when you’re building a DS, you’re creating something that will be used by everyone on your team and potentially even beyond if it is distributed outside your company. This can be a powerful motivator as you work to create something that works well, looks good, and reflects your team’s values.</p><p>Another benefit of building a DS is collaborating with others. It requires input from various stakeholders, including designers, developers, product managers, and other team members. By working together to create a shared set of guidelines and components, you can build stronger relationships and foster a sense of camaraderie among your team. You’ll also have the chance to learn from others and expand your skills and knowledge.</p><figure><img alt="Like in a band, you can collaborate with people with different skills." src="https://cdn-images-1.medium.com/max/1024/0*6WS0Qd5dolyR0DmO" /><figcaption>Photo by <a href="https://unsplash.com/ja/@danielkcheung?utm_source=medium&amp;utm_medium=referral">Daniel K Cheung</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>As a developer, why should I use a design system?</h3><p>It can make your development process fast. Really fast. Every time with a DS, the team already has an answer to multiple questions:</p><ul><li>What is the aspect of that specific entity?</li><li>What information do I need to render in that component?</li><li>How should those components work together?</li></ul><p>In that way, the cognitive load to create a layout is significantly reduced. The process should be like composing the layout with the already implemented components, grabbing the backend data and providing them to the components.</p><p>Relatively easy, no?</p><p>It can also be a bright experience in itself. Because it provides a standardised approach to designing and building products, it can help streamline the design process and make it easier to iterate and experiment. With a well-designed and well-documented system, designers and developers can focus on creating new features and improving existing ones rather than worrying about reinventing the wheel every time.</p><figure><img alt="Hey, my hands perfectly fit that cable! Easy peasy work." src="https://cdn-images-1.medium.com/max/1024/0*El0TJ7dL0gaEP6S-" /><figcaption>Photo by <a href="https://unsplash.com/@will0629?utm_source=medium&amp;utm_medium=referral">Will Porada</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>And as a designer, why should I promote using a design system?</h3><p>One problem that most teams face daily is the different dialects spoken inside the company. Each different role uses other words to define the same thing. A ubiquitous language is hard to obtain and share across the company. It would be best if you had tools to support your chosen words. You need a design system!</p><p>DS provides the hidden ability to share complex concepts.</p><ul><li>What is this particular entity?</li><li>How is it defined?</li><li>What behaviour can be applied to that?</li></ul><p>Questions are easy to answer in a specific context and easier to share in the entire stack if you find the glue to keep the concept together and not up in the air. It can serve as a shared language between designers and developers, helping to bridge the gap between the two roles. This can lead to better collaboration and communication throughout the design process, which can help improve the final product&#39;s quality and consistency.</p><figure><img alt="Tougher is better." src="https://cdn-images-1.medium.com/max/1024/0*irgyQbgWgLaqoGOA" /><figcaption>Photo by <a href="https://unsplash.com/ja/@danielkcheung?utm_source=medium&amp;utm_medium=referral">Daniel K Cheung</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Conclusions</h3><p>Building and using a design system can also be an opportunity to give back to the design community. By sharing your system, you can help others learn from your experiences and inspire them to create their components. You can also contribute to open-source design system projects, collaborating with others worldwide to create something extraordinary.</p><p>In conclusion, in my opinion, building and using a design system can be a bright and fulfilling experience with numerous practical and personal benefits. Whether you’re just starting or looking to improve an existing system, the journey can be a rewarding one that helps you grow both as a designer and as a team member.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=436c323ac754" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/the-bright-experience-of-building-and-using-a-design-system-in-our-application-436c323ac754">The bright experience of building and using a design system in our application</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Linting Poet]]></title>
            <link>https://medium.com/keep-calm-and-code-on/the-linting-poet-61a9a46c06ec?source=rss-48ee12493a6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/61a9a46c06ec</guid>
            <category><![CDATA[lint]]></category>
            <category><![CDATA[good-coding-practice]]></category>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Francesco Barbera]]></dc:creator>
            <pubDate>Mon, 07 May 2018 08:09:38 GMT</pubDate>
            <atom:updated>2018-08-30T10:41:42.114Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is an article for developers that would work better and be better for the world. If you’re a manager, it’s worth for you and for the developer you know.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oVkD2o-cau48wwZz6OXNiQ.jpeg" /></figure><p>When I first look at a piece of code I immediately try to find an answer to the question:</p><p>Is it good?</p><p>To find out I can for example use an automated system.</p><p>There are a lot of tools that help us to measure code quality. One of these tools is Sonar Qube, that provides a static code analyser which offers a lot of useful data. In most cases, all this information must be reduced to a number that represents the general quality of the code we have written.</p><p>My last project’s code scored 7 points out of 10, yeeee!</p><p>This number is an abstraction based on some criteria that have previously been defined. But the hidden problem with abstractions is that they have a cost, and the cost is that we lose knowledge of what is happening beyond using them. Because of this it is difficult to find a generic value in a number that is the synthesis of other metrics.</p><p>What about inverting our point of view? Not trying to find metrics that our code must follow to be considered good, but finding something that at a first look tells us if we are going in the right direction.</p><p>In my opinion, when looking at a project, a function or a for cycle, we can immediately either appreciate it or not. Have we got an instance of Sonar Qube in our brain? I don’t think so. Instead, I believe that all the nights spent reading about proper programming techniques have trained our mind to work like Sonar Qube.</p><p>Is this the solution to all the pull request deep diving? No, of course. But for me it is the first step. For this reason, I try to grow a sort of taste for the code I write. And for example, looking at some code which I wrote one year ago makes me feel sad, probably because I now produce better code.</p><p>And what about the different approaches of my colleagues? It is quite impossible to have the same experience and so the same code-beauty meter. But I think that reasoning on code quality leads to a reciprocal improvement and a sort of automatic linting check.</p><p>In conclusion for me, the beauty of code is the first tool used to verify the quality of our work and appreciating a beautiful code helps us in finding a way to write better code. Futhermore thinking as a benefit software developer I’m studying and tracking how different metrics like Cyclomatic Complex is directly proportional to Carbon Footprint. The more you put cycles into cycles, the more you’re wasting energy. I’m collecting this data to prove that quality and code beauty is also impacting on the environment.</p><p>Enjoyed this post? <a href="https://goo.gl/sYjHyU">Subscribe to our newsletter</a> and get all updates delivered to your inbox in a handy once a month message!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61a9a46c06ec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/keep-calm-and-code-on/the-linting-poet-61a9a46c06ec">The Linting Poet</a> was originally published in <a href="https://medium.com/keep-calm-and-code-on">Keep Calm and Code On</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Move like butterfly, sting like a bee in the world of IT]]></title>
            <link>https://medium.com/keep-calm-and-code-on/moving-like-butterfly-sting-like-a-bee-in-the-world-of-it-15a61974e73b?source=rss-48ee12493a6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/15a61974e73b</guid>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Francesco Barbera]]></dc:creator>
            <pubDate>Mon, 08 Jan 2018 07:45:09 GMT</pubDate>
            <atom:updated>2018-08-30T10:42:47.810Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s3eymm2uPfxQr7jHuDf0xQ.jpeg" /></figure><p>Recently I had the opportunity of speaking with lots of students from the University of Computer Engineering. Some of them asked me about what technologies are being used outside the university. The first answer (and I think the most common) is that the library, the framework or the language is not essential. The most relevant things are the patterns (most of them invented in the 70’s) that are already in use and have a cyclic heap. Furthermore, I explained to the scared students that in the real world they will be able to apply all their knowledge to practical projects in a short time.</p><p>But is this true?</p><p>Is all the knowledge learned at university applicable in the real world? Or are there some concepts that were not invented in the 70’s and that have some relevance today? Let me start by saying that I agree with this last question!</p><p>During the past months I worked with a couple of teams who were used to applying a traditional waterfall approach to projects, and I helped them transition to an agile approach. Thanks to this work I was able to gain a deeper understanding of what agile really is. I could move some teams from waterfall approach to an agile one. I also realised that there is more out there than the patterns invented in the 70s, there is a transversal concept that fills all the layers of our workday.</p><p>Why?</p><p>Because some patterns are used more than others. Some languages take care of the majority of apps.</p><p>Starting from the bottom level of an application, Docker takes the primary role in DevOps practices. And one of the most appreciated characteristics of Docker is the possibility to restart a service in a very short amount of time.</p><p><em>Fail fast.</em></p><p>About the languages, JS takes the main role. JS is smart, functional and it requires a small amount of code to create all the common features that a general app needs. Object-oriented is over verbose, and it requires a lot of code to create small features. The code is overgeneralized with OO.</p><p><em>Make things fast, without early optimisation.</em></p><p>On a higher level, the organisation of the teams becomes less verbose. Autonomous structures arise. Teams become flat and without complex structures that slow communication. Agile approaches move from single groups to the whole organisation.</p><p><em>Small commandos create better work.</em></p><p>All three examples have a common point. And that is:</p><p><strong>lightness.</strong></p><p>I think that lightness is the approach that has emerged in the past few years.</p><p>Why?</p><p>Probably because the economic crisis has opened our eyes and Nicholas Taleb’s black swans has introduced the possibility of failure to us. So a philosophical concept takes the responsibility of ruling a lot of aspects of our thinking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*43VE-uIAOYs4L9NLYvpnQw.jpeg" /></figure><p>And so, through suffering the economic crisis and seeing black swans we had to evolve and act like boxers, who know they are strong and resistant, but also understand that a well-aimed blow can decree the end. And so we move towards the boxing glove, to avoid that it arrives with the maximum extension and maximum strength. In this way we are embracing danger and the concept of failure without trying to avoid it but with the profound belief of being able to mitigate it, preceding it.</p><p>In conclusion, if all these premises are correct, a rather new approach takes the lead role and many things that will come in the near future will follow the principle of lightness.</p><p>Enjoyed this post? <a href="https://goo.gl/sYjHyU">Subscribe to our newsletter</a> and get all updates delivered to your inbox in a handy once a month message!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15a61974e73b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/keep-calm-and-code-on/moving-like-butterfly-sting-like-a-bee-in-the-world-of-it-15a61974e73b">Move like butterfly, sting like a bee in the world of IT</a> was originally published in <a href="https://medium.com/keep-calm-and-code-on">Keep Calm and Code On</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React component contract driven testing]]></title>
            <link>https://medium.com/keep-calm-and-code-on/react-component-contract-driven-testing-cf7027526f81?source=rss-48ee12493a6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf7027526f81</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Francesco Barbera]]></dc:creator>
            <pubDate>Tue, 07 Mar 2017 11:48:19 GMT</pubDate>
            <atom:updated>2018-08-30T10:43:31.495Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cC66WVcHxy5Nw5QX1-hS5Q.png" /></figure><p>Finding the correct way to test a React component is no simple task. In the course of my career I have tried various techniques, some of which were useful and others that I now believe were a big mistake. In this post I would like to share my approach when testing a React component.</p><h3>A simple component</h3><p>Let’s begin with a small component. In the next gif you can see a modest element, used for example in an e-commerce site. The component shows the number of the items present in a bucket, a label, and a button that can take me to the checkout page. The component also presents a visual effect that resembles a <em>heart beat</em> for the items number. I can call it item counter (ItemCounter in code examples).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*ekkRphtRgK1qAo4JYAkDKA.gif" /></figure><p>The main characteristics of this component are:</p><ul><li>an items number</li><li>a label in the center</li><li>an action to perform when the button on the right is pressed</li><li>a visual <em>heart beat</em> effect</li><li>the color of the <em>heart beat</em> effect</li></ul><p>What else? are there side effects? Does it need to load some data on component mount / unmount? We can manage these after in the post.</p><p>Ok, I’ve now got all the necessary knowledge to implement it.</p><h3>Initial step: writing tests</h3><p>In order to write the code for this component I start with a TDD approach, and the first thing to do is to write tests. <strong>But what tests do I have to write to ensure that my component works as expected?</strong></p><p>There are a lot of things I can test such as checking that output html is as I expect. I experimented this in the early approach with React. The first time it seemed to be a good solution:</p><ul><li>write a component html output in test file</li><li>write all the possible output cases, for example changing a prop</li><li>write a component that solves all tests</li></ul><p>What is wrong in this approach? Every single change on a css brake my tests. And it was frustrating!</p><p>But this experience teach me something:</p><blockquote>Tests a single feature in a most isolate way as it possible</blockquote><p>This means that if my component receives 4 props I try to test each prop regardless of the others. For example, in the item counter component I write a test for the items number, one for the label and so on. This also means that I don’t test the side effects that a prop can generate, for instance I don’t check that if the label prop is provided at the item counter component the button is correctly rendered.</p><p>Testing single features independently does not provide a global view on the component. But on the other hand this practice stressed me out enough to build decoupled prop handlers, and this is a good idea.</p><h3>What to test?</h3><p>Before doing anything I have to think about what the features of the component are and what it exposes to the rest of the world, for example starting from public APIs. This exposure could be interpreted like a <strong>contract</strong> between the component’s creator and the component’s user.</p><p>Synthetically a contract is a list of agreements between two or more parts. In the same way, the features of React components are a series of common intentions that the component implements.</p><blockquote>Thinking about what to test means thinking about the contract that the component grants to his users.</blockquote><p>Let’s start with the list at the top of this post. To test React components I use <a href="http://airbnb.io/enzyme/">enzyme</a>. And I found it very useful.</p><h4>Items number</h4><p>This is quite simple, provide a number and check that the number is correctly rendered.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b483a41c94b12bcb522392cd241322a6/href">https://medium.com/media/b483a41c94b12bcb522392cd241322a6/href</a></iframe><p>Off course the test could be more sophisticated, testing that the number 2 appears in the correct position and not in the label for instance.</p><p>Other things? Yes, the itemsCount prop should have a default, zero for example, so test this situation too.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14c62f2a8ac798682433785ca20729cc/href">https://medium.com/media/14c62f2a8ac798682433785ca20729cc/href</a></iframe><p>And i think that is all for itemsCount prop.</p><p>For the label text the workflow is the same, so go on to the next feature.</p><h4>Button action</h4><p>When a user clicks on the button a provided callback should be called. To test this case I provide a spy created with <a href="http://sinonjs.org/">sinon</a> to the ItemCounter component. And after simulating a click on Button I expect the spy has been called.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f09a1e399771fae592341607d656dad/href">https://medium.com/media/2f09a1e399771fae592341607d656dad/href</a></iframe><p>And what about a default for onGoToCart prop? onGoToCart is a function so providing a default is not possible, but React with <em>isRequired </em>contract<em> </em>grants that a warning appears when nothing is passed. The component is sort of a statically typed function, so I don’t need to test the validity of the input. I think this is an important lesson that I have learnt using React: the pattern that React introduces is highly testable in a unit way, for instance most of the user interaction is testable in a simple way by simulating events on components.</p><h4>Component style</h4><p>Is it a good thing to test the style of a component? The first answer could be yes, because the rendering is certainly fundamental: it’s what users see that we have to care about. But testing style is not simple because styles are processed from browsers and in a unit test I can’t ensure that the result is exactly what I want to see. Adding tests that confirm that a style is as expected means duplicate style implementation in a component and in its test. This will make it brittle. If I add another style, I would have to put the exact same code in my test. And this is quite boring and useless because it brings me to a permanent test refactor that reduces the developer’s confidence about a test’s real utility.</p><p>The ItemCounter component has a prop to provide a color for the <em>heart beat</em> effect. Is it important in this case to check that the color is correctly applied? Of course it is. It’s a feature of my component.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8228ac281eed01cc6f04388a8833ebd7/href">https://medium.com/media/8228ac281eed01cc6f04388a8833ebd7/href</a></iframe><h4>Side effects</h4><p>A side effect can be something related to the lifecycle of a component, a function called on componentDidMount or componentWillUnmount. It’s possible to look at this element as a part of the component’s public APIs. So it becomes meaningful to test it. Enzyme enables me to force React component’s lifecycle methods using <a href="http://airbnb.io/enzyme/docs/api/ShallowWrapper/instance.html">instance</a> API. In this way, using a sinon spy, I can ensure that a certain function is called during component lifecycle.</p><h4>Summary</h4><p>In conclusion I believe that many items in React component can be tested so a useful first step could be to find the contract that your component exposes. Finding it means describing in a complete manner how the component works. In this way only a little part of what you are testing will be styles and layouts that you have to check manually.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf7027526f81" width="1" height="1" alt=""><hr><p><a href="https://medium.com/keep-calm-and-code-on/react-component-contract-driven-testing-cf7027526f81">React component contract driven testing</a> was originally published in <a href="https://medium.com/keep-calm-and-code-on">Keep Calm and Code On</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From tomatoes to trees]]></title>
            <link>https://medium.com/keep-calm-and-code-on/from-tomatoes-to-trees-ea468036db57?source=rss-48ee12493a6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea468036db57</guid>
            <category><![CDATA[environment]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[pomodoro-technique]]></category>
            <dc:creator><![CDATA[Francesco Barbera]]></dc:creator>
            <pubDate>Tue, 07 Mar 2017 11:08:46 GMT</pubDate>
            <atom:updated>2018-08-30T10:44:54.314Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YDUHeT_dHxSBNo6J1iSmmw.jpeg" /></figure><p>Very simply put, my day can be described as a series of actions with the intent of producing an effect: by writing this post for example, I am communicating something to the reader. However, not all actions produce a simple reaction: in some cases a side effect in also involved: I am writing this post on my Mac, and not all the power that the machine requires is transformed in computing power — a small amount of it turns into heat. This is not a desired effect (except in the winter season when it could be a good thing).</p><p>Is it possible to produce some kind of value through side effects? I believe so.</p><h4><strong>Producing recursive value</strong></h4><p>In some cases our society is able to produce value from a side effect of another process. For example cutting trees and working wood produces <strong>sawdust</strong> (side effect). A lot of sawdust. Many power stations have recently been built where I live (<a href="https://www.google.it/maps?q=morbegno&amp;bav=on.2,or.r_cp.&amp;bvm=bv.146786187,d.bGs&amp;biw=1680&amp;bih=989&amp;dpr=2&amp;um=1&amp;ie=UTF-8&amp;sa=X&amp;ved=0ahUKEwixttrksIjSAhUIShQKHdVGDNgQ_AUIBygC">Morbegno</a>) and most of them burn sawdust to produce electricity.</p><p>This process creates a lot of <strong>heat</strong> (side effect) that is used to heat water. The water is taken into homes to mitigate winter cold. In this case there is the side effect of a production which becomes the raw material of another process and is used to bring value in another sector. I often see many such side effects being produced also during my work as a developer.</p><h4><strong>Handling of side effect in the developer’s work</strong></h4><p>In order to maintain my focus I use the <a href="http://cirillocompany.de/pages/pomodoro-technique">pomodoro technique</a>. It is a useful way of ignoring distractions and stay focused on a single task. There are a lot of apps that can help you manage the “tomatoes” and not long ago i tried <a href="https://www.forestapp.cc/">Forest</a>. It’s a nice and simple app that includes some social features to share your “tomatoes” with friends.</p><p>But the characteristic that I appreciate the most is the possibility of planting real trees after a number of tomatoes. Trees are planted by <a href="http://www.treesforthefuture.org/">Trees for the Future</a> and I recently planted my first tree. In this way I make use of the side effect of the time during which I am writing code and I transform abstraction into trees.</p><h4>Scaling side effects</h4><p>Ok planting a tree with a lot of tomatoes is a nice, and rather strange, thing. But are there other, more disruptive ways to handle side effects? What about scaling this concept and turning many of side effects into something good for society? In the company where i work, <a href="https://mondora.com/">Mondora</a>, we have found an amazing system.</p><p>When we first approach a new customer, it often occurs that this customer will ask us for a discount. Instead of negotiating on a traditional discount, we propose to allocate part of the generated revenue to activities that produce value for society. With one customer for example, we requested them to plant 140 trees through an Italian company that offers this service, so that the value of the trees was equal to the discount we would have given. This is our general path, and we constantly receive much positive feedback from our customers. In this way we don’t only create value with our IT work, but we also develop a viral concept that allows the explosion of the energies that until now were wasted.</p><p>Have you or your company found a way of producing value through side effects? Get in touch and let us know!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea468036db57" width="1" height="1" alt=""><hr><p><a href="https://medium.com/keep-calm-and-code-on/from-tomatoes-to-trees-ea468036db57">From tomatoes to trees</a> was originally published in <a href="https://medium.com/keep-calm-and-code-on">Keep Calm and Code On</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I manage to remain highly committed]]></title>
            <link>https://medium.com/keep-calm-and-code-on/how-i-manage-to-remain-highly-committed-9bb9e837b248?source=rss-48ee12493a6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bb9e837b248</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Francesco Barbera]]></dc:creator>
            <pubDate>Wed, 08 Feb 2017 14:42:47 GMT</pubDate>
            <atom:updated>2018-08-30T10:44:09.907Z</atom:updated>
            <content:encoded><![CDATA[<p>A very interesting problem in the daily work of a developer is that of finding something that lets you stay connected with the real world, rather than just floating around in an environment made up of virtual things. In my own developer career this problem actually brought me to a temporary detachment from the IT world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WYmtFwXuFlzFrm_ljqBs5w.jpeg" /></figure><p>So after working as a developer for some years, I realised I was unable to find something real, something useful, that could be produced with my work. Every day was spent continuously resolving tasks, improving infrastructures and managing relations with customers without any idea about where my work was actually going and what the final goal was. Everything was virtual and nothing was connected to a real use case. I obviously had a general overview of what the software I was working on was related to, but it was only a limited view, it was not a real comprehension based on feedback from a real user.</p><p>My reaction was to look for a new job, in a completely different environment. Working as a carpenter was the first decision. This was an incredible switch to a really manual job. At first I was able to find more satisfaction in this kind of work: building things that people could use directly was fantastic. The things I made were also immediately appreciable objects and they made me proud of my abilities.</p><p>However, after some time I felt I needed yet another change. Another job that could really link me to customers in a more direct way. So I became a bartender. This was an amazing challenge for me: no time to think about a reaction, everything super fast. I learnt a lot during that period. Every day was a challenge for me and every situation I faced became a direct improvement of my skills. It was also a constant and strong motivation to do a better job.</p><p>I’m now back working as a developer, but how can I find such a strong motivation to continuously improve myself in this job? How can I make my daily work more real? And how can I traslate a world populated by classes and instances into something absolutely useful to someone?</p><p>One thing I am working on is embracing and understanding the needs of the final users. To embrace means to truly understand what my end customers have to do with my software, or rather, what they have to do in general, what problems they are facing, and how I can help them with the work I do. This “user focused” approach makes me feel constantly committed. For example, I recently experienced how answering questions from final customers is useful to understanding how they use the software I am developing. In many cases they tell me about their workflows and so I notice how an action that looks strange to me is the norm for those who use the software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*53G3yqoiYvzWaqHgcC7cfQ.png" /></figure><p>Another helpful approach is that of providing my customers with a constant vision on how to monetize my work. In order to do this I need to better understand what my customers do, what their strengths are and how I can help them achieve better results with their final users. Every single feature represents a deep thought on how it can help final users and how it can increase the value of the software. This concept also leads to a better evaluation and prioritization of future tasks.</p><p>In conclusion, the figure that emerges is that of the <em>software artisan</em> who is constantly in contact with his products. Furthermore, our work can be very detached from the real world but with some expedients we are able to keep a high commitment and continuously improve ourselves by applying more consciousness to our daily work. Getting closer to the figure of the <em>software artisan</em> could be a big step towards a real self improvement.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bb9e837b248" width="1" height="1" alt=""><hr><p><a href="https://medium.com/keep-calm-and-code-on/how-i-manage-to-remain-highly-committed-9bb9e837b248">How I manage to remain highly committed</a> was originally published in <a href="https://medium.com/keep-calm-and-code-on">Keep Calm and Code On</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>