<?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 Callum Trounce on Medium]]></title>
        <description><![CDATA[Stories by Callum Trounce on Medium]]></description>
        <link>https://medium.com/@cmtrounce?source=rss-e8bfcd725b82------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*uUYx_26_SQd1ZKGA2A2i9Q.png</url>
            <title>Stories by Callum Trounce on Medium</title>
            <link>https://medium.com/@cmtrounce?source=rss-e8bfcd725b82------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 02:02:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cmtrounce/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[Back to Basics: Decomposing MVC]]></title>
            <link>https://medium.com/@cmtrounce/back-to-basics-decomposing-mvc-8dc9516577a2?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/8dc9516577a2</guid>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Sat, 05 Aug 2023 16:57:44 GMT</pubDate>
            <atom:updated>2023-08-05T16:57:44.417Z</atom:updated>
            <content:encoded><![CDATA[<h4>Say goodbye to Massive View Controller</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SVPwVIvifnv367a5NbgkEQ.png" /><figcaption>Some random art, Courtesy of Bing.com Chat</figcaption></figure><p>We’ve all seen it; a UIViewController, that throughout its lifetime, has grown arms and legs.</p><p>A UIViewController ‘s primary responsibilities are:</p><ul><li>Presenting data to the user</li><li>Responding to user interaction</li></ul><p>What a UIViewController should avoid:</p><ul><li>Performing business logic</li><li>Maintaining the state of data</li><li>Handling and performing navigation</li><li>Having lots of [private] dependencies</li></ul><p>This could look something like the following:</p><pre>import Foundation<br>import UIKit<br><br>final class MainViewController: UIViewController {<br>  private let dataManager = DataManager()<br>  private let appManager = AppManager.shared<br>  <br>  var mainData: MainData {<br>    didSet {<br>      tableView.reloadData()<br>    }<br>  }<br><br>  private let tableView = UITableView()<br><br>  public override func viewDidLoad() {<br>    super.viewDidLoad()<br>    appManager.doThing {<br>        self.tableView.reloadData()<br>    }<br>    dataManager.getData { result in<br>        let sortedData = result.sorted()<br>        self.mainData = sortedData<br>    }<br>  }<br>}<br><br>extension MainViewController: UITableViewDataSource, UITableViewDelegate {<br>  ...<br>}</pre><ul><li>Private/implicit dependencies</li><li>Storing logic and managing the state of data</li><li>Performing business logic of its own (sorting of the result)</li><li>Acting as the tableView‘s data source (containing logic for dequeuing and configuring the cell.)</li></ul><p>UIViewController operates on the UI layer of your app; it interacts very closely with UIKit and other Apple libraries.</p><p>Unit testing any logic performed in the UIViewController is nigh-on impossible because the output of the UIViewController is what is displayed to the user. This makes it difficult to verify that any changes to the code result in regressions in behaviour or user experience.</p><p>To validate logic performed in UIViewController, you may have to traverse the UI Hierarchy.</p><p>You can write UI Tests to validate specific scenarios, but UI Tests:</p><ul><li>Take longer to run — slower feedback loop during development</li><li>Include more boilerplate and setup code (e.g. what happens if your UIViewController requires data from an API?)</li><li>Are not capable of capturing all edge cases in your logic.</li></ul><p>Generally, using UI Tests to validate business logic is not advised.</p><h3>Decomposition</h3><p>Right now, our MainViewController has a lot going on.</p><p><strong>You don’t have to pick a design pattern up front! </strong>The main focus should be getting our MainViewController in a cleaner, testable state so that any further changes to functionality or architecture can be done confidently. This process is called <strong>decomposition</strong>, using the<a href="https://clean-swift.com/single-responsibility-principle-for-class/"> Single Responsibility Principle</a> (alongside the rest of SOLID) as a guide.</p><p>Decomposition:</p><ul><li>Reduces the complexity and size of the code, making it more readable and manageable.</li><li>Improves the modularity and cohesion of the code: each component has a clear and specific purpose and does not depend on anything external.</li><li>It enhances the reusability and maintainability of the code: each component can be used in different contexts and be easily modified or updated without affecting others.</li><li>It facilitates the testing and debugging of the code: each component can be tested and verified independently. Errors can be isolated and fixed more quickly.</li></ul><p><strong>Identify and inject your dependencies.</strong></p><p>Allow your dependencies to be modified to control input in unit tests.</p><p>To start with, a simple initialiser would do the trick.</p><p>We can use protocols to pass mock/test double objects, which will act as an interface.</p><pre>import Foundation<br>import UIKit<br><br>final class MainViewController: UIViewController {<br>  private let dataProvider: DataProvider<br>  private let appManager: AppManagerInterface<br>  <br>  init(<br>    dataProvider: DataProvider,<br>    appManager: AppManagerInterface<br>  ) {<br>     // Set our dependencies here<br>     ... <br>  }<br>}</pre><p>This makes MainViewController more testable, with the added benefit of making the dependencies of it transparent.</p><p><a href="https://medium.com/@cmtrounce/why-i-dont-use-default-values-e17cfb16ce1c">Understand why transparent dependencies are important.</a></p><pre>let mainViewController = MainViewController(<br>  dataProvider: DummyDataProvider(),<br>  appManager: DummyAppManager()<br>)</pre><p>Still, it would be fantastic to test the data preparation in isolation, specifically the sorting.</p><p><strong>ViewModel</strong></p><p>Let’s test our data logic in isolation.</p><p>Our new MainListViewModel class will be responsible for retrieving and sorting the data.</p><pre>protocol MainListProvider {<br>  func getMainList(completion: @escaping (MainList) -&gt; Void)<br>}<br><br>final class MainListViewModel: MainListProvider {<br>  private let dataProvider: DataProvider<br><br>  init(<br>    dataProvider: DataProvider<br>  ) { ... }<br><br>  func getMainList(completion: @escaping (MainList) -&gt; Void) {<br>    dataProvider.getData { result in<br>      completion(result.sorted())<br>    }<br>  }<br>}</pre><p>and update our MainViewController</p><pre>import Foundation<br>import UIKit<br><br>final class MainViewController: UIViewController {<br>  private let listProvider: MainListProvider<br>  private let appManager: AppManagerInterface<br>  <br>  var list: MainList {<br>    didSet {<br>      tableView.reloadData()<br>    }<br>  }<br><br>  init(<br>    listProvider: MainListProvider,<br>    appManager: AppManagerInterface<br>  ) {<br>     // Set our dependencies here<br>     ... <br>  }<br><br>  public override func viewDidLoad() {<br>    super.viewDidLoad()<br>    appManager.doThing {<br>        self.tableView.reloadData()<br>    }<br>    listProvider.getMainList { result in<br>        self.list = result<br>    }<br>  }<br>}</pre><p>Now, with the sorting logic out of the MainViewController and into MainListViewModel, we can quickly write separate unit tests for MainListViewModel to validate the sorting behaviour.</p><p>Even though it is a small code change, it removes responsibility from the MainViewController and makes the existing functionality unit testable.</p><p>We can easily monitor for regressions if we need to introduce additional functionality.</p><h3>Next Steps</h3><p>Apply the same principle to all other behaviours inside your MainViewController — for instance:</p><ul><li>DataSource: A separate utility to map the items from MainList into MainListTableViewCell</li><li>Move behaviour for handling table view events into the MainListViewModel or create a separate object that conforms to UITableViewDelegate.</li><li>Move the behaviour for navigating between pages into a separate class; You could borrow the Router behaviour from the VIPER design pattern. <a href="https://medium.com/@smalam119/viper-design-pattern-for-ios-application-development-7a9703902af6">Read more about VIPER here.</a></li><li>Investigate potential design patterns and conventions appropriate for your codebase and team.</li></ul><h3>Conclusion</h3><p>We’ve taken an example of a View Controller that has become bloated, identified why that is problematic, and looked at ways in which it can be improved to become more testable and maintainable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8dc9516577a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are Code Owners right for your team?]]></title>
            <link>https://medium.com/@cmtrounce/are-code-owners-right-for-your-team-a593abf77352?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/a593abf77352</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Wed, 05 Jul 2023 18:30:04 GMT</pubDate>
            <atom:updated>2023-07-06T11:58:40.564Z</atom:updated>
            <content:encoded><![CDATA[<h4>How Code Ownership can turn from an asset to a liability.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EToRXkNpFmBebt3xfQ5pqQ.png" /><figcaption>Generated by Bing.com</figcaption></figure><h3>What are code owners?</h3><p>Code owners are members of a team that are responsible for maintaining particular parts of the codebase. In addition, the code owners may have domain-specific knowledge to help support other team members who want to contribute.</p><h3>How are code owners defined?</h3><p>In the case of GitHub, in every repository, you can create a CODEOWNERS file at the root level, containing a list of specific directories/files and with the respective code owner. A code owner can be a particular individual or a team — if a pull request references a resource with a code owner, the code owner is assigned as a reviewer. GitHub offers advanced settings in ‘Branch Protection’ and GitHub team settings.</p><p>In most instances, code owners are typically used to answer the following questions:</p><blockquote>How can we ensure code and usage conventions are adhered to?</blockquote><blockquote>How can we ensure our code remains robust and bug-free?</blockquote><p>This article explains how code owners address these questions, highlight pitfalls and propose solutions.</p><h3>Why Code Owners?</h3><p>Code owners are more familiar with those areas of the code — after all, if they’re maintaining that part of the code, they should know the preferred usage. Therefore;</p><ul><li>The code owners will likely spot API misuse and bugs in the implementation.</li><li>Pull request authors are more confident when a code owner reviews their work.</li><li>Continuity: It’s beneficial for the same reviewer to be involved in a set of changes; it helps provide additional context, supporting decision-making and solution design — all contributing to a more streamlined delivery.</li></ul><h3>The Shortcomings</h3><h4>Dependence</h4><p>Code owners come with an inherent risk of causing a knowledge silo. The surrounding team may become dependent on specific individuals for domain-specific knowledge.</p><p>What happens if the code owners are unwell, on vacation, or leave the company?</p><p>Code owners disincentivise people from learning about more parts of the codebase, and if the code owner is absent, the team may have a massive knowledge gap.</p><h4>Bottlenecks</h4><p>Building upon the dependency issue above, if there are a small number of code owners for a disproportionately large part of the codebase, which has frequent changes, then the code owners will be overwhelmed by the number of pull requests. There is then less time to carry out the other responsibilities of their role (i.e. improving the codebase, adding new features and functionality etc.)</p><p>Pull request reviews slow down, and efficiency drops. The wider team may become resentful.</p><p>This issue exacerbates if there’s a single code owner for large chunks of the codebase — you never want to have a single person responsible for a part of the app, especially if it’s within a large team.</p><p>To summarise, Code Owners certainly have some benefits, but may unintentionally cause friction, disincentivise knowledge sharing and decrease productivity.</p><h3>Solutions</h3><h4>Use team Code Owners instead of individuals.</h4><p>You might think, “Well, what’s the difference?” — I’m glad you asked.</p><ul><li>Dependence no longer has to be on a specific person.</li><li>Teams have more flexibility in setting rules regarding pull request reviews. Assigning Pull Request reviews in round-robin promotes knowledge sharing.</li><li>People can join the team and contribute their ideas.</li><li>A team more naturally facilitates a forum for transparent and healthy discussion and debate.</li></ul><h4>Improve code readability.</h4><p>‘Improving code readability’ <em>doesn’t</em> mean you have to go ahead and refactor everything — If there’s some difficult-to-follow code or complex business logic, ensure the code is as easy to follow as possible. Favour readability over conciseness. At the very least, add comments in the code to provide context and insight.</p><h4>Add documentation where it makes sense.</h4><p>Make it clear what the best practices are. Documentation includes but is not limited to; more extensive code commenting (think Javadoc, DocC etc.), example projects and code snippets, confluence pages, and dedicated READMEs.</p><p>Documentation makes it easy for consumers of the code to understand how to use the code quicker, and less time is required to get started. Other engineers no longer rely on individuals for domain-specific knowledge, which addresses dependence concerns.</p><h4>Pair Programming.</h4><p>Code Owners with specific knowledge should pair with people who are not code owners, speeding up the feedback loop. A quicker feedback loop catches bugs and mistakes in their midst. Pair programming also promotes a natural exchange of expertise, domain-specific knowledge and experience.</p><h4>Get rid of Code Owners.</h4><p>The nature of a team and codebase is likely to change over time. In the context of GitHub, regularly evaluate your CODEOWNERS file to see if it still makes sense and update it if needed. Make use of pair programming, documentation, and knowledge transfer and exchange.</p><p>Removing code owners outright may be less appropriate in certain circumstances (e.g. teams working across different tech stacks.)</p><h3>Conclusion</h3><p>If used appropriately, Code Owners can help uphold the quality and consistency of parts of the codebase. As a team changes, the strengths may become weaknesses, introducing unnecessary friction and slowing productivity.</p><p>As a general solution, Code Owners should be more transparent, promote knowledge transfer, participate in knowledge-sharing activities, and make the code accessible to other engineers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a593abf77352" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Pair Programming makes you faster]]></title>
            <link>https://medium.com/@cmtrounce/how-pair-programming-allows-your-development-team-to-deliver-value-quicker-f97d07a4befd?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/f97d07a4befd</guid>
            <category><![CDATA[pair-programming]]></category>
            <category><![CDATA[culture]]></category>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[collaboration]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Fri, 25 Nov 2022 07:24:07 GMT</pubDate>
            <atom:updated>2022-12-15T21:14:08.219Z</atom:updated>
            <content:encoded><![CDATA[<h4>What is pair programming, and how does it help?</h4><p>Pair programming has been around (at least officially) since the 90’s – originally considered an extreme programming technique, it comprised of two engineers sitting at the same workstation, working their way through a solution.</p><p>Over the past couple years, companies have made the shift to remote working, and so ways of working have had to massively shift to account for that. Pair programming sessions might now be facilitated over a screen sharing call, using dedicated pair programming software, or functionality built into the IDE.</p><p>While the pair programming process might have changed slightly, the heart of it hasn’t, and neither have the core benefits – which I’ll cover in this article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-2zVZJ8gPvcXIXMSu_PURA.jpeg" /><figcaption>These engineers are pair programming</figcaption></figure><h3>Less Room for Mistakes</h3><p>With two engineers working on the same task together, it’s a lot more likely for errors and bugs to be spotted. It gives an opportunity for the developers to ask each other questions and challenge the approach in a healthy manner on the fly.</p><p>While you might think that might actually result in delays, it’s actually the opposite. The same questions might have been raised later in the process during a pull request / code review, which has an inherently slower feedback loop, and it might be difficult to re-engineer a solution at that stage.</p><p>Teams that pair program often have higher quality code in general.</p><h3>Context is Shared</h3><p>Context is important – especially for engineers. It provides a source of understanding for why a particular solution was used, what problem is trying to be solved, and overall general awareness of the feature or solution.</p><p>This helps remedy steps further down the process, such as code review, which has a comparatively slower feedback loop. After coming to a solution through pair programming, you can assign the other engineer in the pair as one of the pull request reviewers.</p><p>By doing this, you reduce the burden commonly associated with context switching; not only speed up the code review, but allows for a higher quality one – as the reviewer has the additional insight to ask more nuanced questions.</p><p>In addition to this, having more developers knowing about a particular feature means that if there’s a new business requirement, more people are able to more quickly pick up the work.</p><h3>Effective Debugging</h3><p>As an engineer, you might intuitively think that debugging by yourself allows you to more quickly pursue a train of thought and debug the problem. In some cases, this is definitely true, but is usually limited to where you have domain-specific knowledge, which is something you can’t take for granted.</p><p>There’s value in having someone available to bounce ideas off while debugging. Solutions can tend to manifest themselves after talking about it out loud (which is why rubber-duck development is so popular!) – pair programming is a natural way to facilitate that.</p><h3>Improved collaboration</h3><p>This is something that becomes all the more relevant now that a lot of tech companies have switched to a remote-only model. Face to face interaction has been lower than ever, sometimes it’s difficult to bond with team members, and colleagues can become silo’d and isolated from each other.</p><p>Pair programming is a natural facilitation for this collaboration – allowing the spread of individuals’ knowledge and values. Pair programming also builds understanding between the colleagues about their problem solving approach, making future collaborations more effective.</p><p>It also aids in building confidence in engineers that might typically be more shy or introverted, who definitely have valuable ideas or approaches to share but doing so might come more naturally to them while pair programming.</p><p>Collaborating and communicating with others is a fundamental part of working within a team, and pair programming is a natural way to bring the team closer together.</p><h3>Learning Opportunities</h3><p>There’s so much room for learning during pair programming. Working with people that you haven’t worked with before, discussing different solution approaches, sharing domain specific knowledge.</p><p>If you’re a junior engineer, pair programming with a senior engineer might be one of the best learning experiences. It’s also a fantastic opportunity for the senior to learn how to mentor others – reaffirming their knowledge and understanding – a great confidence booster.</p><p>It’s also relevant when senior engineers pair as well. I know when I collaborate with domain-specific experts, it’s one of the moments when I learn more in a couple of hours than I would in a week by myself.</p><p>To summarise, this article has covered how pair programming can improve code quality, reduce unnecessary friction and foster an environment for knowledge sharing and collaboration.</p><p>These benefits are noticeable in any engineering team, and are the key to unlocking more continuous delivery of value.</p><p>Thank you for taking the time to read this article — I hope you gained something from it.</p><p>Does your team use pair programming? How has it helped your team?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f97d07a4befd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Tech Debt and why does it matter?]]></title>
            <link>https://medium.com/@cmtrounce/what-is-tech-debt-and-why-does-it-matter-db192f5512e1?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/db192f5512e1</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Thu, 25 Aug 2022 17:32:23 GMT</pubDate>
            <atom:updated>2022-08-25T17:32:23.035Z</atom:updated>
            <content:encoded><![CDATA[<h4>The impact of Tech Debt on software engineering and product development.</h4><p>Tech Debt, short for <em>Technical Debt</em>, is a common term used within the software engineering discipline.</p><p>If you work in tech, you might have heard the phrase ‘Tech Debt’, or when discussing estimates, you might have heard from the engineering team, <em>‘This part of the project has some Tech Debt, so this project will take a bit longer to complete.’</em></p><p>This article aims to help explain what engineers mean by Tech Debt, what impact it has, and suggests some steps to take to reduce it.</p><h3>What’s Tech Debt?</h3><p>The best way to explain it is by analogy.</p><blockquote>“Mise en place” — (in a professional kitchen) the preparation of dishes and ingredients before the beginning of service.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s2EyLL2mkcwwRrfjAB6Ybw.png" /><figcaption>This chef (let’s call him Dave) has all his ingredients prepared and a clean working space.</figcaption></figure><p>Chefs not only have to prepare before cooking starts but keep the kitchen surface clean between cooking and remain organised.</p><p>If there’s a big order, it means more cleaning up afterwards. Back-to-back cooking results in less time for cleaning, and patrons changing their minds about what they want to order means the chefs have to start from scratch.</p><p>It’s a stressful environment and more mistake-prone. The kitchen becomes disorganised, and meals take longer to prepare. The chefs may even feel inclined to rush to avoid customer complaints.</p><p>You’ve seen enough <em>‘Gordon Ramsay’s Kitchen Nightmares’ </em>to know what that looks like.</p><h4>What does that look like in software engineering?</h4><p>We can compare this to a software engineering environment. Over the lifetime of a software project, customers provide feedback; requirements change — sometimes, there are deadlines, and sometimes priorities shift.</p><p>If not properly managed, you can imagine this might leave a bit of a mess over time, like in a kitchen — and this is what is described as Tech Debt.</p><p>It’s important for software engineers to apply<em> ‘mise en place’,</em> as a chef would in a professional kitchen — ensuring that the project and code remain organised. If this isn’t respected, then it’s more difficult for other software engineers to work on, subsequent projects become more difficult to estimate, and take longer to complete in general.</p><p>To summarise, the engineers are the chefs, and lots of Tech Debt is like a really messy kitchen. In addition, it’s completely natural that you come out of a project with Tech Debt, the same way a chef might have some dirty pots and pans after cooking — it only becomes unmanageable when it isn’t addressed in a timely fashion.</p><h3>Ways to help reduce Tech Debt</h3><p>In a business, Tech Debt often competes with feature work that drives value to the product. Dedicating time to fixing tech debt is often difficult because the benefit is often long-term and tough to express to business stakeholders.</p><p>A team of engineers, in collaboration with management, can use some short and long-term strategies to help reduce tech debt.</p><p><strong>Engineers should keep track of what Tech Debt there is. </strong>Use the convention of your choice, commenting in code, JIRA tickets, etc. I find it more transparent to use tickets so that the tech debt is surfaced to management, and it can be prioritised later if need be.</p><p>When estimating projects, <strong>engineers should include additional time to address tech debt by default. </strong>It might sound obvious<strong>, </strong>but it’s often an oversight.<strong> </strong>You never know what tech debt ends up blocking the progress of the project, so best to allow for that time.</p><p>When starting a project in an existing part of the codebase, <strong>engineers should investigate the codebase and communicate if there is significant tech debt. </strong>This will help manage the expectations of the stakeholders and will allow for estimations to be adjusted if necessary.</p><p><strong>Stakeholders should allow time for the software engineers to tidy up after a project is finished. </strong>Before jumping onto another project, software engineers really appreciate being able to go back and neaten up things, especially when working under tough deadlines. <strong>This can help reduce the risk of burnout.</strong></p><p><strong>Engineers should be proactive in educating management </strong>on what Tech Debt means, using terminology that everyone understands. It’s often a terminology barrier that results in confusion. Product Managers can’t read software engineers’ minds.</p><p><strong>Stakeholders shouldn’t make assumptions </strong>as to how long a piece of work might take; you never know how much tech debt there is and how much work has to be done to ensure the product remains stable.</p><h3>Conclusion</h3><p>This article breaks down the concept of Tech Debt, discusses the problem relating to too much tech debt, and proposes a few ways in which it can be tackled.</p><p>I hope you have enjoyed reading. If you have any thoughts or insights on how to manage tech debt, I’d love for you to leave a comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db192f5512e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fewer protocols = Less Boilerplate]]></title>
            <link>https://medium.com/@cmtrounce/fewer-protocols-less-boilerplate-8b3f378a79aa?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b3f378a79aa</guid>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Mon, 01 Aug 2022 08:03:02 GMT</pubDate>
            <atom:updated>2022-08-01T08:03:02.684Z</atom:updated>
            <content:encoded><![CDATA[<h4>Reducing protocols and maintaining clarity</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*i-FzC8frNR0K1AtwkLeeKw.png" /></figure><p>Dear reader, to get the most out of this article, I’d recommend a fundamental understanding of dependency injection, how it’s used in unit tests, and the role Protocols play in facilitating it.</p><h3>Protocols</h3><p>Protocols in Swift are super handy, being a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality.</p><p>Acting as an Interface, Protocols help support SOLID principles and make it easy to decouple components, allowing for a more modular, scalable codebase — the developer can swap the underlying implementations out, as and when needed.</p><h3>Boilerplate code</h3><p><em>What is boilerplate code?</em> Well, it depends who you ask — but it’s typically code that you see repeated throughout a codebase, with little to no variation.</p><p>Nobody I’ve spoken to likes boilerplate code — being a point of friction during the development process, too much of it can cause your code to become overly bloated, and unit/integration tests take longer to write than they should.</p><p>You might even find yourself getting deja-vu when writing a Mock object for unit testing, as you have several Mock objects that behave in a very similar way.</p><h3>Let’s get into it</h3><p>This article will cover a typical use case where Protocols has introduced boilerplate code, and how we can potentially reduce it.</p><p>As a quick disclaimer, this scenario is quite specific — the solution I will propose is not a one-size-fits-all solution, and codebases can be different.</p><p>I don’t dislike Protocols; they are still a perfectly valid approach in modern solution architecture and will always have a place in my heart — but it’s good to point out where they can potentially introduce friction.</p><h3>Example</h3><p>We have our <em>URLRequestAuthenticator</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UDkgsJcKtCtiR9EIaG61nw.png" /></figure><p>And the protocols that it consumes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*PzYU4rBmeJCUcRurXLeibA.png" /><figcaption><strong>UserIDProvider</strong> and <strong>BearerTokenProvider</strong></figcaption></figure><p>Fairly straightforward, the usage of protocols abstracts the behaviour to return the <em>userID</em> and <em>bearerToken</em> values, which we use to authenticate the <em>URLRequest</em> in the <em>authenticate</em> function.</p><p>We need a concrete implementation of <em>UserIDProvider</em> and <em>BearerTokenProvider</em> to inject into our <em>URLRequestAuthenticator</em>.</p><p>So far, so good.</p><h3>Unit Testing</h3><p>We have to write unit tests for <em>URLRequestAuthenticator</em> and assert the usage of <em>userID</em> and <em>bearerToken.</em></p><p>We need mock objects — to return stubbed values for <em>userID</em> and <em>bearerToken</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*McJ-upROqPyqh0duDtHVBQ.png" /><figcaption><strong>BearerTokenProviderMock </strong>and<strong> UserIDProviderMock</strong> return a stubbed <strong>bearerToken </strong>and<strong> userID </strong>respectively<strong>.</strong></figcaption></figure><p>Now we’ve written two additional structs — only for unit tests, and for each unit test, we’ve got to instantiate these custom structs and inject them.</p><p>You can tell that if we introduce more dependencies into <em>URLRequestAuthenticator</em>, or if we work with an object with more dependencies, this doesn’t scale well in terms of boilerplate code.</p><p>On top of this, we’re dedicating a lot of effort to writing custom models to support non-production code, which is inefficient.</p><p>I already consider the protocols boilerplate, as they are essentially describing, ‘we want something that returns a string with a particular name’ — the only thing that is changing is the context that they’re used in.</p><p>If we can find a more generic approach, then we can remove this boilerplate code.</p><h3>An Alternative: closures</h3><p>Consider the following, no protocols, <em>userID</em> and <em>bearerToken</em> provided as closures.</p><p><em>@autoclosure</em> used, so then you can pass properties directly, and closure is inferred.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfOKr1_tQW4rNWwfLEWRBg.png" /></figure><p>Benefits</p><ul><li>Underling type of <em>bearerToken</em> and <em>userID</em> is more transparent</li><li>No need to create mock objects for unit tests, can just pass values directly.</li><li>Less code in general to maintain</li></ul><h3>Resolving ambiguity</h3><p>You do introduce a bit of a mess in the initialiser, but you can solve this with <em>typealias</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DgaJZB1HvhA1zbX23xRJfQ.png" /><figcaption>Typealias <strong>OptionalStringProvider </strong>removes some of the closure noise.</figcaption></figure><p>Reduce repeated code with the use of <em>generics.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4nUnDGoVFP1Q0Npad_BQyA.png" /><figcaption><strong>ValueProvider&lt;T&gt;</strong> can be typealiased to support any value provided via closure</figcaption></figure><p>Improve type safety with custom structs. This will help you to pass the correctly typed properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZSTODIVO5u_VNExNlmfMQ.png" /><figcaption><strong>UserID</strong> and <strong>BearerToken</strong> structs wrap around their respective underlying values.</figcaption></figure><p>You might consider this as reintroducing boilerplate code, but the distinguishing factor is that this is production code, and custom types are providing type safety, delivering greater intrinsic value than Protocols.</p><h3>Conclusion</h3><p>This article has covered how closures can be used as an alternative to protocols in dependency injection, and can aid in the reduction of boilerplate code.</p><p>There are of course trade offs for both, so I encourage evaluating the usage of protocols vs closures on a case by case basis.</p><p>I hope you have enjoyed reading this article, and taken something away from it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b3f378a79aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I don’t use default values]]></title>
            <link>https://medium.com/@cmtrounce/why-i-dont-use-default-values-e17cfb16ce1c?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/e17cfb16ce1c</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Sun, 24 Jul 2022 09:57:15 GMT</pubDate>
            <atom:updated>2022-07-24T09:57:15.824Z</atom:updated>
            <content:encoded><![CDATA[<h4>You shouldn’t either, and here’s why.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0iiObsBU8pEu_sgIpCeBsQ.jpeg" /><figcaption>Transparency is one of the core tenets of dependency injection.</figcaption></figure><p>Dependency injection always comes up as a point of discussion during project architecture and solution design.</p><p>These days in iOS development, there are many ways to ‘solve’ dependency injection, for instance;</p><ul><li>A third-party library like Swinject?</li><li>Property wrappers?</li><li>Passing via initialisers?</li></ul><p>All perfectly valid options, and it depends on the use case.</p><p>During your time as a software developer, you’ll more than likely stumble across some code that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FU3QcHYhy1uC7ezXnFAG-Q.png" /><figcaption>MyManager.swift initialiser with default values.</figcaption></figure><p>This is common in monolithic projects (projects that are not broken down into many modules).</p><p>On initial inspection, this doesn’t seem <em>too</em> bad, but I’ll explain why it’s a pet peeve of mine.</p><p><strong>Dependencies are less transparent</strong></p><p>It’s vital to be clear about what an object depends on and, by extension, what dependencies you pass when you instantiate the object.</p><p>This is particularly important when you have a large team — with the potential of the same object being used by various people with different skill levels and familiarity with the codebase.</p><p>Making dependencies less transparent increases the risk of passing the wrong value in the initialiser, resulting in a bug in the software.</p><p>It’s easy to trust Xcode’s auto-completion and mistakenly use whatever the default values are, without considering side effects — whether it be bugs in production code, or production dependencies being used in unit tests.</p><p>By removing default parameters, we can force the developer to consider what specific dependencies should be passed to it.</p><p><strong>Introduces tight coupling</strong></p><p>In the example above, DefaultUserDataService is passed as a default parameter.</p><p>This means that to whoever uses the default initialiser of MyManager, DefaultUserDataService is now an implicit dependency.</p><p>This becomes problematic when you start to modularise the project, but can already be considered a code smell, as there is not a strict separation of concerns.</p><p>If DefaultUserDataService was moved into another module — named UserData, MyManager would have to import the UserData module to use DefaultUserDataService as a default parameter.</p><p>The file would now look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QPL5kNKXCmP3f6qRwyTynw.png" /><figcaption>To continue using DefaultUserDataService as a default, we’ve had to import UserData into MyManager.swift.</figcaption></figure><p>By tightly coupling MyManager’s module to the UserData module unnecessarily we’re breaking SOLID principles — and potentially increasing compile time, as we’re going to have to recompile MyManager any time UserData changes.</p><h4>Conclusion</h4><p>To summarise the above, it introduces unneeded complexities, resulting in friction when writing unit tests, and makes navigating through the project a confusing and cumbersome experience.</p><p>We should be focused on ensuring contracts for objects are clean and transparent.</p><p>I’d recommend removing default values for dependencies, or at the very least, reevaluating how you’re using dependency injection in your project — for the purposes of scalability and transparency within your codebase.</p><p>I hope you enjoyed reading this short piece and managed to take away something from it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e17cfb16ce1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Swift Protocols to Improve Code Quality]]></title>
            <link>https://medium.com/@cmtrounce/using-swift-protocols-to-improve-code-quality-d88c26ac9464?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/d88c26ac9464</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[protocol]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Sun, 02 Dec 2018 12:55:53 GMT</pubDate>
            <atom:updated>2018-12-02T12:55:53.139Z</atom:updated>
            <content:encoded><![CDATA[<p>So, you’re working on a project with many team members, or perhaps you’re writing a framework. Both involve writing code which other developers will most likely look at or use in some way, whether it be adding new functionalities, or accessing your functions from outside.</p><p>If you’re working independently, it’s easy to get into the bad habit of jumping straight into writing the implementation and improvising as you go, only to come back to it later the same week, finding that you, or any of your colleagues, can’t read any of it.</p><p>This will result in new functionalities taking longer to add, confusion within your team and in some cases might end up in a complete rewrite of entire features.</p><h3>Commenting</h3><p>Remember, comments should not just be written for yourself. Other people will read your code, so when you’re writing your comments, make sure that it’ll make sense for them, and for yourself when you come back to it after a few weeks. You can achieve this by following a few golden rules.</p><h4><strong>Make no assumptions</strong>:</h4><p>Don’t assume other devs know as much about the project as you do. Don’t use any phrases that might not seem obvious to others. A lot of time is wasted if time is spent checking for external dependencies and potential side effects.</p><p>If you notice you’re writing a novel to explain a single function, your function its probably doing too much. Perhaps you should break the function down into several smaller ones.</p><h4>Keep it clear:</h4><p>Remove redundant words and phrases, but do not remove so much that phrasing becoming ambiguous. Comments should clearly and concisely explain the role of the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*nuTzTSPezBwTYF_rtEhlqQ.png" /></figure><h4><strong>Don’t say what it <em>is</em>, say what it </strong><em>does</em>:</h4><p>We’ve all seen comments that describe exactly what the function is for example: but explain nothing about the role it has.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ba5c9f7d9e37295f22dd3754d6755b4/href">https://medium.com/media/3ba5c9f7d9e37295f22dd3754d6755b4/href</a></iframe><p>You’re probably looking in the function implementation to see what the function <em>actually does </em>but you <em>shouldn’t </em>have to do that. The comments should tell you everything that you need to know.</p><p>We could make this a lot easier for other developers to read. Using <strong>cmd + option + /, </strong>Xcode can let us generate a nice comment structure for this function and we can improve it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e4b0c8b7a4f923bb5abbe32137d5c39/href">https://medium.com/media/3e4b0c8b7a4f923bb5abbe32137d5c39/href</a></iframe><p>So we have a nicely commented function now. We want to add a bit more functionality for our User objects now, so we create a UserService .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bff2c0f1ca1f4ed402441e37970832dc/href">https://medium.com/media/bff2c0f1ca1f4ed402441e37970832dc/href</a></iframe><p>It is fine to leave it as-is for a beginner project, but when you’re writing your own frameworks or working on commercial projects, this is simply not enough.</p><p>Code needs to be unit testable and maybe some implementation code needs to have restricted access.</p><h3>Protocols</h3><p>Using protocols will bring many benefits to the project. We want to make our UserService more readable, so lets make a Protocol for it, aptly named UserServicing</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d1fef887b7c9ea7f9cc896c564400eb/href">https://medium.com/media/5d1fef887b7c9ea7f9cc896c564400eb/href</a></iframe><p>Where UserService conforms to UserServicing, then used like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba182170e83223de76697c265ac80135/href">https://medium.com/media/ba182170e83223de76697c265ac80135/href</a></iframe><p>So, what makes this better?</p><ul><li><strong>No implementation code: </strong>With no distracting implementation code getting in the way, combined with good quality comments, you can more clearer see the responsibility of each function and the functionality of the Servicing as a whole.</li><li><strong>Dependency Injection + Testing: </strong>By using Protocols, it means that we can change the implementation of anything that conforms to UserServicing without any negative side effects. This means we can <strong>mock, stub and test </strong>our Protocol implementation using libraries such as <strong>Cuckoo.</strong></li><li><strong>Flexibility: </strong>If our provider for our User data changes, or anything else that causes our implementation within UserService to change, it doesn’t matter! The implementation within our ViewModel for our UserService will never have to change, providing the definitions within UserServicing remain the same.</li></ul><p>Before starting any implementation whatsoever, start with writing well commented and documented protocols. It will ensure focus, and help gain a better picture by allowing you to think through all the functional requirements beforehand.</p><p>In addition, It also allows developers new to projects, or people using your frameworks to get a quicker glimpse of how your code works, if it is broken down into Protocols in an organised manner.</p><p>Thank you for taking the time to read. If you have any questions or are interested in reading my other articles, feel free to get in touch with me on <a href="https://twitter.com/ctrounce94">Twitter</a> or <a href="https://www.linkedin.com/in/ctrounce">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d88c26ac9464" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REST easy with Swift Protocols]]></title>
            <link>https://medium.com/@cmtrounce/rest-easy-with-swift-protocols-d229f35b5b80?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/d229f35b5b80</guid>
            <category><![CDATA[promisekit]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[alamofire]]></category>
            <category><![CDATA[moya]]></category>
            <category><![CDATA[rest]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Thu, 15 Nov 2018 19:57:10 GMT</pubDate>
            <atom:updated>2022-06-05T13:07:59.741Z</atom:updated>
            <content:encoded><![CDATA[<h3>Network Requests with Swift Protocols</h3><h4>Say goodbye to messy requests</h4><p>Preface: This article covers some intermediate topics and makes use of some external libraries. If you’re brand new to Swift, I would recommend reading up on Protocols, Generics, the Codable Protocol, Alamofire (networking library) and <a href="https://medium.com/@ctrounce94/pod-review-promisekit-8b33c670a21">PromiseKit (see my article)</a>.</p><p><em>Now that that’s out of the way…</em></p><p>Does your app have to deal with some JSON server? <br>Do you have a single class in your project named JSONClient or APIManager? <br>Does it have a separate function for each JSON request causing lots of duplicate code?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06f41362e1d1ba61ee3143bd3151f68a/href">https://medium.com/media/06f41362e1d1ba61ee3143bd3151f68a/href</a></iframe><p>If you answered yes for any of the above, or your code looks a little bit like this, then keep reading! This article shows you how you can take the first step towards cutting your code down to a fraction of what it was by using protocols.</p><h4>Breaking it down</h4><p>So you want to make a network request? What do you need?<br>• The URL.<br>• The parameters and how they are encoded.<br>• The HTTP method.<br>• Any additional headers.</p><p>You can represent this with a single protocol.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0f42e896366f58f5b84ea78d58baca3/href">https://medium.com/media/d0f42e896366f58f5b84ea78d58baca3/href</a></iframe><p>Using our Target protocol, we can ensure that each network request will conform to the same requirements. By moving the responsibility of constructing the request away from our JSONClient to somewhere a little more suitable, we separate the responsibility, making our code a little more structured.</p><p>We can now write a function which only executes network requests if we use something which conforms to Target.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/68322c022cd49cb1532113d604bfb8d1/href">https://medium.com/media/68322c022cd49cb1532113d604bfb8d1/href</a></iframe><p>Now, our JSONClient doesn’t need anything more than this to cover most of our use cases. Much cleaner, <em>right?</em></p><h4>Let’s get building!</h4><p>Now that we have our Target protocol and our nice and clean JSONClient, we need to write something that conforms to it so that we can start making requests.</p><p>Let’s say we have a social media website. Each Post a user makes contains a title and a body. The app has to make a request when a user wants to upload a Post, which requires us to write something that conforms to Target.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09b014f56c7eb2a0c2b82b008fbd06a0/href">https://medium.com/media/09b014f56c7eb2a0c2b82b008fbd06a0/href</a></iframe><p>So here’s our request struct, it has our title and body. <br>Now we make it conform to Target:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d08e06bd26d0112c275c15047cda8a0/href">https://medium.com/media/1d08e06bd26d0112c275c15047cda8a0/href</a></iframe><p>So what can we see here? If we break it down, it’s quite simple; When initialized with our title and body and made to conform to Target, the UploadPostRequest struct provides us with everything we need to construct and send a JSON request.</p><p>The JSON response contains a success boolean value. Let’s make a Codable struct to help with decoding.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c6a1b6c52aa7c61c3193f570f9e02eb/href">https://medium.com/media/3c6a1b6c52aa7c61c3193f570f9e02eb/href</a></iframe><p>Now that everything is set up, we can now go ahead and write our PostService, which constructs our network call.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d53c602aefb2942d02431582ec0d4f0b/href">https://medium.com/media/d53c602aefb2942d02431582ec0d4f0b/href</a></iframe><p>By adding the Target protocol and making JSON request constructions more uniform, you have made your code cleaner, reduced chances of type-related errors, and separated responsibilities.</p><p>Now you can sleep easy, <strong>REST-assured</strong>.</p><p>Thank you for taking the time to read. If you found this article useful, insightful or would like to know how you can take it to the next level using enums, check out the Moya Cocoapod.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d229f35b5b80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why hybrid is not the future of mobile]]></title>
            <link>https://medium.com/@cmtrounce/why-hybrid-is-not-the-future-of-mobile-1642d759358a?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/1642d759358a</guid>
            <category><![CDATA[hybrid-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Tue, 30 Oct 2018 09:57:37 GMT</pubDate>
            <atom:updated>2018-10-30T09:57:37.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*txBGHbDQLib0PKPliQ_T_g.png" /></figure><h4>Choosing native is in the best interest of your business prospects.</h4><p>As an iOS developer, and as someone who has had experience in multiple client-facing roles, I have noticed that more and more people are becoming drawn to the hybrid solutions offered as an alternative to fully native.</p><p>The main selling points touted include reduced development and maintenance costs with a quicker delivery.</p><p>This article will explain how that this is just not the case and explore how going hybrid, instead of native, will harm the success of your app and increase costs.</p><h4>Always playing catch-up</h4><p>When going hybrid, your app will always remain months behind their native counterparts. Newer versions of Android and iOS are available, with that comes updated hardware, new features (e.g., Face ID, Apple Pay and Augmented Reality), and modernized design.</p><p>Google and Apple respectively will allow developers native access to the new features in advance of release. It takes considerable time for the hybrid community to react and adjust and as a result, is months behind when it comes to taking advantage of new features.</p><h4>Too many cooks</h4><blockquote>“Too many cooks spoil the broth.”</blockquote><p>The hybrid community is significantly divided. Every company thinks their hybrid solution can deliver the best results. You have React Native, Xamarin and Titanium to name a few, each with their development environment — which vary in quality.</p><p>Entirely new hybrid frameworks come out every couple of years, and existing ones become outdated, redundant and lose popularity (e.g., PhoneGap). A vast amount of money and time of development is spent on migrating old hybrid apps to solutions that support newer devices.</p><p>The native Android and iOS communities are much larger while being less fragmented and have the support of Google and Apple to maintain high quality.</p><h4>Tools</h4><p>The tools remain incredibly consistent. For example; Xcode, the primary IDE for iOS developers, has been around since 2003. It’s one of the most feature-rich, powerful developer tools where even the most senior developers are finding new ways to optimize their workflow.</p><p>In contrast, the native tools are extensively documented with a vast network of people available to assist, significantly reducing the time it takes to get an idea from conception to the app store.</p><p>Native Android and iOS apps are also more stable — with a more mature community comes more debugging tools, solutions to problems and ways to handle errors. Hybrid frameworks remain in infancy, causing code to be a lot more error-prone, damaging user experience and makes it more difficult to manage development time expectations.</p><h4>Never quite native</h4><p>The Android and iOS user base have a certain expectation of how they want their apps to look and to feel. From a user experience perspective, they are wildly different. Android follows <a href="https://material.io/">Google’s Material Design</a>, and iOS follow Apple’s<a href="https://developer.apple.com/design/human-interface-guidelines/ios/overview/themes/"> Human Interface Guidelines</a>.</p><p>Hybrid developers can try to mimic the behavior of a native app, at the expense of spending twice as much time, to satisfy the specific edge cases and scenarios. In turn, code gets messier and harder to maintain, and as a result, introducing new features further down the application lifecycle will be more difficult and more costly.</p><p>Hybrid apps take up a lot more space on phones. If you choose a hybrid solution, be prepared to rule out a substantial percentage of users, who run out of capacity on their phone or are reluctant to install too many large apps.</p><p>AirBnb states in <a href="https://medium.com/airbnb-engineering/react-native-at-airbnb-f95aa460be1c">their article</a> that factors such as this forced them to switch back to native after two years of working with React Native.</p><h4>To conclude</h4><p>The hybrid solution aims to please everyone, but it sacrifices what is most important: how the app looks, feels and behaves in the hands of a user, affecting the perceived performance and quality of the app.</p><p>Hybrid may consider themselves a viable ‘two birds, one stone’ solution. I, among many others, find that it takes too many compromises, alienates users while driving up time, development and maintenance costs above that of their native counterparts.</p><p>At DTT, our heavy focus on delivering high quality, native solutions means that our clients can get the best results, while costs and timeframes remain convenient and manageable.</p><p>Before going hybrid: consider what you’re compromising.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1642d759358a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pod Review: PromiseKit]]></title>
            <link>https://medium.com/@cmtrounce/pod-review-promisekit-8b33c670a21?source=rss-e8bfcd725b82------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b33c670a21</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[promisekit]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Callum Trounce]]></dc:creator>
            <pubDate>Sun, 28 Oct 2018 15:03:00 GMT</pubDate>
            <atom:updated>2018-10-29T08:40:27.529Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NHnNCDcWvPxfihd8jv_d7A.png" /><figcaption>Image courtesy of <a href="https://github.com/mxcl">mxcl</a> @ <a href="https://github.com/mxcl/PromiseKit">https://github.com/mxcl/PromiseKit</a></figcaption></figure><h3>Pod Review 👏 👏 : PromiseKit</h3><p>Today we kick off the series with a popular one — PromiseKit. Its Github repository sits at just over 10,000 stars at (the time of writing) with its first release being in early 2014. It’s fair to say it has its supporters.</p><p>It promises (<em>ha-ha</em>) to simplify asynchronous programming. This article will cover the more common usages and evaluate factors such as documentation, ease of use and how much of an impact it can have on your project, before giving a final verdict on whether PromiseKit <em>fulfils</em> its goal and if you should consider including it in your next app.</p><h4>A common problem: Callback Hell</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f54efba93355a1ad82803fb9f41b92e/href">https://medium.com/media/4f54efba93355a1ad82803fb9f41b92e/href</a></iframe><p>The example above shows only a few levels of nesting. Now imagine if we wanted to do more asynchronous operations after that — a recipe for disaster.</p><h4>The PromiseKit solution.</h4><p>Below is the un-refactored version.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe7a3e896a1552a8992f973c5ac16bb0/href">https://medium.com/media/fe7a3e896a1552a8992f973c5ac16bb0/href</a></iframe><p>Instead of using escaping closures in the function, we return promises. Promises will either fulfill with the required result or throw an error, which is caught in a separate closure. The seal within the Promise is in charge of handling the success and failure cases. You can call fulfill, reject or resolve on the seal.</p><p>You might think at first: ‘well this looks like a lot more code, and it looks quite complicated.’ It is true that PromiseKit does have a learning curve, but once you get used to using it, you’ll discover that the example above can be refactored into something that looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/912168bec0b4b95ea1fbdda2641e64ec/href">https://medium.com/media/912168bec0b4b95ea1fbdda2641e64ec/href</a></iframe><p>Above uses the firstly keyword and the then function (both supplied by PromiseKit) to allow for easy chaining of Promises. The need for a seal here is eliminated here and we can clean up some of the excessive nesting.</p><p>or you can go even further and refactor it into this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab3d28d0d52def1232c06345ea765879/href">https://medium.com/media/ab3d28d0d52def1232c06345ea765879/href</a></iframe><p>You can see that the readability of the code has improved drastically when compared to the closure nightmare.</p><p>The example above only scratches the surface of what PromiseKit is capable of, but after working with it for a few months, you’ll discover how much it will clean up your code, decrease debugging time and make your solution more adaptable.</p><p>In PromiseKit, a lot is going on under the hood, so you get some things for free:<br>• Function chaining: no more nesting, escape callback hell and chain promises to your hearts content!<br>• Error propagation: Handle all your errors an organized way. PromiseKit will warn you if something isn’t.<br>• Generics: Using the power of generics and compiler inference, you can reduce code, and write complex tasks cleanly. <br>• Threading: You can control what thread a promise executes and completes on. <br>• Memory Management: PromiseKit handles a lot of the memory itself, so it reduces the need for capturing weak self.</p><h4>Why not PromiseKit?</h4><p>PromiseKit does have some caveats, though:</p><p>Promises can only be fulfilled once, so they can’t be ‘reactive’ like escaping closures. If you want to use PromiseKit, it is your best bet to integrate it throughout the entire project. If you’re already well into the development phase of your app, or you are working with some other data binding library, PromiseKit might not be for you.</p><p>It also requires some existing Swift knowledge; If you are an absolute beginner, I would recommend looking at the standard way Swift handles asynchronicity, in addition to the basics of generics before moving on to a Pod such as PromiseKit.</p><p>The <a href="https://github.com/mxcl/PromiseKit">documentation</a> is thorough with examples. The Pod receives regular updates, with detailed migration guides included. PromiseKit works with Objective C and Swift. <a href="https://github.com/mxcl/PromiseKit">You can find the repository here</a>.</p><h4>Verdict: Gamechanger</h4><p>If your app has a lot of asynchronous logic and you have no organized, uniform solution to handle results and propegate errors, or you’re just sick of writing escaping closures, then I would strongly recommend PromiseKit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b33c670a21" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>