<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Nuno Alexandre</title>
    <description>Builder of software, product focused, designer wannabe</description>
    <link>https://nunoalexandre.com/</link>
    <atom:link href="https://nunoalexandre.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Mon, 06 Apr 2020 17:20:54 +0000</pubDate>
    <lastBuildDate>Mon, 06 Apr 2020 17:20:54 +0000</lastBuildDate>
    <generator>Jekyll v3.8.5</generator>
    
      <item>
        <title>Crack the System</title>
        <description>&lt;p&gt;Looking back at the interviews I went through in the past, hoping to get an idea of why I haven’t &lt;em&gt;yet&lt;/em&gt; been rejected, as well as after running a few interviews myself, there are a couple of factors that stand out that surely helped to make it happen. The easy answer would be that I was overqualified for all the jobs I applied to but that couldn’t be further from the truth.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: The best way to crack any interview is to… not. That’s just the wrong approach. Stop right there. Don’t go on trying to crack the system.&lt;/p&gt;

&lt;p&gt;Interviews should be bidirectional and are an invaluable opportunity to assess whether spending most of your awake time working on a common goal with &lt;em&gt;this&lt;/em&gt; specific group of people is the next best way to invest your time and energy.&lt;/p&gt;

&lt;p&gt;Let’s dive into some of the factors that I often see being neglected when it comes to job applications.&lt;/p&gt;

&lt;h3 id=&quot;alignment&quot;&gt;Alignment&lt;/h3&gt;

&lt;p&gt;Alignment comes in many forms and shapes: culture, ambition, personality, standards, vision, etc. You might be in a phase of your career where a specific tech is your focus and life. All you want is to spend your day tackling issues that are given to you and produce fine work. However, the company might be more inclined to someone who can combine and balance that with a more product-oriented mindset. None of the sides is at fault, you are simply misaligned. Assess what the company’s needs, current stage, and employees are to figure out whether your circumstances meet.&lt;/p&gt;

&lt;h3 id=&quot;genuine-enthusiasm&quot;&gt;Genuine enthusiasm&lt;/h3&gt;

&lt;p&gt;Why are you applying to this specific company? “Hi, I am John Doe and I am the world’s leading expert in XYZ, with thousands of years of experience, I know a hundred programming languages, there’s nothing I can’t do, I am the perfect candidate”. While these might all be true, you have forgotten half the equation. What is this group of people doing that excites you in such a way that makes you eager to want to work alongside them? If you don’t have an answer, then reconsider applying in the first place. If you do have an answer, bring it out and share that enthusiasm.&lt;/p&gt;

&lt;h3 id=&quot;skills-and-skills&quot;&gt;Skills and skills&lt;/h3&gt;

&lt;p&gt;The cultural alignment might be on point, you might not imagine being more enthusiast than you are right now, but if you don’t have the skills, that’s probably not going to work. It’s not just about the skills you have already acquired, however. Being a voracious learner is one of the best skills you can have, which will likely compensate for some pieces of knowledge or experience that you don’t yet have. So don’t either think you got it because you check all the points neither that you already lost it because you missed one. Don’t misjudge the importance of soft-skills either. It’s not just about writing the best code, it’s also about the way you communicate, the way you listen to and approach your colleagues, whether you give or take energy, etc.&lt;/p&gt;

&lt;h3 id=&quot;be-true&quot;&gt;Be true&lt;/h3&gt;

&lt;p&gt;One of the worst outcomes of an interview would be to be hired because of the wrong impression you passed. If you are to be hired, aim to be because of who you are as a whole. The things you have to learn, the eagerness to do so, the awesome skills you bring onboard, your introversion, whatever it is. Now, don’t go too far, of course. Just don’t keep yourself behind an ultra-professional persona that seems anything but human neither go on ranting about some former experience. Let others see a glimpse of your best self and thus allow them to make a fair judgment and decision.&lt;/p&gt;
</description>
        <pubDate>Mon, 03 Feb 2020 00:00:00 +0000</pubDate>
        <link>https://nunoalexandre.com/2020/02/03/crack-the-system</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2020/02/03/crack-the-system</guid>
        
        
        <category>jobs</category>
        
        <category>interviews</category>
        
        <category>applications</category>
        
        <category>hiring</category>
        
      </item>
    
      <item>
        <title>The New Kidiyo Menu</title>
        <description>&lt;p&gt;The original design of the Kidiyo app, released in July 2018, received several negative reviews on the stores and from direct user contact. Get to know what was wrong and how I and &lt;a href=&quot;https://raissacolonetti.com&quot;&gt;Raissa Colonetti&lt;/a&gt; got the new Kidiyo app released.&lt;/p&gt;

&lt;p&gt;It was unanimous at Kidiyo that our app was not good enough, and the users could tell us what was wrong. Long story short, the app required the users to take a handful of decisions before reaching the content. That’s too difficult for kids and the costs of a mistake (making the wrong choice at one of the steps) was too expensive. At a technical level, it was also not scalable, as each decision was implemented in a separate screen. That meant that adding new content required new decisions, i.e., new screens, which required a new version of the app to be released, which required long un unpredictable waiting review times from Apple.&lt;/p&gt;

&lt;p&gt;I knew what I thought best for Kidiyo and its users. A menu and design a la Netflix/youtube, totally configurable from the backend, playful, easy, discoverable. And so I came out with the initial concept.&lt;/p&gt;

&lt;h3 id=&quot;concept-0&quot;&gt;Concept #0&lt;/h3&gt;

&lt;p&gt;This first concept made the selected player a central point of the screen at the start. The feed of items offered a row of filters based on the type of content: all, videos, music, ebooks, games, etc.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;medium centered&quot; src=&quot;/images/kidiyo-menu-0.jpeg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;It was a good start to trigger the team and get us going. The next steps were to pitch it, create a usable prototype, learn and improve.&lt;/p&gt;

&lt;h3 id=&quot;the-pitch&quot;&gt;The Pitch&lt;/h3&gt;

&lt;iframe src=&quot;//www.slideshare.net/slideshow/embed_code/key/c4Yncm3Gtey24L&quot; width=&quot;100%&quot; style=&quot;height: 55vh&quot; frameborder=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; scrolling=&quot;no&quot; allowfullscreen=&quot;&quot;&gt; 
&lt;/iframe&gt;

&lt;p&gt;This presentation was followed by this demo video where the core concept is shown and explained.&lt;/p&gt;

&lt;iframe width=&quot;100%&quot; style=&quot;height: 55vh&quot; src=&quot;https://www.youtube.com/embed/JQ2rhVh4KUc&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; 
  autoplay; 
  encrypted-media; 
  gyroscope; 
  picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;
 &lt;/iframe&gt;

&lt;p&gt;The pitch was a success. However, the pedagogy advisory board had some critical comments on this new design. Mainly, they missed the idea of a character-based “world”, which is studied to be rather important for kids’ content.&lt;/p&gt;

&lt;h3 id=&quot;user-testing&quot;&gt;User testing&lt;/h3&gt;

