<?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 Nicola Zaghini on Medium]]></title>
        <description><![CDATA[Stories by Nicola Zaghini on Medium]]></description>
        <link>https://medium.com/@nzaghini?source=rss-35fd807eedba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6CyrMinFQUSOeGSCImLYoQ.png</url>
            <title>Stories by Nicola Zaghini on Medium</title>
            <link>https://medium.com/@nzaghini?source=rss-35fd807eedba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 11:24:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nzaghini/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[React Native is worth its weight in gold here at Phorest]]></title>
            <link>https://nothingventured.rocks/react-native-is-worth-its-weight-in-gold-here-at-phorest-a63565cb0063?source=rss-35fd807eedba------2</link>
            <guid isPermaLink="false">https://medium.com/p/a63565cb0063</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Nicola Zaghini]]></dc:creator>
            <pubDate>Mon, 14 Dec 2020 19:05:29 GMT</pubDate>
            <atom:updated>2020-12-14T19:05:29.195Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="React Native is worth its weight in gold here at Phorest" src="https://cdn-images-1.medium.com/max/1024/1*h27STreYlHZDDfmKGKvT2Q.jpeg" /></figure><p>The adoption of React Native at Phorest has been probably one of the best technology choices we’ve made in the last number of years.</p><p>It literally saved a product line that was fated to be shut down. But let’s take it to step by step.</p><h3>The Mobile Proposition</h3><p>The Mobile proposition at Phorest is currently made of 2 products.</p><p>The first is called<strong> Phorest GO</strong>: a native app designed for Salon owners and staff to <em>run their business on the go</em>, as the name implies. It is available for both iOS and Android.</p><p>The second is a <strong>Salon App</strong>: a native white label app enabling Salon’s customers to <em>book and manage their appointment on the go</em>, also available for both iOS and Android.</p><p>We have nearly ten thousand salons using Phorest overall.</p><blockquote>Phorest needed to deliver and maintain literally thousands of native Salon Apps!</blockquote><p>This is a daunting task, to say the least.</p><h3>The Native Attempt</h3><p>It was around 2015 when two different codebases were created, one Objective-C and one Java. The app was well made and drove adoption very quickly, providing a new channel and stream of bookings for our clients.</p><p>The problems started manifest about one year in, where about 1,500 apps (a total of 3,000 given the two stores) needed to be updated and maintained with new features and bug fixes.</p><p>Development effort per channel, feature parity struggle, continuous integration and distribution time, app store reviews time, automation per channel started to become a real challenge to keep up with.</p><p>As you can guess now, the Salon App product line was the one imminent to shut down:</p><blockquote><strong>While successful and well received by customers, Salon App product was operationally impossible to maintain.</strong></blockquote><h3>The React Native Pitch &amp; Bet</h3><p>It was over a coffee where all of the above was presented to a younger self. It was almost an epiphany: pretty much everything I was preaching in the last while had finally found its perfect audience.</p><p>The Pitch started by ensuring React Native would have provided Phorest customers the same identical experience as the Native approach: what customers touch and feel are the actual platform-native GUI elements.</p><blockquote>No wrapped web page or other dumbed down experience, but the Native Native experience for Phorest customers.</blockquote><p>It continued with the possibility to send bug fixes and small feature improvements over the air (OTA updates). Exactly as you update a website you can update hundreds of thousands of installed native apps on users&#39; hands over the air in a second. You can therefore reduce the number of binary releases to 3 or 4 per year.</p><blockquote>Over the air bug fixes and small feature improvements is a real game changer when managing thousands of apps.</blockquote><p>It ended by discussing how much money and time the cross-platform nature of React Native would have saved the company, together with the already familiar programming language, TypeScript, which Phorest had great expertise in house.</p><blockquote>Cross platform development implies feature parity, a very hard requirement to achieve with different codebases.</blockquote><p>At this stage, <strong><em>the bet was on</em></strong>, and we had given 6 months to rewrite the Salon App in React Native. One senior and one junior engineer with no previous experience in React for the record.</p><h3>It is worth its weight in Gold</h3><p>We clearly won the bet. We have nearly 8,000 apps currently live in the iOS and Android stores with roughly 25k daily active users making transactions 24/7.</p><p><strong>User experience is top-notch, full stop. <br></strong>We also had the opportunity to modernise the overall design with multiple themes and brand-able options, and our customer love it.</p><p><strong>Over the Air updates is a real game-changer for native mobile apps. <br></strong>Over the Air (OTA) infrastructural pillar is rock solid, more than we expected. We use CodePush from Microsoft, open source amazing piece of software.</p><p><strong>Cross-Platform really works, respecting native platform-specific nuances.<br></strong>The cross-platform promise is maintained, with probably less than a handful of differences between iOS and Android in the whole codebase.</p><p>Plus, there is something we did not expect:</p><blockquote>Feature delivery speed was a shock to my ten years experience of native iOS development.</blockquote><p>The speed was really a surprise for the whole team: React and its opinionated way of writing mobile applications is definitely the fuel behind the speed of delivery. Together with the great tools for Web available nowadays and fully compatible with React Native, it makes an amazing and fun platform to work on.</p><p>Another pleasant surprise: <strong>The community around React Native is genuinely at par with native technologies.</strong></p><p>The open-source components we could just use out of the box, the issues we could figure with a glance at StackOverflow, the impressive improvements on core libraries, and React Native itself were absolutely a treat we did not expect.</p><p>Finally, we clearly had our share of trouble learning the React Native way of writing apps. Screen navigation, just to mention one, was probably the most challenging part as quite different from the native approach. Eventually, even that got improved during our development, reducing the friction even more.</p><h3>Future</h3><p><strong>React Native</strong> <strong>is absolutely our way forward</strong>, and we are double betting on it. As React Native proved to be a game-changer and a must for the Salon App, we are now adopting it on Phorest GO. With about 100,000 beauty professionals interacting with it every day, this represents an amazing opportunity to deliver value at speed and quality we would have never otherwise.</p><p>With Phorest GO we won’t go into a full rewrite but with a <strong>hybrid approach:</strong> new features are developed in React Native. This is a new world of challenges and we are really looking forward to it.</p><p>As we write this article we have a Beta version out with a shiny new feature fully written in React Native only available to selected Beta customers. It is going incredibly smooth so far, so stay tuned!</p><p><em>We are always looking to speak to amazing engineers about joining the Phorest team (especially the mobile one). You can check out open roles </em><a href="https://www.phorest.com/about/careers/"><em>here</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a63565cb0063" width="1" height="1" alt=""><hr><p><a href="https://nothingventured.rocks/react-native-is-worth-its-weight-in-gold-here-at-phorest-a63565cb0063">React Native is worth its weight in gold here at Phorest</a> was originally published in <a href="https://nothingventured.rocks/">Nothing Ventured</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Properly Test a GraphQL Server…]]></title>
            <link>https://medium.com/@nzaghini/properly-test-a-graphql-server-d178241464e7?source=rss-35fd807eedba------2</link>
            <guid isPermaLink="false">https://medium.com/p/d178241464e7</guid>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[apollo-client]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[jest]]></category>
            <dc:creator><![CDATA[Nicola Zaghini]]></dc:creator>
            <pubDate>Fri, 29 Jun 2018 11:23:41 GMT</pubDate>
            <atom:updated>2018-06-29T12:59:42.328Z</atom:updated>
            <content:encoded><![CDATA[<h3>Effective Testing a GraphQL Server…</h3><h4>… with Jest and Apollo.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uz6LnhZaHmz38mq98XAa3g.png" /></figure><p>While working on a relatively simple demo with GraphQL using Apollo server, I suddenly realise that having a functional end-to-end test of features wasn’t the most straightforward thing to achieve … and literally no Medium post out there to help me out 😱!</p><p>This quick read outlines an approach to functional test GraphQL Queries and Mutations simply using basic mock injection and a powerful feature of GraphQL.</p><h3>What’s out there for Testing</h3><p>The recommended approach out of Apollo <a href="https://www.apollographql.com/docs/graphql-tools/mocking.html">documentation</a> covers quite well how to unit test your schema. While it is a bit confusing at the beginning it is quite powerful as you can actually specify your <em>custom mocks</em> and <em>assert</em> with confidence 😏.</p><p><a href="https://www.apollographql.com/docs/graphql-tools/mocking.html">Mocking | GraphQL Tools</a></p><p>I am stating it is a bit confusing 🤨 because the quick setup pretty much fills your data result with a bunch of random <em>integers</em> and <em>“Hello World” </em>🤗<em> </em>strings just to prove that Types are correct. You can specify your custom Mocks and that works well (once you accept you get a collection of 2 items as data model result), but still very focused to the Schema Types part of the system.</p><p>Unit testing Resolvers is quite a straightforward task, as they should be developed as pure function 💪.</p><h3>The Problem</h3><p>By testing the Schema and Resolver in <em>isolation </em>you can get to a decent code coverage but still, you won’t know how the system will behave when put together ☹️.</p><p>A strategy to create <strong>functional tests</strong> for Queries and Mutations <strong>from request to response</strong> with predictable mocked responses is needed. This can be added on top of the Schema Types and Resolvers unit tests … or if you feel very brave, it can even replace those isolated units 🤐.</p><h3>The Solutions</h3><p>Two strategical pieces of the puzzle to achieve the goal:</p><ol><li>Make proper use of context during graphQL server setup 🙌. Context is an elegant way to provide (better said inject 💉) your resolvers with everything needed to deliver their job. An initial ‘quick &amp; dirty’ implementation may not make use of context letting the resolvers figure out where to get the data from. <br>This is the root of all the evils. Instead, the dependency injection technique that context allows will help greatly when it comes to use Mocked Services.</li><li>Get rid of addMockFunctionsToSchema. That is a great solution for testing GraphQL Schema in isolation, but not what we want here.</li></ol><p>Here a quick example on how to test a Query that fetches Movies and related Directors. There are comments on relevant line to explain what is going on.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d3a34cda7897d8966e130459d60fcb9d/href">https://medium.com/media/d3a34cda7897d8966e130459d60fcb9d/href</a></iframe><p>Finally, the main server Setup (Apollo with Express) to support this kind of Mocking strategy.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aaa7be7ded99adbcd868502ca1da5aed/href">https://medium.com/media/aaa7be7ded99adbcd868502ca1da5aed/href</a></iframe><h3>Conclusions</h3><p>Testing Schema and Resolvers in isolation is an ok technique and there are plenty tutorials out there on how to achieve this by using the valid addMockFunctionsToSchema technique out of Apollo Tools.</p><p>Adding functional end to end Queries and Mutations tests by providing Mocked Services gives a great confidence your system is under control. Eventually, some of the units for Schema Types and Resolvers may then be consider redundant, allowing you to have less, but bigger, cases.</p><p>The full repository with a working ‘Movie &amp; Directors’ GraphQL server is available at:</p><p><a href="https://github.com/nzaghini/graphql-server-addc-2018">nzaghini/graphql-server-addc-2018</a></p><p>The server is the companion repository of the below React Native project:</p><p><a href="https://github.com/nzaghini/react-native-graphql-addc-2018">nzaghini/react-native-graphql-addc-2018</a></p><p>Both repositories have been developed as part of the <a href="https://addconf.com/2018/schedule/introduction-to-react-native-and-graphql-for-app-development/">Workshop for developers: Introduction to React Native and GraphQL for App Development</a> at <a href="https://addconf.com/">ADDC Conference 2018</a> in Barcelona.</p><p><em>Please help improve this article with your thoughts &amp; comments!</em></p><h4>Read More</h4><ul><li><a href="https://itnext.io/graphql-resolvers-the-injector-pattern-a7e1d880c512">GraphQL Resolvers: the Injector Pattern</a></li><li><a href="https://hackernoon.com/extensive-graphql-testing-57e8760f1c25">Extensive GraphQL Testing in 3 minutes</a></li><li><a href="https://www.apollographql.com/docs/graphql-tools/mocking.html">Mock your GraphQL data based on a schema</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d178241464e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architecting Mobile Apps with (B)VIPER Modules.]]></title>
            <link>https://medium.com/mobile-travel-technologies/architecting-mobile-apps-with-b-viper-modules-e94e277c8d68?source=rss-35fd807eedba------2</link>
            <guid isPermaLink="false">https://medium.com/p/e94e277c8d68</guid>
            <category><![CDATA[viper]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Nicola Zaghini]]></dc:creator>
            <pubDate>Wed, 25 Nov 2015 15:57:09 GMT</pubDate>
            <atom:updated>2015-11-25T16:13:13.380Z</atom:updated>
            <content:encoded><![CDATA[<h4>A structured engineering approach for big mobile apps.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kZ7qeDZzqy158n5utOc_ww.jpeg" /><figcaption>Ponte Vecchio (FI) — Pictures taken walking to <a href="http://pragmaconference.com/">#PragmaConf15</a> Venue in Florence — XT1, 23mm</figcaption></figure><p>For those of us out there since the first iOS SDK was released we have seen a big shift in application engineering. While in the past we were all quite happy with what today we joke as Massive View Controller, now we face problems that require more structured engineering.</p><p>Irrespective of the technology decisions, what we should all try to achieve in a single word is: simplicity. Simplicity means that our codebase, which can be quite large, should be simple to communicate and maintain. Should also be simple to reuse, and should be simple to test, not just for the sake of code coverage, but for the confidence that as engineers we build bridges that won’t collapse under our feet.</p><p>In this post I will take you through a structured approach to mobile application engineering to achieve the simplicity mentioned above. This is not necessarily a new or “one fits all” way of doing things, but something that we have seen working quite well where I work at <a href="http://mttnow.com/">MTT</a>, creating great apps for airlines and travel companies worldwide.</p><p><em>We will together build on top of the </em><a href="http://mutualmobile.github.io/blog/2013/12/04/viper-introduction/"><em>VIPER Architecture</em></a><em> in order to achieve a high order modularity by formalising the building blocks of the design, focusing on reuse and customization with an high degree of testability.</em></p><p>What we are going to discuss here is tailored to iOS but can be successfully applied to Android and most likely other platforms.</p><h4>The blueprint</h4><p>If you have ever built a complex application you know already that most of the time MVC pattern falls short, as it leads too easily to (let’s abuse of this joke once again) Massive View Controllers; and you are already aware of some other interesting strategies on the subject tending towards something that helps us creating less Massive but more <a href="https://www.objc.io/issues/1-view-controllers/lighter-view-controllers/">Lighter View Controller</a>s.<br>Without a properly designed and communicated approach, it is quite easy to fall back to the “massive something” world.</p><p><em>An effective and clearly communicated blueprint is strategic in the engineering business.</em></p><p>Without it, it is quite common to end up with something that looks quite like the below :-)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*yaRYMJ_ERQObXNP64AR48A.jpeg" /><figcaption><a href="https://twitter.com/jordimirobruix/status/652394048146276352/photo/1">https://twitter.com/jordimirobruix/status/652394048146276352/photo/1</a></figcaption></figure><p>I will not dig into technology choices or chunks of code here, but instead I will focus on the blueprint and the relevant parts to successfully apply the design.</p><h4>Starting from VIPER Architecture</h4><p><a href="http://mutualmobile.github.io/blog/2013/12/04/viper-introduction/">VIPER from Mutual Mobile Engineering</a> is a way of architecting applications which takes heavy inspiration from the <a href="https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html">Clean Architecture</a>.</p><p>The main idea of VIPER is to create a (mostly vertically) layered architecture where the Single Responsibility Principle is achieved by using several different components.</p><p>Here is a standard representation of the different VIPER components and relationships between them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SGcSlNRdxmfpTj3xPi-Wxg.png" /><figcaption><a href="http://mutualmobile.github.io/blog/2013/12/04/viper-introduction/">http://mutualmobile.github.io/blog/2013/12/04/viper-introduction/</a></figcaption></figure><p>The acronym stands for:</p><p><strong>V</strong>iew: encapsulates the actual views, starting from view controllers<br><strong>I</strong>nteractor: encapsulates all the business logic and datasource access<br><strong>P</strong>resenter: encapsulates the presentation logic<br><strong>E</strong>ntity: the object model manipulated by the Interactor<br><strong>R</strong>outing: or Wireframe encapsulates the navigation logic</p><p>The next logical step is to formalise this design into <em>units of reusability</em>. In this interesting issue of <a href="http://objc.io/">obcj.io</a> there is an incipit on <a href="https://www.objc.io/issues/13-architecture/viper/#using-viper-to-build-modules">using VIPER to build Modules</a>.</p><p>We want to go deeper in the VIPER Module definition and make it the building block of the (B)VIPER approach.</p><h4>Toward a Standard Module</h4><p>While the VIPER layering allows for great decoupling, the way Modules should be built and communicate is left to the designer.</p><p>We can think of a Module as a <em>unit of reusability</em> that encapsulates a Use Case, or a Functionality, or one or more Stories. To start simple, just think of a Module as a single iPhone Screen; we can build from there.</p><p>Let’s start sketching with a 3 screens example Application: from an initial category selection to a list of items to a detailed view of the item.</p><p><strong>Step 1 — Module as a Black Box</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ID8dxmR_YMP7cblrqx1emg.png" /><figcaption>The Example Application made of 3 Modules linked to each other.</figcaption></figure><p>On the iOS platform the foundational building block of an iOS App is the UIViewController. The navigation happens from UIViewController to UIViewController.</p><p>It is foolish to fight against the framework, so a Module should be presenting itself to the outside world as a standard UIViewController.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bLo_U2VbguAVei26SCFqqw.png" /><figcaption>From an external point of view each Module is a standard UIViewController.</figcaption></figure><p>This allows the use of a Module into any iOS Application without any additional knowledge by the hosting application: a Module can be navigated from and navigate to something that has nothing to do with the current design.</p><p><strong>Step 2 — The Wireframe role</strong></p><p>When investigating the navigation between Modules, I want to stress that the Wireframe only business is to define the navigation to the next Module. Other approaches leave the business of Module creation to the Wireframe itself which violates the Single Responsibility Principle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6S0t39qXKidnECvFwQFQxA.png" /><figcaption>The Wireframe only business is to navigate to the next Module(s).</figcaption></figure><p>This of course implies some sort of knowledge of the next Module.</p><p><strong>Step 3 — The Module Builder</strong></p><p>To <em>better decouple</em> Modules to each other and achieve a <em>strong self containment,</em> we introduce the <strong>Module Builder component</strong> to the standard VIPER set of components.</p><p>The Module Builder is in charge of creating all the components of the Module (Presenter, View, Interactor, …) and make the connections. The Module Builder protocol usually presents a single methods like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sa8IOnFukIhSCK_a5s6Exg.png" /></figure><p>It is of course possible to have the UIViewController implement a protocol representing the Module external interface if needed.</p><h4>The Standard (B)VIPER Module</h4><p>This is a visual representation of a Standard (B)VIPER Module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4aj3qDzfkDfswwdVy-evg.png" /></figure><ul><li><strong>Module as black box </strong>for the outside world, presenting itself as <strong>a standard UIViewController</strong>. This allows an easy re-use of a Module even within apps that have a complete different design.</li><li><strong>Design by Interface as default approach</strong> where each component exposes a contract. It allows an easy swap of concrete implementations thus behaviours, plus easy mocking for testing.</li><li><strong>Builder </strong>is the key for reusability, declares what data is needed for the Module to be built, <strong>inject</strong> all the needed components letting the implementations change easily. A Builder must know the next Module(s) Builder.</li><li><strong>Services as data sources</strong>. A Service provides a contract to the Interactor to consume in order to retrieve or create Entities. <strong>Services</strong> <strong>are horizontal to Modules</strong> avoiding code duplication. Examples are Weather Service or Stock Service; those are not part of any Module.<br>Each Service should ideally live in its own <strong>Library.</strong></li></ul><h4>On the relationship between Presenter and View</h4><p>From the standard VIPER definition:</p><blockquote>“The Presenter can only prepare the data for display in the View. […] The View is passive. It waits for the Presenter to give it content to display; it never asks the Presenter for data.”<br><a href="http://mutualmobile.github.io/blog/2013/12/04/viper-introduction/"><em>Introduction to VIPER</em></a></blockquote><p>Let’s try to map this into some more canonical terms.<br>VIPER promotes MVP pattern where the Presenter handles View interactions, delegating any business logic to the Interactor if needed (so Presenter cannot modify the Model ideally) then asking the View to update by preparing “data for display”.</p><p>We need to introduce the concept of the Presentation Model which is our “data for display”. Ideally this model is UIKit agnostic as it exposes pure ready to display data in the form of String or Numbers: you can hypothetically share this code with other platforms with this approach.</p><blockquote>“Presentation Model is of a fully self-contained class that represents all the data and behaviour of the UI […] Presentation Model will have data fields for all the dynamic information of the view. This won’t just include the contents of controls, but also things like whether or not they are enabled.”<br><a href="http://martinfowler.com/eaaDev/PresentationModel.html"><em>Martin Fowler Presentation Model</em></a>.</blockquote><p>I’ve intentionally omitted any form of “logic” within the Presentation Model because we want to achieve the following:</p><ul><li>The View informs the Presenter on user interactions</li><li>The Presenter creates an immutable Presentation Model from Domain Model provided by the Interactor</li><li>The Presenter provides the View with the Presentation Model</li></ul><p>Here is the visual representation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j0uw7usgfYz4ZBY_o0WgWQ.png" /></figure><p>The <em>Presentation Model Builder</em> is extracted from the Presenter logic as it may get quite complicated when multiple Domain Models are needed to build a single Presentation Model. It also makes a lot more sense in terms of Single Responsibility.</p><p>A reactive programming style could be achieved here as well.</p><h4>Dependency Injection for Builders</h4><p>The Builder is in charge of building the Module it ships with. The best way of doing it is via <a href="https://en.wikipedia.org/wiki/Dependency_injection">dependency injection</a>. <a href="https://github.com/appsquickly/Typhoon">Typhoon</a> is probably the best DI Library for iOS available today.<br>Without getting into too much detail here, the DI gives you the ability to describe declaratively what Concrete Implementation for each Protocol is needed and the scope.</p><p>It is pretty much like playing LEGO® with the components building the Module. By injecting a custom component, changing the behaviour or the Visual Representation of the Module is easy.</p><h4>Testing the Module</h4><p>If you got this far you know that the main goal is to make testing easy. We can write <a href="https://vimeo.com/80533536">isolation checks</a> for each component of the Module easily by mocking the dependencies.</p><p>Adopting the Presentation Model approach we also get a great level of confidence on what the User Interface is actually going to display, even without touching a single UIKit class.</p><p>If you believe that your tests should actually cover the integration of your codebase from Network to User Interface, as this is what your user is actually going to experience, then you are not limited and I believe it is a nice addition on top of it.</p><h4>Dependency Management</h4><p>Such architecture would be rather ridiculous without a proper way to manage dependencies like <a href="https://cocoapods.org/">CocoaPods</a>.</p><p>As Modules are building blocks of Applications each Module should ideally live in its own Library, allowing the creation of Applications made of several Modules/Libraries. We are now playing LEGO® with different pieces: Modules rather than components within the Modules.</p><h4>Conclusion</h4><p>First of all, thanks a lot to <a href="https://twitter.com/vavvolo">Valentino</a>, <a href="https://twitter.com/aggshow">Claudio</a>, <a href="http://twitter.com/booranger">Colin</a>, <a href="https://twitter.com/onurburakozkan">Onur</a>, <a href="https://twitter.com/rafaeljuzo">Juzo</a> and many other talented guys and girls at <a href="http://mttnow.com/">MTT</a> for banging their heads with me on this!</p><p>We started from the word “simplicity”. On a first glance this may not seem exactly simple, as we added extra component to the canonic VIPER design. As the blueprint should be quite clear at this stage it is up to you to decide if the number of components per Module is too high for your specific business. Maybe your business is better tailored for a MVVM design or even a plain MVC.</p><p>Here at <a href="http://mttnow.com/">MTT</a> we have the sort of challenges that makes the (B)VIPER architecture very useful, and the experience of presenting and applying such approach to teams usually goes from this on day 1:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*khC6AYZYJae64u2bGP5PMA.gif" /><figcaption><a href="http://replygif.net/961">http://replygif.net/961</a></figcaption></figure><p>To this on day 3 or 4:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*xpGeAswrzZ2Gqawfw65Lug.gif" /><figcaption><a href="http://replygif.net/877">http://replygif.net/877</a></figcaption></figure><p>Some of the best feedback I have received so far is:</p><p>“<em>Now that I am familiar with it, I can jump through unknown Modules very quickly and I always know where to put my code</em>” and<br><em>“I can finally write tests easily and quickly, which it has always been a nightmare for me to do.”</em></p><p>Final thanks to the guys at <a href="http://pragmaconference.com/">#PragmaConf15</a> Florence. It was a real surprise, kudos to all the organisers and great speakers. There I got the chance to talk with great guys at Artsy (<a href="https://twitter.com/artsy">@artsy</a>) and FanDuel and many others, that encouraged me to write about this structured approach on engineering big apps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e94e277c8d68" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mobile-travel-technologies/architecting-mobile-apps-with-b-viper-modules-e94e277c8d68">Architecting Mobile Apps with (B)VIPER Modules.</a> was originally published in <a href="https://medium.com/mobile-travel-technologies">Travelport Digital Insights</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>