<?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 Giovanni Chiodi on Medium]]></title>
        <description><![CDATA[Stories by Giovanni Chiodi on Medium]]></description>
        <link>https://medium.com/@chiodigiovanni1?source=rss-de233a6afe73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*xYQufpP8MBIznk-OTdGqDw.jpeg</url>
            <title>Stories by Giovanni Chiodi on Medium</title>
            <link>https://medium.com/@chiodigiovanni1?source=rss-de233a6afe73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 05:59:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chiodigiovanni1/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[An Iceberg Model for software delivery performance and innovation]]></title>
            <link>https://medium.com/@chiodigiovanni1/an-iceberg-model-for-software-delivery-performance-and-innovation-59cee01e6e84?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/59cee01e6e84</guid>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Mon, 17 Jun 2024 11:39:29 GMT</pubDate>
            <atom:updated>2024-06-17T13:19:01.403Z</atom:updated>
            <content:encoded><![CDATA[<p>TLDR: I used the iceberg model to work out negative and positive organisational alignment for software delivery performance and innovation. If the analysis is correct, then <strong>awareness of complexity is the underlying mental model explaining organisational trends in the software industry</strong>. By the same token, <strong>lack of such awareness leads to poor performance and innovation</strong>, passing through reliance on expert analysis, workforce fragmentation, predictive planning, and lack of communication. Don’t quote me for it, I’m not an expert, just trying to make sense of things.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*bcsZJeQWG8ww6HMGEw9QBQ.png" /></figure><p>In case you’re not familiar with the Iceberg Model, it is one of the tools employed in Systems Thinking to represent and make sense of complexity (the other important one being Systems Dynamics).</p><p>The assumption is that what we can observe (above the water line) is generated by underlining patterns and structures, ultimately leaning on mindsets (below the water line).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*b4N0APAba8eyq_VG.png" /><figcaption>Image from <a href="https://ecochallenge.org/iceberg-model/">https://ecochallenge.org/iceberg-model/</a></figcaption></figure><p>I tested this model to answer the question: <strong><em>what kind of configuration is conducive to software delivery efficacy and innovation?</em></strong></p><p>The question makes sense because there is no simple recipe, and organisations might invest large sums of money (and time) in transformation or innovation initiatives, only to snap back back to where they started once the programmes are over. This seems to suggest the existence of a sort of “attractor”, or stable state, to which org. tend to return despite interventions to change it. The idea, then, is that in order to produce change one needs to create another “attractor”, i.e. another org. alignment. And the Iceberg Model seems well suited to represent and visualise such alignments.</p><p>I will quickly build a positive alignment from the top down, using what I know about software and innovation, and then a negative one from the bottom up, to validate my reasoning. To note: <strong>this is nothing rigorous</strong>, although I must admit it makes a lot of sense.</p><h3><strong>Positive alignment</strong></h3><p><strong>Events</strong></p><p>At the top of the iceberg, we can place our intended results: software delivery efficacy and innovation. Because innovation is a very vague term, I will use org. <em>ambidexterity</em> instead, defined as:</p><ul><li>Efficacy in using existing knowledge</li><li>Capacity to discover and incorporate new knowledge</li></ul><p>In my opinion, software development and delivery is all about ambidexterity: we need to write code and run sophisticated operations, while at the same time keeping the pace with changing technologies, requirements and sector knowledge in general.</p><p>As for indicators of software delivery efficacy I will simply refer to the <a href="https://dora.dev/">DORA research</a>, as they are too many to list out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*z5Z0GiOBcOfPMvSeKsXBrw.png" /></figure><p><strong>Patterns of behaviour</strong></p><p>Both the DORA research and the <a href="https://www.amazon.es/Accelerate-Building-Performing-Technology-Organizations/dp/B0874BBBWD">Accelerate</a> book make strong references to Performance-Oriented Culture, in the Westrum culture model, as a predictor of software delivery efficacy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*TfOfn9gecUfSET5-" /><figcaption>Image from <a href="https://itrevolution.com/articles/westrums-organizational-model-in-tech-orgs/">https://itrevolution.com/articles/westrums-organizational-model-in-tech-orgs/</a></figcaption></figure><p>Because it describes culture in terms of patterns of communication, I will use this classification for the “patterns of behaviour” layer of the iceberg. And according to DORA, Accelerate, and others, we should select Performance-Oriented Culture for the positive alignment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*W8GOsq4Wiae0r8xtSGWESg.png" /></figure><p><strong>Structures (org. structure)</strong></p><p>We know that in the software industry there is an obsession with value flow optimisation. This effort has led to the development of the <strong>platform</strong> paradigm, where the structure of processes and teams are aimed at maximising the efficiency of interactions across different business units, so to maximise value flow. We can take <a href="https://academy.teamtopologies.com/">Teams Topologies</a> as an influential reference (in the tech. industry) of how to organise teams and business units for maximising value flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*JcGV_1I5AD__T0R4shmhpw.png" /></figure><p><strong>Structures (process/project paradigm)</strong></p><p>In my opinion, we should not only consider org. structures but also the structure of the processes implemented during projects and operations, i.e. the <em>paradigms </em>or blue prints they follow. Looking at the software industry, it’s no secret that <strong>agility</strong> is the primary process paradigm, intended as an iterative process where feedback loops inform the next steps. This can take various (and controversial…) forms, but the presence of cross-functional teams, iterations and learning from feed-back loops remains (or <em>should</em> remain) a constant of the core concept.</p><p>Other notable agile blue-prints are <a href="https://www.thinkwithgoogle.com/future-of-marketing/creativity/design-thinking-principles/">Design Thinking</a> or <a href="https://github.com/ddd-crew/ddd-starter-modelling-process">Domain-driven Design</a> , with an extra emphasis on experimentation, modelling and prototyping.</p><p>Agility, in all its forms, requires an <strong>adaptive approach to project management</strong>, since we are constantly learning from safe-to-fail experimentation and iterations throughout the delivery process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*mEP_fdU8LoYhDz3Eaqfo3A.png" /></figure><p><strong>Mindset (mental model)</strong></p><p>What type of mindset lays at the foundation for this alignment? I hope Dave Snoweden wont troll me on Linkedin if I use his <a href="https://thecynefin.co/about-us/about-cynefin-framework/">Cynefin</a> framework improperly, and even within a System Thinking context, which he seems to have a grudge against. But I will do just that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*nQ6XiZbwM3s0b9Y8SQstcA.png" /><figcaption>I added the red arrows to highlight the “chaos by complacency” dynamic</figcaption></figure><p>In Cynefin we are advised to proceed by safe-to-fail experimentations (probe-sense-respond) when we are within a Complex System domain. It seems to me natural, then, to state that <strong>agility reveals an underlying awareness of complexity</strong>.</p><p>This is not at all surprising, given that software itself is complex, as software delivery is. Again, I don’t want to try and be rigorous about definitions here, hence by <em>complex </em>I mostly mean that is hardly predictable due to the many variables and moving parts. That’s why we need automated testing and agility (and functional programming, to manage <em>side effects</em>, in themselves an indication of a complex system).</p><p>If you are in to Domain-driven Design, you’ll know the primary components of complexity in software (and probably like me still can’t source the original references for this):</p><ul><li>essential complexity: the complexity of the domain or problem the software applies to</li><li>accidental complexity: originating from architecture and code in trying to develop and deliver the software (tech. debt is part of this)</li><li>socio-technical complexity: the human, social and technological context where software is built, delivered and used</li></ul><p>So we can complete the iceberg placing <strong>complexity-awareness</strong> as the underlying mindset or mental model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*F2p6jJlzhXPKjMerHXuN5g.png" /></figure><h3>Negative alignment</h3><p><strong>Mindset and process paradigms</strong></p><p>We will build the negative alignment iceberg from the bottom, to check if what we said so far makes sense. Still referring to the Cynefin framework, we can place at the bottom a complicated or simple system as the underlying mental model. According to Cynefin, this will advise us to rely on expert analysis or categorisation.</p><p>By definition, analysis means to break down a problem to its components and address them separately, in a <strong>reductionist</strong> fashion. In fact, we expect the system or problem to be exactly the sum of its parts, and we disregard unintended side effects or emergent properties (we are not aware of complexity).</p><p>After we made our analysis, broke down the problem in its part, assigned them to other experts or implementors, all we have to do is to place the milestones and deliverables on a Gantt chart and control the implementation, following a command and control paradigm. In software, this is called “<strong>software manufacturing</strong>”, made within “features factories”. The pattern is to rely on a Business Analyst to gather the requirements, populate a Jira board with them, and task developers with implementation. The use of Agile methodologies like SCRUM do not prevent this pattern, as in practice there is no much room for analysis, experimentation and learning from feedbacks, while marching along sprints towards a fixed deadline. On the contrary, the adoption of Agile methodologies and SCRUM might provide a false sense of agility, and legitimise anti-agile approaches to software delivery.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*hQiRWZa9P5XZQ8nA0GzBhA.png" /></figure><p><strong>Organisation structure</strong></p><p>In terms of org. structure, reductionism and command and control attitude will result in fragmentation, i.e. the creation of isolated and specialised units focusing on a single expertise or business capability. That is to say, <strong>silos</strong>. And because we don’t recognise the importance of interactions between components, but we analyse and assign components to experts, silos just need to do their bit without being concerned about interacting with one another.</p><p>And because we rely on experts deciding what needs to be done, we also need to rely on <strong>implementors </strong>getting it done<strong>. </strong>This gives rise to a white-collar/blue-collars structure, with knowledge workers taking decisions and technicians implementing them. In such a setting, ivory towers are likely to emerge, where implementors are excluded from knowledge contributions, and feedbacks and learnings from the ground up are likely to be ignored.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*hpw0MPgQVaf1Z1TmI-GuyA.png" /></figure><p><strong>Patterns of behaviour (culture)</strong></p><p>In a scenario where experts makes decisions, silos need to only mind their field of expertise, reporting follow strict hierarchies, and the technical workforce is tasked with implementation within a predictive project management paradigm, there is no need for collaboration and exchange of information. Looking at the Westrum culture model, it is likely that such a company has a <strong>Power-oriented Culture</strong>. Depending on the level of maturity on standard processes, or reliance on prescriptive quality management system (i.e. ISO certifications), it might have a <strong>Rule-oriented Culture</strong>. That is to say, <strong>the accountability and focus of the enterprise is practically not on the outcomes or performance, but on respecting the instructions of either the managers or the processes</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*SRymgCpEU2HSzPOfsXau-g.png" /></figure><p><strong>Events (outcome for software delivery and innovation)</strong></p><p>Since the Westrum culture model refers to communication patterns, <strong>culture types that hinder the flow of information would result in hampering the discovery and incorporation of new knowledge</strong>. This is especially the case when we have strict reporting lines, silos that don’t communicate (or compete instead), and technicians that cannot share feedback upwards to the experts.</p><p>If we were dealing with an authentic complicated system or problem, as in manufacturing, the enterprise would still manage to be effective and competitive — it will just not be very innovative. <strong>But if the system or problem the enterprise is facing is instead complex (e.g. making software), then not only there will be a lack of innovation capacity but also a lack of delivery efficacy</strong>.</p><p>According to the Cynefin framework, <strong>when a complex problem is approached as a complicated or simple problem, then we might end up in chaos (i.e. chaos by complacency)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*4zKu1tMi73shAqsVnXwV6g.png" /></figure><h3>Conclusions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*bcsZJeQWG8ww6HMGEw9QBQ.png" /></figure><p>Awareness of complexity justifies the use of agility, iterations and safe-to-fail experiments, as appropriate response to complex problems, such as software delivery. This leads on adaptivity in planning and iteration-based implementations. The emphasis on cross-functionality and learning (from iterations) leads to supportive org. structures (platform-like), aimed at promoting interactions, communication and optimising the value flow. Communication patterns are expression of a Performance-oriented Culture where information is freely shared (psychological safety), and learning and innovation are promoted. This results in software delivery performance and innovation (ambidexterity).</p><p>On the contrary, not acknoledging complexity leads to a reliance on experts analysis. By definition, analysis results in reductionism (breaking down problems), and predictive planning (we don’t expect surprises). This will translate in an organisation structure composed of isolated business units (silos), strict reporting lines along hierarchies, and the tendency to separate knowledge workers (experts) from technicians (those tasked with implementation). The fragmentation and division of labour is likely to produce impeded communication patterns, with poor psychological safety, expression of either a Power-oriented or Rule-oriented Culture. With such impediments to information flow, it is unlikely to observe capacity for innovation (i.e. discovery and incorporation of new knowledge). Because software is complex, we’re also likely to observe inefficiency and chaos by complacency.</p><p><strong>What to do with this?</strong></p><p>If this analysis has any validity, then it provides useful hints on what to do to promote a positive alignment, given that deep transformation is hard and unlikely to yield results if not tackled strategically at many levels simultaneously:</p><ol><li>Train staff (and managers in particular) in complexity related frameworks (<strong>Cynefin, Systems Thinking, Theory-U</strong>)</li><li>Don’t rely on SCRUM as a surrogate for agility, but instead deepen the understanding of experimental approaches, collaborative modelling and prototyping (i.e. promote <strong>Design Thinking, Domain-driven Design and adaptive project management</strong>)</li><li>Train managers and HR on <strong>Team Topologies</strong>, so to gain an understanding of healthy teams structures and interactions (Domain-driven Design could be a strategic pre-requisite)</li><li><a href="https://amclin.github.io/devopsculture/kpis/westrum-cultural-survey.html">Monitor your company culture</a> regularly using the <strong>Westrum culture model, </strong>with the target of Performance-oriented Culture, or at least the one of eradicating pockets of Power-oriented Culture.</li></ol><p>Another interesting hint:</p><ul><li>In highly regulated environments (public sector, health, etc.), it might be unavoidable to operate within strict hierarchies and silos, due to enhanced accountability requirements. In this case, reliance on processes might provide an escape route from power orientation. With standard processes in place, at least the accountability is on them and not on whatever the manager or expert says. If processes are evidence-based, then at least we should have some psychological safety to discuss such evidence in pursuit of continuous improvement. If processes are aligned with performance (but they must be adaptive for this), then following them would enable performance without a true performance oriented culture, but only a rule oriented one. Needless to say, such processes are unlikely to emerge just by expert design. They should be collaboratively co-designed and co-created, involving the right expertise from top to bottom of the organisation. That is to say, when designing and assessing standard processes, the company should pretend to be a startup — horizontal, inclusive, experimental. For example, we could use collaborative modelling techniques as <a href="https://www.eventstorming.com/">EventStorming</a> to build collaboratively the delivery process and optimise its value flow. Once the processes are in place, there’s a chance that the company might result performant and innovative just by following the rules.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59cee01e6e84" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Collaborative Process Modelling (DDD!!!) for the Unbelievers]]></title>
            <link>https://medium.com/@chiodigiovanni1/collaborative-process-modelling-ddd-for-the-unbelievers-ceecfadda71a?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/ceecfadda71a</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[software-process-model]]></category>
            <category><![CDATA[process-modelling]]></category>
            <category><![CDATA[software-process]]></category>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Sat, 18 May 2024 08:19:51 GMT</pubDate>
            <atom:updated>2024-05-18T08:19:51.408Z</atom:updated>
            <content:encoded><![CDATA[<p>I was reading this book:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*MgAIdqkrOyVi8c11KxHDzw.png" /></figure><p>Because, what else to do on a Saturday morning while sipping coffee and the beach is 5 mins away?</p><p>And I came across this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*IigPB-Zzhs8sQcYre_9UxA.png" /></figure><p>Basically, they are talking about the ubiquitous language, and the whole Domain-driven Design idea. The first question is, why not mention it? We find the same <em>amnesia</em> in the BABOK. Why don’t mention DDD?</p><p>The second question: what on earth is Behaviour Engineering?</p><p>Answer: it’s a behaviour science model used to tweak performance in organisation, holistically. I like it. It’s a way to acknowledge and <em>tackle complexity </em>(the DDD subtitle).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FpvabSdWaTrk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DpvabSdWaTrk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FpvabSdWaTrk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/24c2735d6f121462cd4bfdbf0a918008/href">https://medium.com/media/24c2735d6f121462cd4bfdbf0a918008/href</a></iframe><p>But how it’s used in process modelling? Like this (from Wikipedia):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HuOzWHBFDkmGqqgI4_WLSw.png" /></figure><p>And what does a “behaviour tree” looks like?</p><p>It looks like this (from same page):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VmQHDqWsD6mebV-2tzjQqQ.png" /></figure><p>Note how the written requirements are already given, which begs the observation:</p><p><strong><em>Given</em></strong> that we are using the model <strong><em>to</em></strong><em> </em><strong><em>fix</em></strong> ambiguities in natural language descriptions, <strong><em>when</em></strong> we build the model <strong><em>after</em></strong><em> </em>the natural language description is provided, <strong><em>then</em></strong> we will either incorporate those ambiguities in the model or we will not be able to build the model due to those ambiguities.</p><p>Which begs a postulate:</p><p><strong><em>In order to effectively remove ambiguities in natural language descriptions of requirements, process modelling activities needs to happen </em>while<em> or </em>before<em> the natural language description is defined and finalised.</em></strong></p><p>Which begs another:</p><p><strong><em>Process modelling activities need to be</em></strong></p><ol><li><strong>collaborative<em> to enable different stakeholders to contribuite to it,</em></strong></li><li><strong><em>they need to be </em>visually intuitive<em> to enable immediate feedback and agreement,</em></strong></li><li><strong><em>and they need to be </em>easily modifiable<em> to remove sunk costs and enable cheap on the spot adjustments.</em></strong></li></ol><p>Is behaviour engineering modelling meeting our requirements as a process modelling techniques?</p><p>Zooming in on the components of the tree:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*dZP5dXRd_NXizwIAL0lQVA.png" /></figure><p>It looks to me it is more like a proper engineering tool rather than a collaborative process modelling tool. In fact, I discover it is used by engineers in AI and gaming. And you can even build it graphically and integrate it with the actual program:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FjhB_GFgS6S0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DjhB_GFgS6S0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FjhB_GFgS6S0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/49ad6370bb69bd4c924050cc553b098f/href">https://medium.com/media/49ad6370bb69bd4c924050cc553b098f/href</a></iframe><p>So imagine, you do <strong>ONE</strong> thing right:</p><ul><li>You realise there is ambiguity in language descriptions of requirements, and that you need some form of process modelling to remove it</li></ul><p>But then you follow it up doing <strong>FOUR</strong> things wrong:</p><ul><li>You fail to acknowledge that this problem was tackled by a very influential book (the blue book by Eric Evans), that became mainstream in the software industry as Domain-driven Design (on what planet one can be a software process expert, address complexity and ambiguities in requirements and design, and <strong><em>not</em></strong> point to DDD??)</li><li>Because of that, you suggest a process modelling technique that is not collaborative, has a complex visual grammar, and a structure (the tree) with a lot of sunk cost for changes</li><li>Because you sound very formal and scientific, you convince the managers to incorporate the flow in the standard operation processes</li></ul><p>Which results in:</p><ul><li>Your best developers will search for another job</li></ul><p>Instead, let’s put together an happier path:</p><ul><li>You realise there is ambiguity in language descriptions of requirements, and that you need some form of process modelling to remove it</li><li>You get in to Domain-driven Design and learn how this problem is tackled, because this is how the software practitioners are trying to solve it</li><li>You realise that requirements and process modelling need to feed back on each other, and that morph progressively in to design (architecture and code)</li><li>So you <strong>DON’T</strong> enforce a sequential separation between requirements, process modelling and solution design</li><li>You acknowledge that the tools for process modelling need to be collaborative, visually simple and intuitive, and easy to modify</li><li>Because you also have DDD on the radar, you will not miss techniques such as <a href="https://domainstorytelling.org/">Domain Storytelling</a>, <a href="https://www.eventstorming.com/">EventStorming</a> and <a href="https://eventmodeling.org/">Event Modelling</a></li><li>You convince your high level suited manager to accept the sticky notes, the collaboration, and the fancy colours</li><li>You train your delivery team on process modelling techniques, in software design, and how to link the two. In essence, you train everybody on DDD</li><li>Actually, you create a Behaviour Engineering model to assess what is preventing your team to perform</li><li>Then your DDD-trained workforce will surely help you to optimise the value flow using process modelling techniques to remove bottlenecks, optimise queues, and optimise org. structure with <a href="https://teamtopologies.com/">Team Topologies</a></li></ul><p>There’s always so much to explain. And the beach is 5 mins away…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ceecfadda71a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A DIY state management solution for Angular 2+ (aka how I stop subscribing)]]></title>
            <link>https://medium.com/@chiodigiovanni1/a-diy-state-management-solution-for-angular-2-aka-how-i-stop-subscribing-82f367369da9?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/82f367369da9</guid>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[ngrx]]></category>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Tue, 22 Oct 2019 00:58:44 GMT</pubDate>
            <atom:updated>2019-10-23T08:54:35.471Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*6eEAXEyKp5YtsM3YmNxFRQ.jpeg" /></figure><h3>A DIY state management solution for Angular 2+ (aka how I stopped subscribing)</h3><p>I always thought using services and dependency injection in Angular was tidy enough for me, and even felt a bit sorry for the React/Redux folks who had to go so esoteric with state management. Until of course behavior subject after behavior subject, and subscription after subscription, the app took a life of its own and there was no way to tell why and how it did what it did. Which is nice, that kind of ‘it’s alive!!’ feeling, but I suspected it could also get me fired somewhere along the line.</p><p>So I learned more advanced techniques with RXJS, dived in to tutorials on NGRX, and came out on the other side as an enlightened being. The Knowledge transformed completely my development patterns, from imperative to reactive, also including a tailor made state management system. The big question is obviously: why not use NGRX or other state management libraries?? Possible answers:</p><ol><li>You can do wonders with RXJS and the right patterns, I like to see that inner workings exposed rather than wrapped in to a black-box.</li><li>You code exactly what you need, rather than deploying a sophisticated library that might go well beyond the scope of the problem you’re trying to solve.</li><li>Overall you have more control over your own code, can tweak and tune as you see fit, and have deeper awareness of what’s going on.</li><li>You just have to get familiar with RXJS, which is complicated enough at first, rather than making it a two step process — learn RXJS than NGRX than finally you can manage your state. In a nutshell:</li><li>It’s way simpler (and fun).</li></ol><p>The major downsides of a DIY solution is of course less tested and safe and also less practical to adopt within a team compared to a standardized tool. In the project I’m working we’re just two, and unfortunately for my team mate I’m the lead, so I see no issue in experimenting a bit (satanic laughter). Let’s see what I’ve got.</p><h3>It’s all about patterns and consistency</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*qxtYGB4sNHNBTENMrEkv6A.png" /></figure><p>The first thing to be clear about is the abolition of subscription at the component level. We only use the async pipe to tap in to the data. And only in a container component, which then passes data as Input() variables to its children, which are almost religiously stateless.</p><p>Children stateless component comunicate back to the container component only through simple event emitters (Output()).</p><p>Basically only the container component ‘sees’ the State, and only the container component handles events. This makes the app reactive, the children components reusable, and the logic easy to locate.</p><h3>The STORE, overall</h3><p>The STORE is made up of 3 files, reflecting a typical structure STATE, ACTIONS and REDUCERS:</p><ol><li>An injectable state.service.ts, which contains the STATE of the app (more likely of the single feature at hand), methods to fetch data from the backend and more or less esoteric observables manipulating data. All this is private, while it exposes: 1) slices of the state through observables made out of a behavior subject; 2) a method that takes an ACTION (with a payload), the current state and feed that to the proper REDUCER in order to update the state.</li><li>An actions.ts where all the actions and relative payloads are defined. These are NGRX-style actions, which means they are classes with a readonly ‘type’ property, and a ‘payload’ property which is typed specifically for each action.</li><li>A reducers.ts file with the actual functions transforming the old state in to the new state, depending on the action type and its payload.</li></ol><h3>How it works (let’s to do app)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvfYNcjMQ7RxDDAFixF7PA.gif" /></figure><h4>The State Service:</h4><p>Let’s have a quick look at the state.service.ts</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25d5de458f42919ee805b321f784236a/href">https://medium.com/media/25d5de458f42919ee805b321f784236a/href</a></iframe><p>In a nutshell, this is what we’ve done here:</p><ol><li>We created a local variable (_state) that holds the state, according to a state interface.</li><li>We created a private store behavior subject initializing it with _state.</li><li>Out of the behavior subject we created a private sate$ observable.</li><li>We then exposed part of the state via public observables (toDos$ and selectedToDo$), selecting what we need with the pluck operator. Everytime the state is updated these observable will emit the new partial value.</li><li>We have a private method (loadData()) that will initialize the data, possibly fetching it from the back end.</li><li>Another private method (updateState()) will both update the local _state variable and the state$ observable via the expression this.store.next(this._state = {…newState}).</li><li>Finally, we defined a public method for executing actions (execute()) that will mobilize our reducers class to mutate the state and than update it.</li></ol><p>From outside, the only things that the service exposes are slices of the state as observables and the execute function to perform actions.</p><h4>The Reducers class:</h4><p>From here we expose a method (reduce()) that takes an action and the current state, switching it depending on the action type to the right reducer function and returning the new state. It’s very clean to use.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e52cc969c8cc42a46430c100b460c1fb/href">https://medium.com/media/e52cc969c8cc42a46430c100b460c1fb/href</a></iframe><h4>The Actions definitions:</h4><p>Here we provide all our definitions for the actions and their relative payloads. Although tedious, defining the types comes very handy and makes the communication between the components, the state service and the reducers much more predictable and reliable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f447a38d749123ead11fb70accc6b5d7/href">https://medium.com/media/f447a38d749123ead11fb70accc6b5d7/href</a></iframe><h4>The container component:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/04e5ebdabbf58550df7b1012b42fbad4/href">https://medium.com/media/04e5ebdabbf58550df7b1012b42fbad4/href</a></iframe><p>In the html of the component we use the async pipe to subscribe to the observables defined in the state service and pass their values as inputs to the children components.</p><p>We also listen to the childrens event emitters, so that in the .ts of the component we can: 1) build actions with their payloads and 2) pass the actions back to the state service for processing using its execute() public method.</p><p>This will result in a state update and automagically will update our view.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d25d288747afcf7e2fffe52769e03ba/href">https://medium.com/media/6d25d288747afcf7e2fffe52769e03ba/href</a></iframe><p>Thoughts? Comments?</p><p>So far this pattern has served me well and hope I wont regret adopting it. In the long run I’m pretty sure I’ll be using NGRX so to be more ‘professional’, but still it is fun trying to work it out just with RXJS, it leads you to understand better what are the problems that opinionated libraries are trying to solve. I will probably discover that soon :)</p><p>Full code example here on GitHub: <a href="https://github.com/JoniWanKenobi/simple-state-management">https://github.com/JoniWanKenobi/simple-state-management</a></p><p>PS — I really recommend these two videos below and must thank and praise their authors, because by looping them for hours I finally understood Rxjs:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fh-F5uYM69a4%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dh-F5uYM69a4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fh-F5uYM69a4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2064291ae66cacb717bb2c7b966522ed/href">https://medium.com/media/2064291ae66cacb717bb2c7b966522ed/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FZ76QlSpYcck%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZ76QlSpYcck&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FZ76QlSpYcck%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0666abc27c54c3d3734d10507aa9020/href">https://medium.com/media/a0666abc27c54c3d3734d10507aa9020/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82f367369da9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A simple “on scroll” sticky menu with Angular and Bulma]]></title>
            <link>https://medium.com/@chiodigiovanni1/a-simple-on-scroll-sticky-menu-with-angular-and-bulma-66fafc7fc7b9?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/66fafc7fc7b9</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[bulma]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Sat, 09 Jun 2018 11:22:23 GMT</pubDate>
            <atom:updated>2018-06-09T11:22:23.031Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*2TPwwYkGuYopvedzRvz-EA.gif" /></figure><p><em>This has been bothering me for a while and I tried different methods to achieve the cool sticky menu that stays fixed on top when the page gets scrolled. I just saw the light yesterday night at midnight while the owl was hooting, so I better fix the mystical vision in to instructions before it disappears.</em></p><p>So we have an Angular app and we want part of the menu to stay fixed at the top when scrolling down. For convenience, I will put everything in to a single navigation component, which has the main navbar, the sticky menu and the very long fake content that will allow us to scroll down.</p><p>The template looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/75d3ef6a6b5005936fac3d912799ff1c/href">https://medium.com/media/75d3ef6a6b5005936fac3d912799ff1c/href</a></iframe><p>In the css bit of the component we create a “sticky” class (which makes elements fixed on top):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/04c181b013af7ff2517bb474d368beaa/href">https://medium.com/media/04c181b013af7ff2517bb474d368beaa/href</a></iframe><p>We will apply the sticky class to the sticky menu only if the scroll has reached a certain point; we still don’t know how to figure that out but pretending we do we assign the state of that condition to a boolean “sticky” and we apply the class to the menu depending on it.</p><p>In the template:</p><pre>&lt;!-- this is the sticky menu --&gt;<br>&lt;div class=&quot;tabs is-centered is-fullwidth&quot; <br>    <strong>[class.sticky] = &quot;sticky&quot;</strong>&gt;<br>    &lt;ul&gt;<br>        &lt;li class=&quot;is-active&quot;&gt;&lt;a&gt;Pictures&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a&gt;Music&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a&gt;Videos&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a&gt;Documents&lt;/a&gt;&lt;/li&gt;<br>    &lt;/ul&gt;<br>&lt;/div&gt;</pre><p>In the ts:</p><pre>sticky: boolean = false;</pre><p>And “sticky” should become true when this happens:</p><ul><li>The scroll of the page ≥ the initial top Y position of the menu DOM element;</li></ul><p>So here’s what we should do:</p><ul><li>On init, grab the Y position of the menu DOM element</li><li>Listen to scroll events and evaluate the condition we said above</li></ul><p>Yes, this implies we need to work with DOM elements and weird event listeners in Angular. To do that properly we need to use the decorators @ViewChild and @HostListener.</p><p>To grab a DOM element we first attach to it a variable in the template:</p><pre>&lt;!-- this is the sticky menu --&gt;<br>&lt;div class=&quot;tabs is-centered is-fullwidth&quot; <br>    <strong>#stickyMenu</strong><br>    [class.sticky] = &quot;sticky&quot;&gt;<br>    &lt;ul&gt;<br>        &lt;li class=&quot;is-active&quot;&gt;&lt;a&gt;Pictures&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a&gt;Music&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a&gt;Videos&lt;/a&gt;&lt;/li&gt;<br>        &lt;li&gt;&lt;a&gt;Documents&lt;/a&gt;&lt;/li&gt;<br>    &lt;/ul&gt;<br>&lt;/div&gt;</pre><p>Then we need to tell Angular to watch that dude and to give us access to its DOM elements properties:</p><pre>@ViewChild(&#39;stickyMenu&#39;) menuElement: ElementRef;</pre><p>We now have a new variable “menuElement” wich is our actual sticky menu DOM element. So on component init we can check its Y top position and store it in another variable. Rather than using ngOnInit, when working with DOM elements it’s safer to use ngAfterViewInit so to be sure we execute code after the view has been rendered:</p><pre>menuPosition: any;</pre><pre>ngAfterViewInit(){<br>    this.menuPosition = this.menuElement.nativeElement.offsetTop<br>}</pre><p>If we want to listen to the window scroll event we use the @HotListener decorator:</p><pre>@HostListener(&#39;window:scroll&#39;, [&#39;$event&#39;])</pre><p>That we use to decorate the function we want to execute when the scroll event occurs:</p><pre>@HostListener(&#39;window:scroll&#39;, [&#39;$event&#39;])<br>    handleScroll(){<br>    }</pre><p>The handle scroll function should:</p><ul><li>Grab the window scroll position</li><li>Evaluate if it’s bigger than menuPosition</li><li>Change the sticky boolean accordingly</li></ul><p>In code words:</p><pre>@HostListener(&#39;window:scroll&#39;, [&#39;$event&#39;])<br>    handleScroll(){<br>        const windowScroll = window.pageYOffset;<br>        if(windowScroll &gt;= this.menuPosition){<br>            this.sticky = true;<br>        } else {<br>            this.sticky = false;<br>        }<br>    }</pre><p>Et voilla. Here’s the complete code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7859083c1ea2b6dba52f88b8c260f68d/href">https://medium.com/media/7859083c1ea2b6dba52f88b8c260f68d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8a17e03cfa2f8bc0c45ab7785b343be/href">https://medium.com/media/d8a17e03cfa2f8bc0c45ab7785b343be/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/226959c60f933967aed8ecc350d19d5d/href">https://medium.com/media/226959c60f933967aed8ecc350d19d5d/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66fafc7fc7b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A customisable Angular Google Maps autocomplete component (with Bulma CSS)]]></title>
            <link>https://medium.com/@chiodigiovanni1/a-customisable-angular-google-maps-autocomplete-component-with-bulma-css-699325ac4595?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/699325ac4595</guid>
            <category><![CDATA[bulma]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[google-maps]]></category>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Sat, 28 Apr 2018 06:13:35 GMT</pubDate>
            <atom:updated>2018-04-29T07:09:44.592Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*uwV0Jl8BN_RfbDRFMhzAnw.gif" /><figcaption>The end result</figcaption></figure><p><em>Once again, as a beginner developer I assumed that building an address autocomplete in 2018 was something trivial. And, once again, I was wrong. Even if Google kindly provides us with even an autocomplete DOM component, the bottom “powered by Google” image looks awkward to say the least. I found equally awkward placing a CDN link in my index.html for a JS script I needed to load only for a single component; and equally awkward to use an ng package (</em><a href="https://angular-maps.com/"><em>AGM</em></a><em>) for using an external API; …and equally awkward to use an </em><a href="https://www.npmjs.com/package/@google/maps"><em>npm package</em></a><em> to make HTTP calls from Angular only to that specific API. At the end of a few days struggle, I ended up building my own customisable autocomplete component, just using Angular as it comes out of the box, and of course Bulma CSS. This is a report from the battlefield — and a tutorial too, if you want to build it yourself.</em></p><h3><strong>1 — Project set up</strong></h3><p>On a folder of choice, on a computer of choice, type the following:</p><pre>ng new ng-gmap-bulma-autocomplete</pre><p>This will create a new Angular project called ng-gmap-bulma-autocomplete, provided you have Node.js and Angular CLI there. Sorry for the length of the name, better be clear on what it is. Feel free to call it however you want, even tho it might not respond you.</p><p>Next, we must install all the external packages we’ll need:</p><pre>...</pre><p>Nothing there, because: this is Sparta.</p><p>I really wanted to say that, but in reality we need to install Bulma CSS:</p><pre>npm install --save bulma </pre><p>And add it to angular.cli.json file:</p><pre>.....</pre><pre>&quot;styles&quot;: [<br>    &quot;../node_modules/bulma/css/bulma.css&quot;,<br>    &quot;styles.css&quot;<br>    ],</pre><pre>.....</pre><p>Move on to the project folder and create a new component:</p><pre>ng g c components/autocomplete</pre><p>Open the code editor, we’re ready to roll.</p><h3><strong>2 — A mock HTML autocomplete</strong></h3><p>Place this in the autocomplete.component.html file:</p><pre>&lt;form&gt;<br>  &lt;div class=&quot;control is-loading&quot;&gt;<br>    &lt;input class=&quot;input&quot; type=&quot;text&quot; placeholder=&quot;Type an address&quot;&gt;<br>  &lt;div&gt;<br>&lt;/form&gt;</pre><p>Which is just a form with an input element. The interesting part is the “is-loading” class, which adds a nice Bulma spinner. We’ll find a way to activate that when the API call fires.</p><p>Just below the form, add this:</p><pre>&lt;div class=&quot;panel&quot;&gt;<br>  &lt;a class=&quot;panel-block&quot;&gt;<br>    &lt;span class=&quot;panel-icon&quot;&gt;<br>      &lt;i class=&quot;fas fa-map-marker-alt&quot;&gt;&lt;/i&gt;<br>    &lt;/span&gt;<br>    address 1<br>  &lt;/a&gt;<br>  &lt;a class=&quot;panel-block&quot;&gt;<br>    &lt;span class=&quot;panel-icon&quot;&gt;<br>      &lt;i class=&quot;fas fa-map-marker-alt&quot;&gt;&lt;/i&gt;<br>    &lt;/span&gt;<br>    address 2<br>  &lt;/a&gt;<br>  &lt;a class=&quot;panel-block&quot;&gt;<br>    &lt;span class=&quot;panel-icon&quot;&gt;<br>      &lt;i class=&quot;fas fa-map-marker-alt&quot;&gt;&lt;/i&gt;<br>    &lt;/span&gt;<br>    address 3<br>  &lt;/a&gt;<br>&lt;/div&gt;</pre><p>This snippet will create a nice hoverable list of suggestions, inclusive of a cool fontawesome map marker icon on the side (you need the fontawesome CDN in your index.html).</p><h3><strong>3 — Prepare the form to be handled by Angular</strong></h3><p>Since we will be using the FormsModule, it’s a good idea to import it in the app.modules.ts:</p><pre>import { FormsModule } from &#39;@angular/forms&#39;;</pre><p>And list it among the NgModule imports:</p><pre>....<br>imports: [<br>    BrowserModule,<br>    FormsModule<br>    ],<br>....</pre><p>Then we’ll add the hooks in the HTML to enable Angular to handle the form’s submission and the “is-loading” class:</p><pre>&lt;form (ngSubmit)=&quot;submitForm()&quot; novalidate&gt;<br>  &lt;div class=&quot;control&quot; [class.is-loading]=&quot;loading&quot;&gt;<br>    &lt;input class=&quot;input&quot; type=&quot;text&quot; <br>    name=&quot;addressInput&quot; <br>    [(ngModel)]=&quot;addressInput&quot; <br>    placeholder=&quot;Type an address&quot;<br>    autocomplete=&quot;off&quot;&gt;<br>  &lt;/div&gt;<br>&lt;/form&gt;</pre><p>We will not use any Angular Forms validation method, still we disabled the default HTML5 validation and autocomplete functions. Let’s create the corresponding functions and variables in the autocomplete.component.ts:</p><pre>....</pre><pre>export class AutocompleteComponent implements OnInit {<br>    loading: boolean = false;<br>    addressInput: string;</pre><pre>....<br>    ngOnInit() {<br>    }</pre><pre>    submitForm(form){<br>    }<br>....</pre><p>Now whatever the user types on the input field will go in to the addressInput variable because of [(NgModel)]; when the user presses enter, the submitForm function is fired because of ngSubmit. But, the user might also select an address from the selection, rather than just pressing enter. So we need to populate the addressInput variable also when a suggestion is clicked:</p><pre>&lt;div class=&quot;panel&quot;&gt;<br>  &lt;a class=&quot;panel-block&quot; <br>  (click) = &quot;suggestionSelected(&#39;address 1&#39;)&quot;&gt;<br>    address 1<br>  &lt;/a&gt;<br>....</pre><p>And create a function to handle that:</p><pre>....<br>submitForm(form){<br>}</pre><pre>suggestionSelected(suggestion: string){<br>    this.addressInput = suggestion;<br>}<br>....</pre><p>Now also clicking on the selection will tell us what the user want. But what does he want from us anyway?</p><h3><strong>4 — The keyup handler</strong></h3><p>Now, the whole point of the autocomplete is to detect the keyup event when the user types and make some suggestions appear. Let’s listen to keyups in the autocomplete.component.html:</p><pre>&lt;form (ngSubmit)=&quot;submitForm()&quot; novalidate&gt;<br>  &lt;div class=&quot;control&quot; [class.is-loading]=&quot;loading&quot;&gt;<br>    &lt;input class=&quot;input&quot; type=&quot;text&quot; <br>    name=&quot;addressInput&quot; <br>    (ngModel)]=&quot;addressInput&quot; <br>    placeholder=&quot;Type an address&quot;<br>    autocomplete=&quot;off&quot;<br>    (keyup) = &quot;keyUpHandler()&quot;&gt;<br>  &lt;/div&gt;</pre><p>Before we rush creating the keyUpHandler function, let’s think a second about what it should do. It should: 1) make the API call passing whatever is the content of the addressInput variable; 2) add some delays and checks so that the API is not disturbed at each and every keyup.</p><p>In theory, the API should be interrogated only if the typed content is long enough (say min 5 characters); it should leave time to the user to keep typing but still detect if the user is expecting results to appear. We can implement this logic by initially checking if the addressInput.length is at least 5, by setting a setTimeout before firing the API call BUT only firing it if the addressInput value is still the same it was before the setTimeout. Please write a response down here saying I’m clever.</p><p>In the autocomplete.component.ts:</p><pre>....</pre><pre>keyUpHandler(){<br>    if(this.addressInput.length&gt;=5){<br>        const address = this.addressInput;<br>        setTimeout(() =&gt; {<br>            if(address === this.addressInput){<br>                this.makeApiCall(address);<br>            }<br>        }, 100);<br>    }<br>}</pre><pre>makeApiCall(address: string){<br>}</pre><pre>....</pre><p>Yes, we did also created a makeApiCall function which will take the typed address, interrogate Google Maps API and give us a response.</p><h3><strong>5 — Prepare to call the Google Maps API</strong></h3><p>To call the Google Maps API we’ll use nothing more than the default Angular HttpClient, because, once again, this is Sparta.</p><p>So let’s import it in app.modules.ts and list it in NgModule imports:</p><pre>import { HttpClientModule } from &#39;@angular/common/http&#39;;</pre><pre>....</pre><pre>imports: [<br>    BrowserModule,<br>    FormsModule,<br>    HttpClientModule<br>    ],</pre><pre>....</pre><p>Next, we need to import it and inject it in the <em>autocomplete.component.ts</em>; we’ll also import the toPromise rxjs operator because we like promises:</p><pre>import { HttpClient, HttpResponse } from &#39;@angular/common/http&#39;;<br>import &#39;rxjs/add/operator/toPromise&#39;;</pre><pre>....</pre><pre>    constructor(private httpClient: HttpClient) { }</pre><pre>....</pre><p>We got the stuff. Let’s put it in to use.</p><h3><strong>6— The API call function</strong></h3><p>Now all it’s ready to create a function which will make the API call and execute a callback with the results. Of course, you need an API key in order to use the API and this will be an Input property of our component. Therefore, in the <em>autocomplete.component.ts</em>:</p><pre>import { Component, OnInit, Input } from &#39;@angular/core&#39;;</pre><pre>....</pre><pre>    @Input() API_KEY: string;</pre><pre>....</pre><pre>makeApiCall(address: string){</pre><pre>    this.loading = true;<br>    const options = {<br>        withCredentials: false,<br>    };<br>    const queryOptions = {<br>        input: address,<br>        key: this.API_KEY,<br>        types: &#39;address&#39;<br>    };<br>    const corsProxyUrl = &#39;https://cors-anywhere.herokuapp.com&#39;;<br>    const API_URL = &#39;https://maps.googleapis.com/maps/api/place/autocomplete&#39;;<br>    const BASE_URL = corsProxyUrl + API_URL;<br>    const queryString = this.encodeQuery(queryOptions);<br>    const callUrl = BASE_URL + &#39;/json?&#39; + queryString;</pre><pre>    this.httpClient.get(callUrl, options)<br>        .toPromise()<br>        .then((response: any) =&gt; {<br>            console.log(response);<br>            this.loading = false;<br>        })<br>        .catch((err) =&gt; {<br>            console.log(err);<br>            this.loading = false;<br>        });<br>}</pre><pre>encodeQuery(data: any) {<br>    let ret = [];<br>    for (let d in data)<br>    ret.push(encodeURIComponent(d) + &#39;=&#39; + encodeURIComponent(data[d]));<br>    return ret.join(&#39;&amp;&#39;);<br>}</pre><pre>....</pre><p>Excuse me the crude string concatenation, and thanks Stack Overflow for the nice encodeQuery function. What did we do there in plain English?</p><ul><li>We launched the spinner by setting this.loading = true;</li><li>We created the options object required by the HttpClient, setting withCredentials = false otherwise we’ll have problems with CORS (set it back to true in production);</li><li>We created a queryOptions object where we specify the query parameters to go with the API call, parameters such as our API key, the type of results we want (‘address’) and the keyword we are searching for (which is the address variable passed as a parameter to the function);</li><li>Since we are in development we specified a proxy (cors-anywhere) or we’ll have troubles with CORS (get rid of it in production);</li><li>We produced a query string through the encodeQuery function, which takes our queryOptions object and turns it in to a URL query string;</li><li>We concatenated all the strings to end up with the final URL, specifying we want the results in json or we might risk getting XML back and I’d rather not;</li><li>We used the URL and the options to make our API call, turn it in to a Promise with the toPromise operator, wait for a response and <em>.then </em>console log the response.</li><li>Additionally, <em>.then</em> we turn loading back to false to stop the spinner.</li></ul><p>This all should work as expected if you have provided your API key as an input to the component in the app.component.html:</p><pre>&lt;app-autocomplete [API_KEY] = &quot;yOUraPikeY&quot;&gt;&lt;/app-autocomplete&gt;</pre><h3><strong>7 — Making suggestions appear</strong></h3><p>All is working, the user types, we do some checks, add some delay, call the Google Maps API and console.log the response. Now we can use the response object to populate the suggestions. It helps to have a look at its structure (from the console.log):</p><pre>{<br>    &quot;predictions&quot;: [<br>        {<br>            &quot;description&quot;: &quot;Nemours Parkway, Orlando, FL, USA&quot;,<br>            .....<br>        },<br>        ....<br>}</pre><p>The object has a “predictions” key which contains an array of objects. Of these, all we’re interested in is the “description” property. To keep things easy and flexible, we can create a “predictions” variable and populate it with whatever is in the response.predictions. But to keep things even more simple and flexible we’ll create a dedicated function for that, a responseHandler:</p><pre>....</pre><pre>predictions: Object[];</pre><pre>....</pre><pre>this.httpClient.get(callUrl, options)<br>    .toPromise()<br>    .then((response: any) =&gt; {<br>        this.responseHandler(response);        <br>        this.loading = false;<br>    })<br>.....</pre><pre>responseHandler(response: any){<br>    this.predictions = response.predictions;<br>}</pre><p>Now we can iterate all the predictions array and display their description values in our suggestions list. In the autocomplete.component.html:</p><pre>&lt;div class=&quot;panel&quot; *ngIf = &quot;predictions&quot;&gt;<br>  &lt;a class=&quot;panel-block&quot;<br>    *ngFor = &quot;let prediction of predictions&quot;<br>    (click) = &quot;suggestionSelected(prediction)&quot;&gt;<br>    {{prediction.description}}<br>  &lt;/a&gt;<br>&lt;/div&gt;</pre><p>And it works.</p><h3><strong>8 — Selecting the address</strong></h3><p>So far: the user can type an address, see suggestions, and even click on one to change the value of the input. What is missing is actually selecting the address the user want. To make the component fool proof, and since we trust Google more than the user (and maybe we shouldn’t), we will ignore what the user has typed and select the first of the suggestions; unless, obviously, the user has manually selected one of the suggestions, but that’s ok because those are nicely formatted addresses and not random typos the fool user could give us. All this selection operation will happen of course when the form is submitted.</p><p>So when the form is submitted, we will grab the first prediction object. Not just the description but the whole object, because the dev user of the component might want to use other properties and not just the description; and we need to think about him too, because it could me me in a week.</p><p>All we have to do is to create a selectedAddress variable and populate it with the first prediction as soon as the form is submitted:</p><pre>....</pre><pre>selectedAddress: any;</pre><pre>....</pre><pre>submitForm(){<br>    this.selectedAddress = this.predictions[0];<br>}<br>....</pre><p>If you’ve already tried, you noticed that it doesn’t work whenever the this.predictions object is null (the input field is empty) or there are no predictions (this.predictions exists but it’s an empty array; this happens when Google can’t find any suggestions === the user has typed something wrong, maybe offensive too).</p><p>First of all, let’s clear the predictions object at the beginning of each and every keyup, so to be sure we only use the latest API response (which is the end of the keyup handler; we make it null at the beginning and equal to the API response at the end, ok?):</p><pre>.....<br>keyUpHandler(){<br>    this.predictions = null;<br>    if(this.addressInput.length&gt;=5){<br>    .....</pre><p>Now we can put some conditions on whether or not the submitForm function should run as normal (populating the selectedAddress variable) or give us an error message instead:</p><pre>.....</pre><pre>errorMessage: string;</pre><pre>....</pre><pre>submitForm(){<br>    if(this.predictions &amp;&amp; this.predictions.length &gt; 0){<br>        this.selectedAddress = this.predictions[0];<br>    } else {<br>        this.showErrorMessage(true);<br>}</pre><pre>....</pre><pre>showErrorMessage(boo: boolean){<br>    if(boo){<br>        this.errorMessage = &#39;Please insert a valid address&#39;;<br>    } else {<br>        this.errorMessage = null;<br>    }<br>}</pre><pre>.....</pre><p>And we reset the errorMessage to null as soon as we get any valid response from the API (or display it again if the response is still not valid):</p><pre>....</pre><pre>handleResponse(response: any){<br>    if(response &amp;&amp; response.predictions.length &gt; 0){<br>        this.predictions = response.predictions;<br>        this.showErrorMessage(false);<br>    } else {<br>        this.showErrorMessage(true);<br>    }<br>}</pre><pre>....</pre><p>Now we only need to display the errorMessage, if any, at the bottom of the autocomplete.component.html:</p><pre>....</pre><pre>&lt;div class=&quot;message is-danger is-small&quot; *ngIf = &quot;errorMessage&quot;&gt;<br>  &lt;div class=&quot;message-body&quot;&gt;<br>    {{errorMessage}}<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p>Last thing, we want the selection to happen also when the user select manually a suggestion. So we need the suggestionSelected function to behave similarly to the form submission:</p><pre>....</pre><pre>suggestionSelected(suggestion: any){<br>    this.selectedAddress = suggestion;<br>    this.addressInput = &#39;&#39;;<br>    this.predictions = null;<br>}</pre><pre>....</pre><p>But wait a second: submitForm and suggestionSelected are doing almost exactly the same thing!! To keep the code DRY we should create another function, setSelectedAddress so we don’t repeat the same lines of code in those two functions:</p><pre>submitForm(){<br>    if(this.predictions &amp;&amp; this.predictions.length &gt; 0){<br>        this.setSelectedAddress(this.predictions[0]);<br>    } else {<br>        this.setMessage(true);<br>    }<br>}</pre><pre>suggestionSelected(suggestion: any){<br>    this.setSelectedAddress(suggestion);<br>}</pre><pre>setSelectedAddress(selectedAddress: any){<br>    this.selectedAddress = selectedAddress;<br>    this.addressInput = &#39;&#39;;<br>    this.predictions = null;<br>}</pre><p>And we’re almost there….</p><h3><strong>9 — Return the selected address to the parent component</strong></h3><p>Giving back to parents is a fundamental rule of life, which requires almost in any case an Output and and EventEmitter. And you can always import those:</p><pre>import { Component, OnInit, Input, Output, EventEmitter } from &#39;@angular/core&#39;;</pre><pre>....</pre><p>And define them:</p><pre>....</pre><pre>@Output() giveBack = new EventEmitter&lt;any&gt;();</pre><pre>....</pre><p>And send it to the parent when the form is submitted or a suggestion is selected:</p><pre>....</pre><pre>setSelectedAddress(selectedAddress: any){<br>    this.selectedAddress = selectedAddress;<br>    this.addressInput = &#39;&#39;;<br>    this.predictions = null;<br>    this.giveBack.emit(this.selectedAddress);<br>}</pre><pre>....</pre><p>Lovely.</p><h3>10 — Query options</h3><p>The reason why I’m building this thing from scratch is because I want to be in control of more granular query options and the eventual logic behind it. At this point we might diverge, as I will show how to add just what I need, namely:</p><ul><li>A language different than English, because frankly I don’t really speak English;</li><li>A location in which to center my results;</li><li>A radius from named location in which I want to restrict my results;</li><li>A strictbounds parameter to absolutely restrict the results to that area;</li></ul><p>You guessed it, I want to restrict the results to a specific area.</p><p>These will be Input properties of the component:</p><pre>....</pre><pre>@Input() language: string;<br>@Input() location: Array&lt;number&gt;;<br>@Input() radius: number;<br>@Input() strictbounds: boolean;</pre><pre>....</pre><p>If they are present (i.e. are passed down from the parent) then the query string for the API call must take account of them. To do that I created a simple (barbaric) function which adds those key/value pairs to an object argument (representing the default necessary options we already specified in the makeApiCall function):</p><pre>addGranularOptions(defaultOptions: any){<br>    if(this.language){<br>        defaultOptions.language = this.language;<br>    }<br>    if(this.location){<br>        defaultOptions.location = this.location;<br>    }<br>    if(this.radius){<br>        defaultOptions.radius = this.radius;<br>    }<br>    if(this.strictbounds){<br>        defaultOptions.strictbounds = this.strictbounds;<br>    }<br>}</pre><p>This way I can modify the queryOptions object within the makeApiCall function:</p><pre>....</pre><pre>const queryOptions = {<br>        input: address,<br>        key: this.API_KEY,<br>        types: &#39;address&#39;<br>    };</pre><pre>this.addGranularOptions(queryOptions);</pre><pre>....</pre><p>Whenever I need to be more in control over the results, now I can pass the extra parameters from the parent component (app.component.html):</p><pre>&lt;app-autocomplete<br>  [API_KEY] = &quot;API_KEY&quot;<br>  [language] = &quot;&#39;it&#39;&quot;<br>  [location] = &quot;[&#39;41.7144600&#39;, &#39;12.7048940&#39;]&quot;<br>  [radius] = &quot;50000&quot;<br>  [strictbounds] = &quot;true&quot;<br>  (giveBack) = &quot;takeItAllIn($event)&quot;&gt;<br>&lt;/app-autocomplete&gt;</pre><p>And it’s D.O.N.E.</p><p>And it W.O.R.K.S.</p><p>Thanks for reading, as usual your tendency to procrastination has been instrumental in motivating me getting things done. But of course I hope you ended up with something functional too.</p><p>If not, the full working code is here: <a href="https://github.com/JoniWanKenobi/ng-gmap-bulma-autocomplete"><em>https://github.com/JoniWanKenobi/ng-gmap-bulma-autocomplete</em></a><em> . </em>But also here below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9951b62c773f707edf4202e19c19f280/href">https://medium.com/media/9951b62c773f707edf4202e19c19f280/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1bd79d5c98b797983aad7d6c65caade3/href">https://medium.com/media/1bd79d5c98b797983aad7d6c65caade3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=699325ac4595" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a datepicker with Angular, Bulma and Moment.js (part 3)]]></title>
            <link>https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-3-df184707d7e2?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/df184707d7e2</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[momentjs]]></category>
            <category><![CDATA[bulma]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Mon, 09 Apr 2018 10:51:35 GMT</pubDate>
            <atom:updated>2018-04-11T09:57:03.936Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is a “live” tutorial, you wont be able to follow it unless you went through </em><a href="https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-1-54afcd565c2"><strong><em>part 1</em></strong></a><em> and </em><a href="https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-2-6258b8ff51ae"><strong><em>part 2</em></strong></a><em>.</em></p><p>Good morning. It rains, the lake is hidden by the mist, and I’m listening to <a href="https://www.youtube.com/watch?v=En4Cit7Lrqc">something romantic</a>. After all this is a <em>date </em>picker. And surely enough I have an OkCupid tab open. For debugging.</p><p>This is what we’ve got:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*MC5OQ_YMhMRGWb_qfrCZeQ.gif" /></figure><p>And the full code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c7b2d9ace2530eaa3e765c64f465566/href">https://medium.com/media/4c7b2d9ace2530eaa3e765c64f465566/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31ecf694e8af4c170c8854a72307e63d/href">https://medium.com/media/31ecf694e8af4c170c8854a72307e63d/href</a></iframe><p>We need to grab the date on selection. The selection will give us a number. Hence we need to understand how to turn numbers in to dates. And then build a function dateFromNum that will take a number and return a date. Let’s see… oh, I love you Moment.js:</p><pre>moment().date(number);</pre><p>If we have a moment object we can mutate it to the date of a given day number with the date() method, passing indeed the day number as a parameter. In our case, if we want to transform the selected number in to a date:</p><pre>const selectedDate = moment(navDate);<br>selectedDate.date(selectedNumber);</pre><p>We don’t even have to check the validity of the number since we generated the numbers from the month directly. So here’s the dateFromNum function:</p><pre>dateFromNum(num: number, referenceDate: any): any{<br>    let returnDate = moment(referenceDate);<br>    return returnDate.date(num);<br>} </pre><p>For the moment we can also pass a referenceDate as I’m not sure we will use it only for our navDate. In fact, the first use case I see of this function is to make past days unavailable, as we decided they should be. If you noticed, we restricted the navigation to past months but past days within the current month still display as available.</p><p>For that, we can modify the isAvailable function (also getting rid of the random disabling of every 5th of the month):</p><pre>isAvailable(num: number): boolean{<br>    let dateToCheck = dateFromNum(num, navDate);<br>    if(dateToCheck.isBefore(moment(), &#39;day&#39;)){<br>        return true;<br>    } else {<br>        return false;<br>    }<br>}</pre><p>We used the isBefore() method which checks if a date is before another. We checked it against today (moment()), specifying we want the check to be made on a day basis (‘day’ option), so we don’t have to deal with eventual unexpected results due to hours and minutes (and milliseconds).</p><p>Cool, let’s code it!… Here it is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8dba54e74783165ec5d21d200b1c9a24/href">https://medium.com/media/8dba54e74783165ec5d21d200b1c9a24/href</a></iframe><p>And it works!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*UlycuVXgpk2QDB3UD2NPkg.png" /><figcaption>Today is the 9th</figcaption></figure><p>Now we made all the checks we wanted on date availability, can easily and safely select a number, turn it in to a date, and store it in a selectedDate variable. Let’s start from the template. Where there seem to be a problem actually…</p><p>The Bulma Calendar css applies the nice ‘is-disabled’ class on the ‘calendar-date’ div, not on the ‘date-item’ button. This means that we disabled the days only visually, but they will still be available for selection through a click event. So we need to pass to the function handling the click the whole day object ({value: 3, available: true}) rather than just the number as I was imagining, and then check again if it’s available or not. This is not too bad.</p><p>Let’s add a click event and a function to handle the selection:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a90a3128cc5cf7b9bd2558a1c981cca1/href">https://medium.com/media/a90a3128cc5cf7b9bd2558a1c981cca1/href</a></iframe><p>The selectedDay function (which populates the selectedDay variable):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c3bb7fedd236eb66a0bbe437624bd46/href">https://medium.com/media/9c3bb7fedd236eb66a0bbe437624bd46/href</a></iframe><p>And… it… works!!! This is the end result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*IHzU0BtbW0kQuKtkmx4rag.gif" /></figure><p>And this is the full code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6403e73e511e8992e8e8c302ad167fd6/href">https://medium.com/media/6403e73e511e8992e8e8c302ad167fd6/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b97bfcc1a7082c35fc67a246a360828/href">https://medium.com/media/7b97bfcc1a7082c35fc67a246a360828/href</a></iframe><p>And it’s done, at least for what I personally have to do with it. But, it needs some adjustments in order to be more configurable and controlled from an outside parent component. Next steps would be:</p><ul><li>Create a ‘option’ object which will be an Input property and will contain all the configurations, including callback functions which can be passed from outside</li><li>Adjust all the functions to work according to the options</li><li>Let the component ‘emit’ the selected date, and maybe a configurable callback too</li><li>Add extra visualization leveraging Bulma Calendar css</li></ul><p>I’m not sure when I will have time for that... but soon, hopefully. You can follow the progress here on Github (or fork contribute etc.):</p><p><a href="https://github.com/JoniWanKenobi/angular-bulma-datepicker">JoniWanKenobi/angular-bulma-datepicker</a></p><p>All in all, I didn’t think I could do it, but here it is. Thanks for reading, making the tutorial was really crucial in my motivation, hope you enjoyed it and ended up with something functional too!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df184707d7e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a datepicker with Angular, Bulma and Moment.js (part 2)]]></title>
            <link>https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-2-6258b8ff51ae?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/6258b8ff51ae</guid>
            <category><![CDATA[momentjs]]></category>
            <category><![CDATA[bulma]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Sun, 08 Apr 2018 19:39:02 GMT</pubDate>
            <atom:updated>2018-04-09T10:52:52.497Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This is part 2 of a “live” tutorial, you wont be able to follow it unless you have gone through </em><a href="https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-1-54afcd565c2"><strong><em>part 1</em></strong></a><em>. (</em><a href="https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-3-df184707d7e2"><em>part 3 is here</em></a><em>)</em></p><p>Welcome back. It’s a quiet and sunny Sunday here in Nemi, nothing better to do than to listen to a <a href="https://www.youtube.com/watch?v=d7zBePUZMog">conducive tune</a> and continue building the datepicker.</p><p>This is what we’ve got so far:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*Tccn3LgG0JVxe6XT8t8e1w.gif" /></figure><p>Before we go any further, I need to make the existing code a bit more rational, like so:</p><p><strong>Rename variables and functions:</strong></p><ul><li>viewDate -&gt; navDate</li><li>changeViewDate -&gt; changeNavMonth</li><li>canChange -&gt; canChangeNavMonth</li></ul><p><strong>changeNaveMonth now takes only one argument:</strong></p><pre>changeNavMonth(num: number){<br>    if(this.canChangeNavMonth(num)){<br>    this.navDate.add(num, &#39;month&#39;);<br>    }<br>}</pre><p><strong>canChangeNavMonth also takes one argument only:</strong></p><pre>canChangeNavMonth(num: number): boolean{<br>    const clonedDate = moment(this.navDate);<br>    clonedDate.add(num, &#39;month&#39;);<br>    const minDate = moment().add(-1, ‘month’);<br>    const maxDate = moment().add(1, ‘year’);</pre><pre>    return clonedDate.isBetween(minDate, maxDate);<br>}</pre><p>Was this necessary? No, but it makes it all more readable. Now, let’s disable the chevron button if the date is not within the range we specified. All we need to do is to add this kind of directive to our buttons:</p><pre>[disabled] = “!canChangeNavMonth(-1)” </pre><p>Wrapping up, these are the new <em>datepicker.component.ts</em> and <em>datepicker.component.html</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f290346ed28af407bedc342418a60df3/href">https://medium.com/media/f290346ed28af407bedc342418a60df3/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48ef6bd85a490136a040be19709db84b/href">https://medium.com/media/48ef6bd85a490136a040be19709db84b/href</a></iframe><p>Much better. And this is what we achieved:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*7LwGnm-u_nncP8Yrf7CPxg.gif" /></figure><p>Now, it’s time to make that little weekdays header dynamic too.</p><h3><strong>5 — That little weekdays header</strong></h3><p>It turns out, each locale has its own official first day of the week. In UK, it’s Sunday. In Italy, where I’m now, it’s Monday. The sequence is represented by numbers from 0 to 6, both in JS dates and in Moment.js objects. In Moment.js a weekday can be referred to by its number, in a locale-aware fashion, with the weekday() method. So a British Sunday or an Italian Monday (depending on locale) would be:</p><pre>moment().weekday(0);</pre><p>To display it in a readable format, with only three letters just as we need:</p><pre>moment().weekday(0).format(‘ddd’);</pre><p>This will display “Sun” (‘en’ locale) or “lun” (‘it’ locale; yep, does not capitalize it in this locale). To display the header all we have to do is to iterate that line of code over an array of numbers from 0 to 6. Really. So in our component we can declare an empty array of strings representing our header (weekDaysHeaderArr) and populate in on ngOnInit with a simple makeHeader function:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/63c1c38faad3baf0a428e2b65687a97f/href">https://medium.com/media/63c1c38faad3baf0a428e2b65687a97f/href</a></iframe><p>And finally replace the hardcoded header with an ngFor in our <em>datepicker.component.html:</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e87c0d9cbf1069dacf04634bc1922c21/href">https://medium.com/media/e87c0d9cbf1069dacf04634bc1922c21/href</a></iframe><p>We did it! Here’s the ‘it’ locale:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*MB2ohBmlGbyh7IEUMljkJA.png" /></figure><p>Unfortunately it seems there isn’t a built-in capitalize pipe in Angular. We’ll think about it later. Good job so far!!</p><h3><strong>6 — The actual… dates!</strong></h3><p>We could do all sorts of convoluted ngFor — ngIf — ngSwitch in our template to correctly display those little numbers. But I prefer confine the logic in the ts file and pass to the template a simple array to iterate through.</p><p>Our goal is to create an array which contains 0s for any empty grid space, and the day number for any day of the month. In addition, I also want to know if the date is available or not for selection. Makes sense? Say the month we’re displaying has 30 days and starts on a Tuesday and we’re using the ‘en’ locale, the array should be something like:</p><pre>[{value: 0, available: false}, {value: 0, available: false}, {value: 1, available: true}, {value: 2, available: true},..., {value: 30, available: true}, {value: 0, available: false}, {value: 0, available: false}]</pre><p>For any given month, the length of this array would be equal to: the number days in the month + the number of days between the first day of the week according to the locale we’re on and the first day of the month + the number of days between the last day of the month and the last day of the week in the locale.</p><p>Chill, we’re using Moment.js. To grab the date representing the first day of the month we’re displaying (remember always to clone a date before manipulating it, if you don’t intend to change it):</p><pre>const firstDayDate = moment(navDate);<br>firstDayDate.startOf(&#39;month&#39;);</pre><p>To know its weekday number, hence how many empty cells we need to print before printing numbers:</p><pre>const initialEmptyCells = firstDayDate.weekday();</pre><p>Similarly, we can calculate how many empty cells the array contains at the end (this time checking how many cells we need to go from there to the end of the week):</p><pre>const lastDayDate = moment(navDate);<br>lastDayDate.endOf(&#39;month&#39;);<br>const lastEmptyCells = 6 - lastDayDate.weekday();</pre><p>To know the total number of days in the month we’re displaying:</p><pre>const daysInMonth = navDate.daysInMonth();</pre><p>And there you go, the array we want to build has the following length:</p><pre>const arrayLength = initialEmptyCells + lastEmptyCells + daysInMonth;</pre><p>Now that we know it’s length we can start building it with a for loop:</p><pre>let gridArr: Array&lt;number&gt; = [];<br>for(let i = 0; i&lt; arrayLength; i++){<br>    let obj = {};<br>    if(i&lt;initialEmptyCells || i&gt;initialEmptyCells + daysInMonth -1){<br>        obj.value = 0;<br>        obj.available = false;<br>    } else {<br>        obj.value = i - initialEmptyCells +1;<br>        obj.available = isAvailable(i - initialEmptyCells +1);<br>    }<br>    gridArr.push(obj);<br>}</pre><p>Where isAvailable is a function that will take a number and check if that day is available or not. For now, it will just return true all the times except for the number 5, just to see how a disabled button looks:</p><pre>isAvailable(num: number){<br>    if(num === 5){return false};<br>    else {return true};<br>}</pre><p>Damn, now I need to actually write the code… give me a sec…</p><p>So we declare a gridArr variable to contain our array, and a makeGrid function which will create it depending on the current date we’re displaying:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c4f70086c6330c58c8d773c15cc16bb/href">https://medium.com/media/6c4f70086c6330c58c8d773c15cc16bb/href</a></iframe><p>We will call the function on ngOnInit and each time we update the navDate.</p><p>Now we can finally get rid of the hardcoded grid in our template, looping through our gridArr and adding the “is-disabled” class if the day is not available:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3d6c81e1a753f5577785cb6b87a593c/href">https://medium.com/media/b3d6c81e1a753f5577785cb6b87a593c/href</a></iframe><p>And here’s the result (remember, we disabled each 5th just for the sake of it):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*MC5OQ_YMhMRGWb_qfrCZeQ.gif" /></figure><p>Good job!! Now we just need to grab the date when we select it. But for that we need… <a href="https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-3-df184707d7e2"><strong>part 3!!</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6258b8ff51ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a datepicker with Angular, Bulma and Moment.js (part 1)]]></title>
            <link>https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-1-54afcd565c2?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/54afcd565c2</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[calendar]]></category>
            <category><![CDATA[momentjs]]></category>
            <category><![CDATA[bulma]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Fri, 06 Apr 2018 13:15:21 GMT</pubDate>
            <atom:updated>2018-04-09T10:55:38.571Z</atom:updated>
            <content:encoded><![CDATA[<p>(<a href="https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-2-6258b8ff51ae">part 2 here</a>)(<a href="https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-3-df184707d7e2">part 3 here</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*IHzU0BtbW0kQuKtkmx4rag.gif" /><figcaption>This is the end result</figcaption></figure><p><em>Halfway through building my first paid-for web app using Angular, which entails some booking functionalities, I realized that enabling the user to pick a date isn’t something trivial. Especially if some dates are available and others aren’t depending on existing bookings and other complicated business logic. So no, the default HTML5 datepicker doesn’t cut it. At all. After giving up the hope of understanding other people’s code (such as </em><a href="https://github.com/Wikiki/bulma-calendar"><em>this</em></a><em>, or </em><a href="https://www.npmjs.com/package/angular4-datepicker"><em>this</em></a><em>, or </em><a href="https://mattlewis92.github.io/angular-calendar/#/kitchen-sink"><em>this</em></a><em>), after feeling very depressed for a couple of very long hours, and after reading through </em><a href="https://momentjs.com/"><em>Moment.js documentation</em></a><em>, I took the resolution of building my own Angular datepicker. To keep myself motivated I will write a tutorial “live”, as I pour code out of my brain. Ready? Let’s do it.</em></p><h3><strong>1 — Set up yourself</strong></h3><p>Sit somewhere comfortable, or stand by a standing desk, have your laptop on, with Angular installed, internet access, switch off the mobile and play <a href="https://www.youtube.com/watch?v=NcjcfUQ8iHw">this tune</a> in your headset. We’re cool, let’s get started.</p><h3><strong>2 — Set up the project</strong></h3><p>Create a new Angular project from the terminal:</p><pre>ng new anguluar-bulma-datepicker</pre><p>Move to the project folder and create a new component:</p><pre>ng g c datepicker</pre><p>Then install Bulma and Moment.js:</p><pre>npm install --save bulma moment</pre><p>Launch the code editor, and as a first thing enable bulma css by adding this line “../node_modules/bulma/css/bulma.css&quot; in the “styles” array in the <em>angular-cli.json</em> file. Like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a21d910204ca3e67eb5a5e018afe1935/href">https://medium.com/media/a21d910204ca3e67eb5a5e018afe1935/href</a></iframe><p>Then import Moment.js in your <em>datepicker.component.ts</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7af3e8b9ea036d31c64d72c1b4000f86/href">https://medium.com/media/7af3e8b9ea036d31c64d72c1b4000f86/href</a></iframe><p>Now we can use Bulma and Moment.js in our project. But we could also take advantage of another extension called Bulma Calendar, specifically of it’s CSS code, so to add a proper calendar style to our datepicker out of the box. To do that we need to grab <a href="https://raw.githubusercontent.com/Wikiki/bulma-calendar/master/dist/bulma-calendar.min.css">this code</a> from GitHub and save it in a file called <em>bulma-calendar.min.css </em>within our src folder and then make it available by adding another line in our <em>angular-cli.json</em>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c598189520bf7299d66483e57d7e3c0b/href">https://medium.com/media/c598189520bf7299d66483e57d7e3c0b/href</a></iframe><p>And we’re all set.</p><h3><strong>3 — Add the necessary HTML to display a datepicker</strong></h3><p>Once again, we’ll use the excellent code provided by <a href="https://github.com/Wikiki">Wikiki</a> in the Bulma Calendar documentation. We can copy the code from the first example in <a href="https://wikiki.github.io/components/calendar/">this page</a> and past it in our <em>datepicker.component.html</em> (nobody is watching…):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/efc29116d6277a12079a73e8f2748d59/href">https://medium.com/media/efc29116d6277a12079a73e8f2748d59/href</a></iframe><p>Oh, it uses <a href="https://fontawesome.com/get-started">FontAwesome</a>. You need the CDN link in your <em>index.html.</em></p><p>If we ng serve the app, at this point we should have a nice looking datepicker, where everything we see is hardcoded in the HTML. Now, let’s turn that in to a real and fully functional datepicker, adding one functionality at the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*1olFUW-ckv7XdbWa_bjliw.png" /></figure><h3><strong>4 — Month, year and navigation</strong></h3><p>To begin with, let’s display the current month and year. To do that we create a Moment.js object (<em>i.e.</em> a date) having the current date as its value and assign it to a variable (viewDate); also, to make sure we are consistent with the locale settings, we specify the locale as a string (it will later be an Input property of our component):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b54b18a8c6119f9ddaf484aeb62d7872/href">https://medium.com/media/b54b18a8c6119f9ddaf484aeb62d7872/href</a></iframe><p>Sweet. Since now we have the current date, we can replace the hardcoded “March 2017” with the actual month and year. Moment.js makes it so easy to format dates, that all we need to type in our template is {{viewDate.format(‘MMMM YYYY’)}}:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8d7dd4ca193e4b81aa6bef4e1bcd862/href">https://medium.com/media/a8d7dd4ca193e4b81aa6bef4e1bcd862/href</a></iframe><p>Easy!! Now, when I click on the chevron icons I’m supposed to display the previous or the next month, right? Let’s add a click event and a function to handle it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c6265fc07cf3cc155b546165c2e7ce7/href">https://medium.com/media/5c6265fc07cf3cc155b546165c2e7ce7/href</a></iframe><p>The function changeViewDate will take two arguments: a number to indicate the quantity to change and a string to indicate which part of the date should be changed. This way we’re aligned with how things work in Moment.js, which once again makes it so easy to add or subtract intervals from dates. The Moment.js code to add a month:</p><pre>viewDate.add(1, &#39;month&#39;);</pre><p>Almost silly. So our changeViewDate will be like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/32cc564e280c18856e0a5826af6c3ecb/href">https://medium.com/media/32cc564e280c18856e0a5826af6c3ecb/href</a></iframe><p>It works!! So now we can navigate through time, month by month, using the chevron buttons. But what if for any reason we want to limit how back or forward in time the user can navigate? For example, we shouldn’t let the user select a date in the past for our booking system, or we might want to take bookings only for the next year. To allow for such restrictions we can pass the new date through a validity check, say we create a function canChange which returns a boolean according to some logic. We only need to keep in mind that moment.js objects are mutable, so unless we want to change our viewDate variable we have to clone it in order to manipulate it safely. To clone a date object in moment.js:</p><pre>const clonedDate = moment(viewDate);</pre><p>To check if a date is within a range of dates:</p><pre>clonedDate.isBetween(minDate, maxDate);</pre><p>where minDate and maxDate are other date objects representing the boundaries of our interval. The check is exclusive so if we want to include the extremes we need to provide larger bounds than we actually want (<em>i.e.</em> checking if ‘today’ is between ‘today’ and ‘next year’ will return false). Wrapping up these considerations of cloning and date comparisons, our canChange function (and updated changeViewDate) could be something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/404d1dadcee503ae0cebc178e8cc806c/href">https://medium.com/media/404d1dadcee503ae0cebc178e8cc806c/href</a></iframe><p>And it surely works. This is getting interesting… but I’m knackered, and there is still lots to do. But, we’ll keep it easy. Let’s take a break and I shall see you in <a href="https://medium.com/@chiodigiovanni1/how-to-build-a-datepicker-with-angular-bulma-and-moment-js-part-2-6258b8ff51ae"><strong>part two</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*Tccn3LgG0JVxe6XT8t8e1w.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54afcd565c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[8 Ways the Ironhack coding bootcamp in Barcelona exceeded my expectations]]></title>
            <link>https://medium.com/ironhack/8-ways-the-ironhack-coding-bootcamp-in-barcelona-exceeded-my-expectations-cbb8a7a6e686?source=rss-de233a6afe73------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbb8a7a6e686</guid>
            <category><![CDATA[ironhack]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bootcamp]]></category>
            <dc:creator><![CDATA[Giovanni Chiodi]]></dc:creator>
            <pubDate>Sun, 18 Mar 2018 14:13:15 GMT</pubDate>
            <atom:updated>2018-03-21T14:09:00.218Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J3QU3m0cf8jeg5HQ_rZVpw.jpeg" /></figure><p><em>Coding is hard. Learning to code in 2 months is very demanding and does seem totally impossible. Believe it or not, the </em><a href="http://www.ironhack.com/en"><strong><em>Ironhack campus in Barcelona</em></strong></a><em> is designed at every level just to make that happen. It doesn’t get more ideal than that. Here’s how I break it down for anybody interested in enrolling in the course.</em></p><h3><strong>1 — The location:</strong></h3><p>Barcelona is one of the most international cities in Europe. You do breath modernity and opportunity here, especially in the Poblenou neighborhood where the campus is located. It has become a kind of tech district, so on the way to class you pass by real tech companies and it gives you a feel of where you might end up working. Feels like you’re there already.</p><h3>2 — The campus:</h3><p>Fantastic open space with glass walls (Kanban boards drawn on them), plants hanging from the ceiling, kitchen, showers, desks, standing desks and tons of architectonic eye candies. It’s like your mind expands in there, and you’re hooked. You don’t want to leave. In fact you don’t. You’re given the keys and trust me, you <em>will</em> take advantage of the 24/7 access policy. You’ll need it on project weeks!!</p><h3>3 — The staff:</h3><p>They’re doing a fantastic job at keeping the place so well organized YET very informal, friendly and welcoming. And that’s important because during the bootcamp you are reinventing yourself and you will be pushing your brain very hard on coursework.</p><p>So nobody will judge you if you spend hours by a standing desk coding and dancing looking more like a DJ (or a crazy person) than a developer. You’re tired? You can take a nap in plain sight. Wanna play? Let’s skate or play football, inside of course. Nobody will ask you to stop.</p><p>The staff is committed in having you become a web developer. They know kicking a ball will help your subconscious brain solve the kata.</p><h3>4 — The teachers:</h3><p>Andre has been one of the most inspiring and influential professional I ever met. The guy has more than 20 years of experience, and he knows how to deliver it to you. His technical knowledge is so intimate that I’m sure he natively thinks in Javascript then compiles in English for the rest of us.</p><p>But he didn’t just taught us a programming language (and to love it): he focused a lot on best practices, on the workflow and the mindset you have to adopt in order to transform your ideas in to products through coding, and having fun in the process. Then, he passed on us so many insights drawing form his own experience, filtering out for us the most valuable. Maybe not obvious at first, but Andre insights sit on the brain and release value as time passes by.</p><p>And also, it must be said: he let us appreciate how cool a fully fledged web dev can be.</p><h3>5 — The teaching assistants:</h3><p>Ironhack employs the best students as teaching assistants for next cohorts. They’re three, with different levels of experience depending on how many cohorts they survived. Yes, because it’s not easy to stay patient having to debug horrible code by current students still not having a clue!! What you get from them is the closeness of relating with somebody who just finished the bootcamp, as well as accurate code revisions and debugging, directly from somebody who still remembers on what silly thing you’re more likely to get stuck on. They were stuck there too just a couple of months before, they know how and where to help.</p><h3>6 — The curriculum:</h3><p>Javascript is on fire nowadays and Ironhack is one of the few bootcamps to base its entire curriculum on it. Backend, frontend, all JS, because this is the present and the foreseable future of web development. In fact, <em>anything different would have felt like time wasting.</em></p><p>The course is divided in three modules, each module giving you the teaching first and then challenging you on a project. The course material is constantly updated, you get exercises on a git repository to work on all night if you want. You’ll get a detailed revision of your code in the morning.</p><p>In the first module you learn the basics, HTML, CSS and JS, and make a late 90s style JQuerish app with it. Then you’re introduced to <a href="https://nodejs.org/en/">Node.js</a> in the second module, but server side: <a href="https://www.mongodb.com/">Mongo DB</a>, <a href="http://mongoosejs.com/">Mongoose</a>, <a href="https://expressjs.com/">Express</a>. And you make a ’00 style server rendered MVC app, which almost feels like a real thing. In the third module you’re thought a Javascript framework (this time it was <a href="https://angular.io/">Angular 5</a>), and are given two weeks to complete your own full stack project.</p><p>At some point while doing it, which happens at different stages for different people, it’s guaranteed that you will see the light. Like in the Karate Kid movie you’ll see how all they made you do click together. Your fingers begin flying on the keyboard, translating your thoughts in to code as if it was the most natural thing in the world, while you wonder what the hell is happening. That’s when a web dev has finally emerged from within you.</p><h3>7 — Events and job opportunities:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eBEd6WmtKVAQAuo3uVFXcQ.jpeg" /></figure><p>Each week we had at least a couple of talks by external speakers, giving us insights from within the industry. That has been very valuable, the best one was somebody explaining us how to make a bot using <a href="https://dialogflow.com/">Dialogflow</a>, with git repository and all. Fantastic.</p><p>Unfortunately, you are likely to be very fatigued by all the mental work you’re doing in the bootcamp to fully engage in the talks. But it is all meterial you can go back at a later stage, having had direct exposure to it, and maybe even networked with a real tech-industry specimen.</p><p>And we came to job opportunities. I yet have to attend the hiring week which is organized at the end of the bootcamp and it’s supposed to be a kind of speed dating between us graduate and tech companies. BUT, during the last event one of the speakers gained an interest in my final project and we’re now exploring the prospect of remote work for his creative, amazing and well established start-up. So yes, nothing concrete yet but I can’t beleive the fact I’m actively asked for interviews even BEFORE I start searching for a job. Amazing.</p><h3>8 — The people:</h3><p>I barely been alone during these two months, the group spirit has been fantastic. From spending the night all together coding, to partying at campus on the weekends, I felt so fortunate to get to meet so many great people.</p><p>On a personal note, that was even more important given the fact that I lost my father while I was attending the bootcamp. It wasn’t an easy decision to stay and learn coding, but it was the right choice. The understanding and support I received from the staff and the other students has been fantastic, don’t know what kind of place I would have been in without it.</p><h3>No magic involved</h3><p>I do recommend the course, it delivers on expectations, but be ready to push yourself as hard as you can in the learning process. There’s no magic, it all comes through hard work. <em>Ironhack will provide you with the best environment, tools, knowledge, people, it’s like a state of the art gym: </em><strong><em>the sweat is still all yours</em></strong>.</p><p>As for me, I might take the <a href="http://code.ironhack.com/ux-ui-design-bootcamp-bcn-en-sem/?utm_medium=cpc&amp;utm_source=google&amp;utm_campaign=brand-bcn-en-search&amp;utm_content=brand-ux-ui-bootcamp&amp;gclid=CjwKCAjwnLjVBRAdEiwAKSGPI5fA_j9LcAK4cOLy8Lp4ou24yx7fizASh-_PIo7LOVYZ6ZaFpJ2onBoC41UQAvD_BwE">UX/UI bootcamp</a>, Ironhack is kind of addictive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbb8a7a6e686" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ironhack/8-ways-the-ironhack-coding-bootcamp-in-barcelona-exceeded-my-expectations-cbb8a7a6e686">8 Ways the Ironhack coding bootcamp in Barcelona exceeded my expectations</a> was originally published in <a href="https://medium.com/ironhack">Ironhack</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>