&lt;p&gt;After some adjustments, we went ahead and organized a user testing day in our office. Some parents signed in and we had both the parents and the kids going through the prototype. We made questions, took notes, observed, learned.&lt;/p&gt;

&lt;p&gt;The overall feedback was excellent. Parents and kids loved the new concept and about all requirements were achieved.&lt;/p&gt;

&lt;p&gt;We had built a prototype, now we measured so that we could learn. We now had green lights to implement and deliver value to our users!&lt;/p&gt;

&lt;h3 id=&quot;kidiyo-v200-&quot;&gt;Kidiyo v2.0.0 🎉&lt;/h3&gt;

&lt;p&gt;At first, we always referred to this project as &lt;em&gt;The New Kidiyo Menu&lt;/em&gt; when it fact it was more than just that.&lt;/p&gt;

&lt;p&gt;I refactored the majority of both the iOS and Android apps to make this new version possible. All the thumbnails were redesigned and made consistent by &lt;a href=&quot;https://raissacolonetti.com&quot;&gt;Raissa&lt;/a&gt;. To make the menu configurable from the backend, I designed a simple DSL (Domain Specific Language) that is parsed and interpreted by the apps to generate the desired menu.&lt;/p&gt;

&lt;p&gt;In the end, we found the result to be beautiful and exciting as shown below.&lt;/p&gt;

&lt;iframe width=&quot;100%&quot; style=&quot;height: 55vh&quot; src=&quot;https://www.youtube.com/embed/VKU1IHyBtKk&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; 
  autoplay; 
  encrypted-media; 
  gyroscope; 
  picture-in-picture&quot; allowfullscreen=&quot;&quot;&gt;
 &lt;/iframe&gt;

&lt;div class=&quot;screenshots&quot;&gt;
  &lt;img class=&quot;column&quot; src=&quot;/images/kidiyo-screenshots/1.png&quot; /&gt;
  &lt;img class=&quot;column&quot; src=&quot;/images/kidiyo-screenshots/2.png&quot; /&gt;
  &lt;img class=&quot;column&quot; src=&quot;/images/kidiyo-screenshots/3.png&quot; /&gt;
  &lt;img class=&quot;column&quot; src=&quot;/images/kidiyo-screenshots/4.png&quot; /&gt;
  &lt;img class=&quot;column&quot; src=&quot;/images/kidiyo-screenshots/5.png&quot; /&gt;
  &lt;img class=&quot;column&quot; src=&quot;/images/kidiyo-screenshots/6.png&quot; /&gt;
  &lt;img class=&quot;column&quot; src=&quot;/images/kidiyo-screenshots/7.png&quot; /&gt;
  &lt;img class=&quot;column&quot; src=&quot;/images/kidiyo-screenshots/8.png&quot; /&gt;
&lt;/div&gt;

&lt;h4 id=&quot;credits&quot;&gt;Credits&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Concept developed by&lt;/strong&gt;: &lt;a href=&quot;https://nunoalexandre.com&quot;&gt;Nuno Alexandre&lt;/a&gt; &lt;br /&gt;
&lt;strong&gt;Implemented and designed by&lt;/strong&gt;: &lt;a href=&quot;https://nunoalexandre.com&quot;&gt;Nuno Alexandre&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://raissacolonetti.com&quot;&gt;Raissa Colonetti&lt;/a&gt;&lt;br /&gt;
&lt;strong&gt;Company&lt;/strong&gt;: &lt;a href=&quot;https://kidiyo.com&quot;&gt;Kidiyo&lt;/a&gt;, All Rights Reserved.&lt;br /&gt;&lt;/p&gt;
</description>
        <pubDate>Wed, 30 Oct 2019 10:02:00 +0000</pubDate>
        <link>https://nunoalexandre.com/2019/10/30/the-new-kidiyo-menu</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2019/10/30/the-new-kidiyo-menu</guid>
        
        
        <category>design</category>
        
        <category>pitch</category>
        
        <category>concept</category>
        
        <category>ux</category>
        
        <category>ui</category>
        
        <category>dsl</category>
        
        <category>portfolio</category>
        
      </item>
    
      <item>
        <title>A small step</title>
        <description>&lt;p&gt;Breaking those long lines of code into smaller, grouped ones, with a clear consistency on where different types of elements are placed, is a small and efficient step towards improved readability.&lt;/p&gt;

&lt;h3 id=&quot;before&quot;&gt;Before&lt;/h3&gt;

&lt;p&gt;Consider the code example below. There are &lt;strong&gt;two calls&lt;/strong&gt;, &lt;strong&gt;five arguments&lt;/strong&gt;, and &lt;strong&gt;three levels&lt;/strong&gt; of nesting. However, that’s not what we get from the looks of it. We need to spend time visually parsing it and group the parts in different categories, not to mention that scrolling is required to even read the whole thing.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/70e73375596decf14e3934c9c373ebe6.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Note the form of this code, leaving the actual code aside. No clue, whatsoever.
&lt;img src=&quot;/images/small-step-before.png&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;from-now-on&quot;&gt;From now on&lt;/h3&gt;

&lt;p&gt;We want to clearly see, without knowing the code, what is:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A function call&lt;/li&gt;
  &lt;li&gt;A function’s arguments&lt;/li&gt;
  &lt;li&gt;Part of what&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For that, we need to separate calls from arguments by placing the arguments in a new, indented line:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/8fda4bf645434b81fa09f9fc24448f95.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;Where now the form of this code says it all, whatever the actual code is:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/small-step-after.png&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;concrete-advantages&quot;&gt;Concrete advantages&lt;/h3&gt;

&lt;p&gt;The advantages are not just structural, visual, or subjective . Note that now the addition, removal, or modification of a function argument will be shown in a separate git diff line, instead of ending up with a single git diff line that mixes up all of the different changes made to your project.&lt;/p&gt;
</description>
        <pubDate>Wed, 17 Jul 2019 09:46:00 +0000</pubDate>
        <link>https://nunoalexandre.com/2019/07/17/a-small-step</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2019/07/17/a-small-step</guid>
        
        
        <category>readability</category>
        
        <category>code</category>
        
        <category>bikeshedding</category>
        
      </item>
    
      <item>
        <title>Announcing Stork</title>
        <description>&lt;p&gt;&lt;em&gt;Delivering types from JSON like a Stork&lt;/em&gt; is the tagline of my most recent pet project, &lt;a href=&quot;https://github.com/NunoAlexandre/stork&quot;&gt;Stork&lt;/a&gt;.
Stork is a lightweight library written in Swift 4.2 focused on making the flight from JSON to Types as smooth as possible. 
Stork believes in simplicity, explicitness, and control.&lt;/p&gt;

&lt;p&gt;Based on functional programming principles and mildly inspired in Aeson, Stork is the middle sweet between JSON parsers such as Argo - full-fledged but requiring extra dependencies, learning too many operators, and too functional for some - and other parsers that require your types to be mutable, to throw on init, or that take the control away from you by making too many assumptions.&lt;/p&gt;

&lt;h4 id=&quot;links&quot;&gt;Links&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/NunoAlexandre/Stork&quot; target=&quot;_blank&quot;&gt;Stork on Github&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#how-it-works&quot;&gt;How it works&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#considerations&quot;&gt;Considerations&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#why&quot;&gt;Why&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;how-it-works&quot;&gt;How it works&lt;/h2&gt;

&lt;p&gt;To go from JSON to types, all you need to do is to state what fields you want to parse. Stork infers their type and parses them for you. To make that possible, your types must follow the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FromJson&lt;/code&gt; protocol.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;protocol&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;FromJson&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;JsonValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;Self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In practice, this means that for a type to be parseable from JSON, it needs to provide a way of being constructed from a &lt;a href=&quot;https://github.com/NunoAlexandre/stork/blob/master/Stork/Stork/Source/JsonValue.swift&quot;&gt;JsonValue&lt;/a&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;string&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;number&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bool&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JSON&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[String: Any]&lt;/code&gt;, or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[JsonValue]&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;api&quot;&gt;API&lt;/h3&gt;

&lt;p&gt;Suppose you have a type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt; already complying to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FromJson&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can get Stork to parse you a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt; or an array of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt;s as follows:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// Single User&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;maybeUser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;userJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Array of User's&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;jsonArray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;usersJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;operators&quot;&gt;Operators&lt;/h3&gt;

&lt;p&gt;Stork provides only 4 infix operators to extract and parse a value from a JSON object:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;k&quot;&gt;infix&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;operator&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;// Maybe get a scalar or custom type&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;infix&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;operator&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.!&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;// Same as .? but expects the value to be present&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;infix&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;operator&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// Maybe get an array of scalar or custom types&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;infix&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;operator&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;..!&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;// Same as ..? but expects the array to be present&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;All of these operators share the same arguments: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(json: JSON, key: String)&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;in-action&quot;&gt;In Action&lt;/h3&gt;

&lt;p&gt;Say that we want to parse &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt;s from some JSON input, where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt; and its nested types are defined as follows:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/43644efec05ddf2061299eeac55ca9e1.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;With Stork, to go from JSON to this model all we need to do is to have these types complying to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FromJson&lt;/code&gt; protocol.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/05515eff0524a7ec98669df118880dbb.js&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;considerations&quot;&gt;Considerations&lt;/h2&gt;

&lt;p&gt;Note that failing to extract a required field or failing to parse it to the desired, inferred type, causes Stork to internally fail with an exception, which gets translated into an &lt;em&gt;Optional&lt;/em&gt; for you. That might be inconvenient as it gives you no clue as to what field caused Stork to fail to parse.&lt;/p&gt;

&lt;p&gt;As I started using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Stork&lt;/code&gt; in my own production projects at &lt;a href=&quot;https://itunes.apple.com/us/app/kidiyo-spelen-leren/id1296241552?mt=8&quot; target=&quot;_blank&quot;&gt;Kidiyo&lt;/a&gt;, my workaround this current behaviour is to write unit/integration tests that verify all the requirements and specifications for all edge cases. As long as the schema - and its variants - of the JSON at hand is well-defined, this should not set you back.&lt;/p&gt;

&lt;h2 id=&quot;why&quot;&gt;Why&lt;/h2&gt;

&lt;p&gt;First and foremost, I needed to be able to parse nested types and having worked with proper and well-designed JSON parsers such as &lt;a href=&quot;http://hackage.haskell.org/package/aeson&quot;&gt;Aeson&lt;/a&gt;, this sad approach was a no-go to me:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;k&quot;&gt;guard&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jsonArray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;title&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as?&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Therefore, I looked into Swift JSON parsers that seemed to get some attention from the iOS community, such as Argo, Gloss, Unbox, and a few others.
Argo was clearly - and admittedly - inspired in Aeson (a good thing), but required extra dependencies (a bad thing), so I left it for later as I wanted to see what the other two had to offer. So I tried to make my types parseable using Gloss and Unbox, and I wasn’t happy with the experience. Far from me to be cynical about those projects, but the reality is that I felt impotent using those two libraries. More specifically, the issues I found were:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;a transversal assumption that you always only want to build a type from a JSON object and not from a string, number, boolean or array of values;&lt;/li&gt;
  &lt;li&gt;a transversal assumption that RawRepresentable Enum’s must be a direct map from my their JSON counterpart;&lt;/li&gt;
  &lt;li&gt;no compile-time guarantees that a (nested) type is parseable, i.e., that it complies to the required protocol to make it so.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, I thought it was fun to write my own parser and see what kind of problems I would face myself. Although Stork is somewhat similar to Argo in design, I intentionally decided not to check how Argo worked, neither externally nor internally, until I had reached &lt;a href=&quot;https://github.com/NunoAlexandre/stork/commit/d58f9bc980ad7905fd5ecbd63748835a7823a9c5&quot;&gt;Stork’s first working version&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Inspired in Aeson, my idea with Stork was to speak to the community that it targets, where currying and a bazillion of functional operators is &lt;em&gt;not&lt;/em&gt; common language.&lt;/p&gt;

&lt;p&gt;Finally, I named it &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Stork&lt;/code&gt; as that was my daughter’s first toy and because I liked the metaphor of having a stork delivering types to those expecting it.&lt;/p&gt;

</description>
        <pubDate>Mon, 25 Mar 2019 18:46:00 +0000</pubDate>
        <link>https://nunoalexandre.com/2019/03/25/announcing-stork</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2019/03/25/announcing-stork</guid>
        
        
        <category>parsing</category>
        
        <category>json</category>
        
        <category>swift</category>
        
        <category>github</category>
        
        <category>open-source</category>
        
      </item>
    
      <item>
        <title>Promise me</title>
        <description>&lt;p&gt;Refactoring is perhaps the most underappreciated task in software development. For me,
it can be great fun and joyful to transform inedible code into an elegant &amp;amp; maintainable code.
In this blog post, I quickly share a small part of a significant refactoring I just completed, and how moving from callbacks to promises helped design a declarative and composable download pipeline.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclaimer: This blog post is &lt;strong&gt;not&lt;/strong&gt; promoting Promises per se. For what it’s worth,
I share &lt;a href=&quot;https://www.reddit.com/r/haskell/comments/sijsg/what_is_the_haskell_equivalent_to_javascript/c4eclqx?utm_source=share&amp;amp;utm_medium=web2x&quot;&gt;this opinion&lt;/a&gt; on the matter.&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The Problem&lt;/h2&gt;

&lt;p&gt;The project in question here is the Kidiyo iOS app. Kidiyo believes in introducing
digital media to young children through constructive, funny, and healthy content.
Therefore, we stand to be the one-in-all platform with all sorts of different items, such as games, videos, ebooks, and offscreen connections.&lt;/p&gt;

&lt;p&gt;Being a platform means that the items we provide must be made available and improved dynamically, without the need for new app releases. Currently, those items are downloaded to be played, except for streamable videos and music.&lt;/p&gt;

&lt;p&gt;In the new version of Kidiyo, soon to be released, I had three requirements for
the downloads:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The download pipeline should be declarative so that a non-techie can quickly grasp what it does&lt;/li&gt;
  &lt;li&gt;Downloading items from different sources should be abstracted and unified&lt;/li&gt;
  &lt;li&gt;The app should be able to pick up on an ongoing download after submitting it&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This post focused mostly on the first requirement, followed by the second. The third is
subject to a new post.&lt;/p&gt;

&lt;h3 id=&quot;starting-point&quot;&gt;Starting point&lt;/h3&gt;

&lt;p&gt;The app supported downloading items from two different sources.&lt;/p&gt;

&lt;p&gt;The snippet below is an exact copy of one of the methods responsible for downloading items from one of the sources, in this case from Firebase. The method responsible for downloading items from the other source was remarkably identical in structure, differing in details on how those items were unpacked and stored locally.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/85a0b73410fdb44e776bc6a5ea58042b.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;There are many things wrong here:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;It’s imperative&lt;/li&gt;
  &lt;li&gt;It’s a big callback hell&lt;/li&gt;
  &lt;li&gt;It’s not composable nor sanely extendable&lt;/li&gt;
  &lt;li&gt;It has something like 9 levels of nesting&lt;/li&gt;
  &lt;li&gt;It’s a dump of responsibilities from different levels of abstraction&lt;/li&gt;
  &lt;li&gt;The success and the error flows are far away, therefore harder to visualise&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;refactoring&quot;&gt;Refactoring&lt;/h3&gt;

&lt;p&gt;Functional principles to the rescue. The way was to break down all the different
sub-tasks taking place all together into separate, self-sufficient units that always
returned either a &lt;em&gt;token&lt;/em&gt; for a next step or an Error. Very similar to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Either&lt;/code&gt;,
but with the requirement to be run &lt;em&gt;async&lt;/em&gt;. That way, I could design the download
pipeline declaratively, where each part of the chain can be put it an out effortlessly.&lt;/p&gt;

&lt;p&gt;The result is the following:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/a85f3200a78b2e95919c730a507d0e1c.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I use the &lt;a href=&quot;https://github.com/freshOS/then&quot;&gt;freshOS/then&lt;/a&gt; Promises Library for Swift with Async/Await.&lt;/p&gt;
</description>
        <pubDate>Sat, 23 Mar 2019 19:11:39 +0000</pubDate>
        <link>https://nunoalexandre.com/2019/03/23/promise-me</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2019/03/23/promise-me</guid>
        
        
        <category>swift</category>
        
        <category>clean-code</category>
        
        <category>composability</category>
        
        <category>refactoring</category>
        
        <category>promises</category>
        
        <category>callbacks</category>
        
      </item>
    
      <item>
        <title>A Year on Tour</title>
        <description>&lt;p&gt;Another great year right about to end. A year of significant transitions. 365 days of steady growth and good things to remember.&lt;/p&gt;

&lt;h3 id=&quot;becoming-a-father&quot;&gt;Becoming a father&lt;/h3&gt;

&lt;p&gt;Words can’t really describe what it is to be a father. It puts &lt;em&gt;everything&lt;/em&gt; into perspective. Countless nights of lousy sleep paid by the purest smile in the morning, the insane love challenge called diapers, and seeing this little human being acquiring new and more sophisticated features by the day it’s just an unbelievable journey.&lt;/p&gt;

&lt;p&gt;The way kids learn is an excellent space for developers to explore. Their capacity to humbly observe, retain and persevere through failures it’s insane. Seeing how they take on bigger and bigger challenges by the week, it’s really inspiring and reminds me to stay foolish and hungry.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/babyandme.jpg&quot; /&gt;&lt;br /&gt;
&lt;small&gt;Baby and me enjoying a beautiful sunset in Southern Portugal&lt;/small&gt;&lt;/p&gt;

&lt;h3 id=&quot;leaving-channable&quot;&gt;Leaving Channable&lt;/h3&gt;

&lt;p&gt;A few months into being a father, a startup building a platform with games and other content for kids from 2 to 6 contacting me to become their Lead Developer was a hard one to take.&lt;/p&gt;

&lt;p&gt;At Channable, I found the rare and priceless chance to use Haskell at work and being part of a Product-based company. I keep hearing people saying that my eyes sparkle when I talk about Channable, and that’s no surprise to me. I was part of an outstanding team of engineers who shared the same high standards and eagerness to learn, an environment for thick and accelerated learning. A place where hype and flashy new &lt;del&gt;cool&lt;/del&gt; stuff are not a constant distraction from things that actually matter.&lt;/p&gt;

&lt;p&gt;I could write a whole book on this. Working with such outstanding people is an experience I hope never to forget. Working next to the best leaves no room to be less. Working on super challenging and exciting problems at work is a remarkable privilege, more rewarding than any money. Being surrounded by excellence the way I did is a place I wish everyone to get into. A place where your convictions are questioned, your approaches are reviewed, and your standards and focus are lifted.&lt;/p&gt;

&lt;p&gt;It was not just roses, though. At times, I felt incredibly overwhelmed. For real. And not being able to get out of that spiral was one of the most painful experiences I went through in my career. Learning to deal with it and come out of it stronger, one of the best personal lessons ever taken. Having the best wife in the world, a great leader and great colleagues made it all so much better!&lt;/p&gt;

&lt;p&gt;Channable will definitely forever be in my mind and heart. Thanks for this great ride!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/channableinfrateam.jpeg&quot; /&gt;&lt;br /&gt;
&lt;small&gt;Me and my (Infrastructure) Team at Channable&lt;/small&gt;&lt;/p&gt;

&lt;h3 id=&quot;joining-kidiyo&quot;&gt;Joining Kidiyo&lt;/h3&gt;

&lt;p&gt;In the midst of hunting monads during the day and diapers during the night,  Kidiyo found me and proposed to me becoming their Lead Developer.&lt;/p&gt;

&lt;p&gt;Kidiyo aims to be a platform with responsible, fun and educative content for kids from 2 to 6 years old.&lt;/p&gt;

&lt;p&gt;In July, this new adventure started! So much has happened since then that it’s hard to believe that it’s been only five months. Setting code reviews, a bug tracker, sprints, a proper git convention, leveraging the standards and get everyone motivated to do the best work they have been a great mix. Migrating the development of the apps and games from outsourcing to in-house development was one of the primary goals of the company and the first to be achieved. Having refactored about 30% of almost two years of outsourced development turned out to be a surprisingly good learning experience. Having so much to do and no time to lose revealed to be a great antidote against my tendency to &lt;a href=&quot;https://www.freebsd.org/doc/en/articles/mailing-list-faq/bikeshed.html&quot;&gt;bikeshed&lt;/a&gt;, as well as my anxiety to start writing.&lt;/p&gt;

&lt;p&gt;Creating an outstanding workplace and product is much harder than being part of one. Having an extensive contribution to that objective is energising but equally challenging. Your focus needs to be sharper than a knife while keeping the ability to not close doors too early than could make you survive and thrive.&lt;/p&gt;

&lt;p&gt;At Kidiyo, I found a broad and rich challenge, as well as an equally diverse and eager team which I am very much looking forward to keeping fighting alongside next year to make Kidiyo a remarkable product for kids and families all over the world.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/kidiyoteam.jpg&quot; /&gt;&lt;br /&gt;
&lt;small&gt;One of the many daily pictures at Kidiyo with just a part of the team!&lt;/small&gt;&lt;/p&gt;

&lt;h3 id=&quot;other-highlights&quot;&gt;Other highlights&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;My first world-wide open source contribution, &lt;a href=&quot;https://nunoalexandre.com/2018/02/04/redesigning-haskell-docs&quot;&gt;Redesigning Haskell Docs&lt;/a&gt; - started a year ago - was merged and went live in both the Hackage and Haddock projects. Getting your work out to such a big audience turned out to be a sweet learning experience. Thank you, everyone, for having got it going so constructively and helped to get it merged!&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=rI8tNMsozo0&amp;amp;t=93s&quot;&gt;“Simplicity Matters, By Rich Hickey”&lt;/a&gt; was probably the best talk I digested this year. It was a turning point for me, helping me to identify what is and what isn’t relevant and to measure good code and tech by objective heuristics rather than by impressions. Thanks, &lt;a href=&quot;https://ruudvanasseldonk.com/&quot;&gt;@Ruud&lt;/a&gt;!&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;A mind-blowing presentation by &lt;a href=&quot;https://github.com/fatho&quot;&gt;Fabian Thorand&lt;/a&gt; on (Haskell) Lenses. Thanks, champion!&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2019&quot;&gt;2019&lt;/h3&gt;

&lt;p&gt;In 2019, I hope to learn to keep my principles turned on even when under stress. I will be working on not getting my eagerness to deliver and impatience with delays on the way of quality.&lt;/p&gt;

&lt;p&gt;I will be finishing the Type-Driven Development with Idris, and I am interested in revisiting Prolog and Logic Programming in general.&lt;/p&gt;

&lt;p&gt;And, as always, I will be logging my journey along the way here :)&lt;/p&gt;

&lt;p&gt;For those with whom I worked with this year, a sincere &lt;em&gt;thank you&lt;/em&gt;! Let’s bring software development forward and improve our ways.&lt;/p&gt;
</description>
        <pubDate>Mon, 31 Dec 2018 15:29:39 +0000</pubDate>
        <link>https://nunoalexandre.com/2018/12/31/a-year-on-tour</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2018/12/31/a-year-on-tour</guid>
        
        
        <category>retrospective</category>
        
        <category>software</category>
        
        <category>channable</category>
        
        <category>kidiyo</category>
        
      </item>
    
      <item>
        <title>Heart-Shaped Box</title>
        <description>&lt;p&gt;At University, a professor enthusiastically told us that translating problems into programming models would be one of the coolest tasks we would have as developers. Unfortunately, modelling is most often done poorly. Types to the rescue!&lt;/p&gt;

&lt;h3 id=&quot;modeling&quot;&gt;Modeling&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/images/treeToHaskell.svg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Modelling is building the backbone of a world using a programming language. We give a body to a problem. We define a vocabulary and a shape to reason about that problem.
Modelling is, therefore, halfway into solving a problem. After all, we need a ball to score a goal.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In a sense, programming (pure functional programming, in particular) is about transforming data from one form to another. Types allow us to describe the form of that data, and the more precise we make these descriptions, the more guidance the language can give in implementing transformations on that data.
&lt;br /&gt;&lt;br /&gt;&lt;small&gt;&lt;strong&gt;Type-driven Development with Idris by Edwin Brady&lt;/strong&gt;&lt;/small&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What ways do we have to define those &lt;em&gt;descriptions&lt;/em&gt;?&lt;/p&gt;

&lt;h3 id=&quot;using-procedures&quot;&gt;Using Procedures&lt;/h3&gt;

&lt;p&gt;Modelling a problem using procedures really means not modelling at all.
However, this approach appears to be a practice amongst mobile developers.&lt;/p&gt;

&lt;p&gt;A model helps to reason about the problem and to build the path to solve it.
Doing that procedurally means the goal is achieved solely via procedures. In such an approach, there is not a concrete nor explicit definition of the problem. The result is sufficient.&lt;/p&gt;

&lt;h4 id=&quot;modeling-a-slideshow&quot;&gt;Modeling a slideshow&lt;/h4&gt;

&lt;p&gt;Say we want to build a slideshow. A &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Slideshow&lt;/code&gt; is a list of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Slide&lt;/code&gt;’s, and each
slide contains a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;title&lt;/code&gt;, a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;description&lt;/code&gt;, and an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;image&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Because we want to display the slideshow in a GUI, each slide should have a UI representation, where the layout and the visual properties of its fields are defined.&lt;/p&gt;

&lt;p&gt;The following is a procedural way to “model” this problem.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/c36d7241e3b45d65d36a966aaa7ab893.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;To build a Slideshow, we’d then do:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/b9d2213a3e177e5dcba44e01a6eae1fd.js&quot;&gt;&lt;/script&gt;

&lt;h5 id=&quot;problems&quot;&gt;Problems&lt;/h5&gt;

&lt;p&gt;There a couple of problems with this approach:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;there is no overview on what a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Slide&lt;/code&gt; is&lt;/li&gt;
  &lt;li&gt;we are mixing shape and content&lt;/li&gt;
  &lt;li&gt;it’s tedious and error-prone to add, edit or reorder a slide, as each of its parts are spread&lt;/li&gt;
  &lt;li&gt;it’s impossible to create a slideshow dynamically&lt;/li&gt;
  &lt;li&gt;no flexibility due to missing dependency-injection&lt;/li&gt;
  &lt;li&gt;easy to have &lt;strong&gt;x&lt;/strong&gt; titles, &lt;strong&gt;y&lt;/strong&gt; descriptions, and &lt;strong&gt;z&lt;/strong&gt; images and get away with it&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;using-types&quot;&gt;Using Types&lt;/h3&gt;

&lt;p&gt;By using types, we solve all the problems we have in the procedural approach without trading off any advantage:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/a1fe8e3bb291cec028de81e4bd21c025.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;To create this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Slideshow&lt;/code&gt;, we do:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/482adc37420b713b32bb665f3565dffc.js&quot;&gt;&lt;/script&gt;

&lt;h5 id=&quot;advantages&quot;&gt;Advantages&lt;/h5&gt;

&lt;ul&gt;
  &lt;li&gt;precise definition and overview of what a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Slide&lt;/code&gt; &lt;em&gt;is&lt;/em&gt; and what each one &lt;em&gt;contains&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;easy to add, edit, and reorder&lt;/li&gt;
  &lt;li&gt;a slideshow can now be built with data from any source, at compile or runtime&lt;/li&gt;
  &lt;li&gt;clear separation between shape and content, and between the concept and its UI representation&lt;/li&gt;
  &lt;li&gt;the compiler ensures each slide is correctly defined&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Sun, 23 Dec 2018 09:45:39 +0000</pubDate>
        <link>https://nunoalexandre.com/2018/12/23/heart-shaped-box</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2018/12/23/heart-shaped-box</guid>
        
        
        <category>software</category>
        
        <category>modelling</category>
        
        <category>types</category>
        
        <category>haskell</category>
        
        <category>swift</category>
        
      </item>
    
      <item>
        <title>On Estimating</title>
        <description>&lt;p&gt;Since I have become the Lead Developer at Kidiyo, estimating has become an exciting and critical challenge. It’s no longer about getting the right number but about getting the best out of everyone and get it done as efficiently and predictably as possible.&lt;/p&gt;

&lt;p&gt;Estimating a piece of work is tough. Various factors taint our ability to provide an honest and thought-through estimation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Peer pressure&lt;/strong&gt; &lt;br /&gt;
If you give the highest estimation, you are not good, fast or experienced enough. If, on the other hand,  you estimate less than the others, it’s because you have no idea of how complex that piece of work, i.e, you are the optimistic ignorant. Or you are just the ultimate speed ninja that puts everyone to shame.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ego&lt;/strong&gt;&lt;br /&gt;
Our natural need to be important triggers in us the will to defy the impossible. We want to be that guy who finished before time and who got that hairy bug fixed in a blink of an eye.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Intimidation&lt;/strong&gt; &lt;br /&gt;
Having a high figure demanding a feature in half of the reasonable time it would take to get it (well) done, never made room for better estimations. Despite it being your responsibility to negotiate that deadline at the light of your perspective and experience, it still affects you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The (bad) habit of working extra time&lt;/strong&gt;&lt;br /&gt;
Getting things done after hours is, unfortunately, a common practice. Not only does it exhaust you and makes you less productive when you are most expected to, working extra time taints how you see the actual difference between your original estimation and the true effort and time spent.&lt;/p&gt;

&lt;h2 id=&quot;why-it-matters&quot;&gt;Why it matters&lt;/h2&gt;

&lt;p&gt;Identifying and realising the factors that affect our ability to estimate well is great, but understanding why estimating matters in the first place is fundamental.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trust&lt;/strong&gt;&lt;br /&gt;
As pointed out above, estimating involves personal matters. Growing in such a way where you can provide a professional estimation, despite all it takes, will make you earn the trust and respect from your peers, your followers, and your leaders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Self-improvement&lt;/strong&gt;&lt;br /&gt;
Have you ever had a colleague that said “oh, that takes 3 hours, at most”, that ended up spending a few days on it? Judgments apart, no one wants to be that guy. You want to be able to say “alright, I see this taking 7 hours” and see that occurring. You want to be aware of the reality of the work you have at hand, as well as your shortcomings. By doing so, you can start learning how to overcome them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Planning&lt;/strong&gt;&lt;br /&gt;
We work in teams, and teams need to plan. To plan, you need to trust one another to know how much you can handle and complete. The better the estimations, the less unnecessary stress and quality loss you will experience.&lt;/p&gt;

&lt;h2 id=&quot;how-i-do-it&quot;&gt;How I do it&lt;/h2&gt;

&lt;p&gt;The way I estimate work and make sure I deliver it, depends on what is the scale I am dealing with. Whether we are talking about a single issue, a day, a sprint or a quarter, this is how I go about getting a better estimation.&lt;/p&gt;

&lt;h4 id=&quot;for-a-day&quot;&gt;For a day&lt;/h4&gt;
&lt;p&gt;To better perceive the effort some piece of work takes, I allocate every single unit of work in my calendar. It turns out to be the simplest and quickest way to get a more realistic view of the feasibility of my estimations. Treating time as a resource is the key here, and we often forgot to do that.&lt;/p&gt;

&lt;h4 id=&quot;for-a-sprint&quot;&gt;For a sprint&lt;/h4&gt;

&lt;p&gt;When estimating how much you or your team can get done in a sprint, as a rule of thumb, experiment with doubling each original estimation. If it’s way off the available hours the whole team can put up with, you know it’s time to decrease the workload. Doubling or even tripling an estimation has proven to be precise, so if you’ve got to start there, you know it’s an excellent place to start.&lt;/p&gt;

&lt;h4 id=&quot;for-a-quarter&quot;&gt;For a quarter&lt;/h4&gt;

&lt;p&gt;For more extended periods of time, a technic I use to avoid underestimating is to only consider 4 to 5 hours of work available to work a day. It is far from being sensible. Meetings, tiredness, casual talking, coffee breaks, etc., all take a considerable amount of our time every day. Spending around 4 hours a day in deep work mode is a luxury for most of us.&lt;/p&gt;

&lt;h2 id=&quot;in-sum&quot;&gt;In sum&lt;/h2&gt;

&lt;p&gt;Serve your team before yourself. Putting the business in jeopardy to try to look like a champion is nonsense. Embrace introspection and improve on what keeps you from living out to the thoughtful estimations you give. At last, keep in mind that over/early delivering is better than under/late delivering.&lt;/p&gt;
</description>
        <pubDate>Sun, 18 Nov 2018 17:45:39 +0000</pubDate>
        <link>https://nunoalexandre.com/2018/11/18/on-estimating</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2018/11/18/on-estimating</guid>
        
        
        <category>human-factors</category>
        
        <category>software</category>
        
        <category>teams</category>
        
        <category>planning</category>
        
      </item>
    
      <item>
        <title>Forcing an orientation in iOS</title>
        <description>&lt;p&gt;Now back to mobile development (next to a million other things) at &lt;a href=&quot;kidiyo.com&quot;&gt;Kidiyo&lt;/a&gt;,
I was underwhelmed with the lack of support from the iOS SDK to force different
landscapes across an app. In this blog I share a neat solution that works (at
least) from iOS 9.0 onward.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;TL;DR&lt;/em&gt;: Get &lt;a href=&quot;https://gist.github.com/NunoAlexandre/a0cd5af9a5c1ea1933baf8a3c6b426f0&quot;&gt;my Orientation extension&lt;/a&gt;
and check &lt;a href=&quot;#bringing-it-all-together&quot;&gt;how to use it&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Most SO answers suggest to override &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;preferredInterfaceOrientationForPresentation&lt;/code&gt;,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;supportedInterfaceOrientations&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shouldAutorotate&lt;/code&gt;. These can be defined
on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIViewController&lt;/code&gt;s and on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UINavigationController&lt;/code&gt;s.&lt;/p&gt;

&lt;p&gt;I’d expect to be able to get it working out of the box by simply overriding
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;preferredInterfaceOrientationForPresentation&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;supportedInterfaceOrientations&lt;/code&gt;
on my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIViewController&lt;/code&gt;s and then having &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UINavigationController&lt;/code&gt; exposing those
values from the visible view controller.&lt;/p&gt;

&lt;p&gt;That setup was insufficient.&lt;/p&gt;

&lt;h3 id=&quot;the-problem&quot;&gt;The problem&lt;/h3&gt;

&lt;p&gt;Let’s look at the following scenario.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/rotation-scenario.svg&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A screen &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; &lt;em&gt;supports&lt;/em&gt; all orientations but &lt;em&gt;prefers&lt;/em&gt; portrait&lt;/li&gt;
  &lt;li&gt;A screen &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt; only supports landscape&lt;/li&gt;
  &lt;li&gt;A user can go from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt; and back&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Setting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;’s supported orientations to landscape did not force that screen
to be shown in landscape if I’d come from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; in portrait mode. Instead, I was
kept in portrait in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt; until I rotated to landscape. From then on I no longer
could rotate back to portrait, as intended from the beginning.&lt;/p&gt;

&lt;p&gt;Clearly, the SDK didn’t take the lead on forcing the orientation despite being
aware what the current view controller supports.&lt;/p&gt;

&lt;p&gt;The way to force rotate a screen is by setting the device “orientation” value:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kt&quot;&gt;UIDevice&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;current&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;UIInterfaceOrientation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                          &lt;span class=&quot;nv&quot;&gt;forKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;orientation&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Forcing rotation is easy, but there are a few caveats to cover.&lt;/p&gt;

&lt;h3 id=&quot;caveats&quot;&gt;Caveats&lt;/h3&gt;

&lt;p&gt;Note that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;preferredInterfaceOrientationForPresentation&lt;/code&gt; is of type
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIInterfaceOrientation&lt;/code&gt; and that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;supportedInterfaceOrientations&lt;/code&gt; is of type
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIInterfaceOrientationMask&lt;/code&gt;. The second defines the allowed range, while the
first indicates which one, within that range, is the preferred.&lt;/p&gt;

&lt;p&gt;Having this in mind, it is now clear that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;preferredInterfaceOrientationForPresentation&lt;/code&gt;
is the value to use when forcing rotation.&lt;/p&gt;

&lt;p&gt;It would seem like a good idea to always force the orientation to be what the
visible &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIViewController&lt;/code&gt; defined &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;preferredInterfaceOrientationForPresentation&lt;/code&gt; to be.&lt;/p&gt;

&lt;p&gt;This approach works when moving from a screen with a broader set of supported orientations
than the screen we are moving to. For instance, when moving from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt; in the
scenario above.&lt;/p&gt;

&lt;p&gt;Such approach taints the user experience. When at the screen &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;, the user holds
the device in landscape mode. By going back to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt;,  the screen
gets rotated to portrait, even though &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; supports landscape.&lt;/p&gt;

&lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;

&lt;p&gt;The solution, then, is to force rotation only when the screen we are moving to does
not support the orientation we are in already.&lt;/p&gt;

&lt;p&gt;Unfortunately, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIInterfaceOrientationMask&lt;/code&gt; is an enum and not a list, so we can’t just
check if it contains a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIInterfaceOrientation&lt;/code&gt;, and it doesn’t provide any function
to do this out of the box either.&lt;/p&gt;

&lt;p&gt;Therefore, we need to extend it:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIInterfaceOrientationMask&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;supports&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orientation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIInterfaceOrientation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;orientation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isLandscape&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;landscape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;orientation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isPortrait&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;contains&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;portrait&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;misses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;orientation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIInterfaceOrientation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;supports&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;orientation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now, when moving to a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UIViewController&lt;/code&gt;, we can check if the current
orientation supports its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;preferredInterfaceOrientationForPresentation&lt;/code&gt;. If it
doesn’t, we have to rotate to that preferred orientation:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UINavigationController&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;adjustOrientationIfNeeded&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;supportedInterfaceOrientations&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;misses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;currentOrientation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
     &lt;span class=&quot;kt&quot;&gt;UIDevice&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;current&lt;/span&gt;
       &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;preferredInterfaceOrientationForPresentation&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                 &lt;span class=&quot;nv&quot;&gt;forKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;orientation&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;bringing-it-all-together&quot;&gt;Bringing it all together&lt;/h3&gt;

&lt;p&gt;Now we have everything to have it working like a charm:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The View Controllers define both their preferred and supported and orientations.
You can define this in a base class instead of having to define it in every single view controller.&lt;/li&gt;
  &lt;li&gt;The capacity to decide when to the screen needs to be rotated&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last step is to have your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UINavigationController&lt;/code&gt; implementing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;willShow&lt;/code&gt;
method from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UINavigationControllerDelegate&lt;/code&gt; calling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adjustOrientationIfNeeded&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-swift&quot; data-lang=&quot;swift&quot;&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;YourNavigationController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UINavigationControllerDelegate&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;navigationController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;navigationController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UINavigationController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                            &lt;span class=&quot;n&quot;&gt;willShow&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;viewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UIViewController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                            &lt;span class=&quot;nv&quot;&gt;animated&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;adjustOrientationIfNeeded&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Et voilá! You can checkout my whole &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Orientation&lt;/code&gt; extension and get done in no time:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/NunoAlexandre/a0cd5af9a5c1ea1933baf8a3c6b426f0.js&quot;&gt;&lt;/script&gt;

</description>
        <pubDate>Fri, 24 Aug 2018 17:36:39 +0000</pubDate>
        <link>https://nunoalexandre.com/2018/08/24/forcing-an-orientation-in-ios</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2018/08/24/forcing-an-orientation-in-ios</guid>
        
        
        <category>ios</category>
        
        <category>orientation</category>
        
        <category>ux</category>
        
        <category>swift</category>
        
      </item>
    
      <item>
        <title>The importance of setting a path</title>
        <description>&lt;p&gt;Despite modern opinions, thinking that having no plan and merely living by the day is equivalent to freedom is a dangerous fallacy to hold on to. Freer is the man who chooses to walk from east to west than the man who happens to. Freer is the developer who takes the lead on their own journey than the one who is carried around like a bottle in the ocean.&lt;/p&gt;

&lt;p&gt;I am a big fan of the philosophical topic “Positive vs Negative Freedom”. The Stanford Encyclopedia of Philosophy describes it as:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Negative liberty is the absence of obstacles, barriers or constraints. One has the negative freedom to the extent that actions are available to one in this negative sense. Positive liberty is the possibility of acting — or the fact of acting — in such a way as to take control of one’s life and realise one’s fundamental purposes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Put in other words, being a free developer is not about finding the &lt;em&gt;perfect&lt;/em&gt; job and have no difficulties to face whatsoever. It is, instead, about developing such a character that allows one to set and pursue a path while dealing with and getting enriched by external obstacles.&lt;/p&gt;

&lt;h3 id=&quot;why&quot;&gt;Why&lt;/h3&gt;

&lt;p&gt;The question is fair: why should I set and pursue such a path? Why not just follow whatever pops as interesting?&lt;/p&gt;

&lt;p&gt;In case you don’t care much about your career, you probably think it’s pointless to keep reading. I’d say this is especially important for you.&lt;/p&gt;

&lt;h3 id=&quot;1-track-progress&quot;&gt;1. Track progress&lt;/h3&gt;

&lt;p&gt;Imagine a sprint without a goal, or even without any overall set of essential tasks to be done in the next two or three weeks. How can one judge the progress and success of such sprint? One can’t.&lt;/p&gt;

&lt;p&gt;By having a set of concrete milestones you want to pass through, you will be able to look back at your year and judge how far you got.&lt;/p&gt;

&lt;p&gt;You can also see it from another angle. Having such a plan will allow you to identify periods of regression or of flat failure.&lt;/p&gt;

&lt;p&gt;Being able to track your failures or regressions is not a minor thing. You will start to see which roads are dead-ends or bottlenecks for you and you will learn incredible amounts about yourself and your limitations. It opens the door for improvement, for polishing yourself or maybe even your plan, something that would hardly happen if you have no set path at all.&lt;/p&gt;

&lt;h3 id=&quot;2-focus&quot;&gt;2. Focus&lt;/h3&gt;

&lt;p&gt;When you define your path, a set of values and interests will emerge, either implicitly or explicitly. These are the backbone of how you see and want to look at yourself progressing through the years as a professional.&lt;/p&gt;

&lt;p&gt;By committing to them, you will be equipped with a sort of moral compass that will guide you through times of distraction and temptation. For instance, once you define the goal of becoming a Haskell developer, then &lt;em&gt;those&lt;/em&gt; Linkedin messages offering you a job using the latest new shiny JS flavour or working with the same old Java for more money are nothing more than distractions of a superfluous nature.&lt;/p&gt;

&lt;p&gt;You will be able to say &lt;strong&gt;no&lt;/strong&gt; because you now know what it is that you want and value and what is not. Moreover, when you find yourself in a dead end, you will have the capacity to judge alternative paths that you have predicated without losing it all and sell your soul.&lt;/p&gt;

&lt;h3 id=&quot;3-self-control&quot;&gt;3. Self-control&lt;/h3&gt;

&lt;p&gt;Something I never understood was seeing developers willing being assets of recruiting companies. Literally, you are a like a rentable hammer used where, when and by whom it happens to be. You go where they tell you to go. You sell your soul and make yourself deprived of control over the journey you take.&lt;/p&gt;

&lt;p&gt;Lack of control is agreed to be one of the most significant causes of stress in one life and career. Being complacent about it is giving away not just your job but potentially your health as well.&lt;/p&gt;

&lt;p&gt;I don’t mean to sound judgy, and I definitely don’t think that’s my position. In many other industries, complying with such a structure of recruitment companies is almost necessary if you want to at least have a job that provides with enough money to pay for your rent. That is not the case in our industry, though.&lt;/p&gt;

&lt;p&gt;Having a plan will grant you a purposeful attitude and view about yourself and your journey ahead, which will make you respect and value yourself and the decisions you have to make. Having someone else (or the mere chance) doing it for you becomes naturally unacceptable.&lt;/p&gt;

&lt;h2 id=&quot;setting-a-path&quot;&gt;Setting a path&lt;/h2&gt;

&lt;p&gt;When I was at university, I knew there were a couple of things I absolutely wanted to work on. It was something like the following list:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Develop a mobile app&lt;/li&gt;
  &lt;li&gt;Develop a web app&lt;/li&gt;
  &lt;li&gt;Work on distributed systems&lt;/li&gt;
  &lt;li&gt;Have an active role in the design of the software I’d be building&lt;/li&gt;
  &lt;li&gt;Find a meaningful job&lt;/li&gt;
  &lt;li&gt;Seek a healthy work-life balance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You see that this simple plan was somewhat broad, but it set boundaries and implied some principles and values:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I wanted to try different sectors of software development&lt;/li&gt;
  &lt;li&gt;I didn’t want to be stuck in one place and within one technology&lt;/li&gt;
  &lt;li&gt;Find a good environment and meaningful projects was more important than finding the most ~boring~ well paying job&lt;/li&gt;
  &lt;li&gt;I would not work for companies with a vision and mission I didn’t identify myself with&lt;/li&gt;
  &lt;li&gt;I wanted to learn more about the high-level side of software developing and have space to have influence&lt;/li&gt;
  &lt;li&gt;Meaningful work was vital to me. Just sit in front of a screen from 9 to 5 wouldn’t do it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By the time I set this path, I had been doing web design for a while as a side job. I knew I wanted and needed more.&lt;/p&gt;

&lt;p&gt;When I became an actual professional software developer, I quickly started ticking my list.&lt;/p&gt;

&lt;p&gt;My very first professional project in The Netherlands was the &lt;a href=&quot;https://itunes.apple.com/nl/app/nieuwspoort/id498033973?mt=8&quot;&gt;Nieuwspoort app&lt;/a&gt;, followed by several web applications. After a few years of working on web development - using several technologies but mostly Java - I had to revise my path. I would either dive in to either React/Angular/you name it or follow what seemed to be a much better long-term investment. Learn functional programming in Haskell. Also, I knew that soon enough I wanted to stop doing Java cold-turkey for at least a year.&lt;/p&gt;

&lt;p&gt;When I committed to start learning Haskell, I remember explaining to my wife that it was not about finding a job using it but about pushing me out of a comfortable zone and expand my brain.&lt;/p&gt;

&lt;p&gt;During that period I received several job offers that promised a much shorter term and big reward. Having set a path was fundamental to not let myself fall into that trap.&lt;/p&gt;

&lt;p&gt;One year and a half later I was becoming a &lt;a href=&quot;/2017/07/13/happy-Haskell-developer&quot;&gt;happy Haskell developer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I define and tune the path I set for myself based on what I find to be fundamentally interesting, challenging and aligned with my values. Sometimes I learn that I was wrong about some of those conclusions, but that as well is an advantage of this approach.&lt;/p&gt;

&lt;p&gt;A final tip I leave is to not share your path with many people. Doing so will give you the wrong feeling that you had taken concrete steps to achieve it when you actually didn’t. Watch &lt;a href=&quot;https://www.youtube.com/watch?v=mKdm5xSZiOA&quot;&gt;Why You Shouldn’t Tell People About Your Goals&lt;/a&gt; for more on this topic.&lt;/p&gt;

&lt;p&gt;Take control, endure through tricky times, don’t be afraid of asking, and enjoy your journey!&lt;/p&gt;

&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/Dap3GM6-luU?start=10&quot; frameborder=&quot;0&quot; allow=&quot;autoplay; encrypted-media&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
</description>
        <pubDate>Sat, 14 Jul 2018 19:26:39 +0000</pubDate>
        <link>https://nunoalexandre.com/2018/07/14/the-importance-of-setting-a-path</link>
        <guid isPermaLink="true">https://nunoalexandre.com/2018/07/14/the-importance-of-setting-a-path</guid>
        
        
        <category>career</category>
        
        <category>values</category>
        
        <category>life</category>
        
        <category>purpose</category>
        
      </item>
    
  </channel>
</rss>
