<?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 Alex Pinhasov on Medium]]></title>
        <description><![CDATA[Stories by Alex Pinhasov on Medium]]></description>
        <link>https://medium.com/@alexpinhasov?source=rss-473c27980804------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H7ykmSZbSLJ2YzHNFPG49Q.jpeg</url>
            <title>Stories by Alex Pinhasov on Medium</title>
            <link>https://medium.com/@alexpinhasov?source=rss-473c27980804------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:01:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexpinhasov/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[✓ Powerful Automations — Part ❷— Automated Smart Calendar For Teams]]></title>
            <link>https://alexpinhasov.medium.com/powerful-automations-part-%E2%9D%B7-automated-smart-calendar-for-teams-c33fe95a1ce3?source=rss-473c27980804------2</link>
            <guid isPermaLink="false">https://medium.com/p/c33fe95a1ce3</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[scrum]]></category>
            <dc:creator><![CDATA[Alex Pinhasov]]></dc:creator>
            <pubDate>Thu, 22 Apr 2021 12:24:14 GMT</pubDate>
            <atom:updated>2021-06-14T08:31:23.733Z</atom:updated>
            <content:encoded><![CDATA[<h3>✓ Powerful Automations — Part ❷— Automated Smart Calendar For Teams</h3><h4>between (JIRA, Github, Slack, G-Calendar) and how it effects you development process</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/0*wPO143taK7kN5hcF.png" /></figure><ul><li><a href="https://alexpinhasov.medium.com/powerful-automations-part-%E2%9D%B6-daily-report-27d3a6dff664"><strong>Part ❶</strong></a> Automated Daily Reports</li></ul><h3>2. 💬👤 Slack &amp; Google Calendar For Teams</h3><p>Working in an agile team means the development process is flexible with short but meaningful sprints, so the best thing you can and should do is to <strong>know what is your team work capacity</strong> without wasting time asking or worse manually scanning calendars.</p><p>What I needed is one place or a <strong>platform to gather all the team constraints</strong>, one that can send you notifications for any change, one that <strong>all of us use everyday most of the day </strong>and most importantly<strong> automated!</strong><br>And I found it.</p><p>When <strong>combining Google calendar for teams with Slack web-hook</strong> you get a <strong>powerful combination</strong> of:<br>✏︎ Who is Out Of Office (OOO, or any other string combination).<br>✏︎ What holidays are today/this week (if you work with global teams).<br>✏︎ Team Daily schedule.<br>✏︎ Team Weekly schedule.<br>✏︎ Get notifications for event changes (Team related).</p><p>All of this <strong>helpful information </strong>is<strong> sent to your channel of choice </strong>using triggers. This Information is useful for each team member as well as you as a manager/team leader planing your week or next sprint, and its <strong>all automated</strong>. 🤯</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/0*q-SM8RSTpULPKtEe.png" /><figcaption>Today’s Schedule example</figcaption></figure><p>Lets get technical, to solve the <strong>“gather all the team constraints” </strong>task the first thing I had to do is to create a new calendar, from now on every team related meeting will add this calendar as a “guest” so <br>- Team related meetings ✅.</p><p>Next I found and imported gmail calendars for every country my team is from, giving my main calendar a source of holidays. Using a script I copied all the holidays from those calendars into my new team calendar<br>- Holidays in my calendar ✅.</p><p>And last thing is personal constraints such as vacation or general OOO events. using another script I copied all of those constraints with predefined template such us [“OOO”, “Vacation”,”Out Of Office”] and others to filter events.<br>- Team personal constraints ✅.</p><p>And this is what I have achieved, we can see holidays, OOO events and our team meetings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cmzNPsBEZs5JYXy-50wHkw.png" /></figure><p>Once the calendar part is done, next step is to output this information to a platform, and the one I choose is Slack, we all use it its very popular and works great. After installing the “Google Calendar For Teams” add-on I managed to connect the calendar to a dedicated squad channel thus completing my goal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*XYTgKP1PXI5qPu5EBfei9A.png" /></figure><h3>What did I do? And how can you do it</h3><p><em>1.<br></em>Create a calendar<em> </em>📆</p><blockquote><a href="https://support.google.com/calendar/answer/37095?hl=en"><em>https://support.google.com/calendar/answer/37095?hl=en</em></a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/0*Rsn1FqgbrnojPwqk.png" /></figure><p>2. <br>Add a script that runs once every day using an automated trigger event, which scans the team members calendar looking for “OOO” events and copies them to the squads shared calendar. The script searches for keywords such as “OOO” you can change that to whatever you convention is.</p><blockquote><em>- The script</em></blockquote><blockquote><a href="https://gist.github.com/AlexPinhasov/ccddf77ecc639e3852ecf254e538d57e"><em>https://gist.github.com/AlexPinhasov/ccddf77ecc639e3852ecf254e538d57e</em></a></blockquote><blockquote><em>- Where to place it</em></blockquote><blockquote><a href="https://script.google.com/home"><em>https://script.google.com/home</em></a><em> (New project)</em></blockquote><blockquote><em>- Open the script and follow the instruction on the first 10 lines.<br><br>- To add the daily trigger click at “My Triggers” (home) and set the following parameters (you must run the script at least for this step to work)</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*RZNazA0W4d13_HgLlaIBNQ.png" /></figure><p>3. <br>Add a holiday calendar for each member country, then use a script to copy all the holidays from that calendar to the shared one</p><blockquote><em>- Where to get holiday calendar for countries (Download and import into your organization calendar)</em></blockquote><blockquote><a href="https://www.calendarlabs.com/ical-calendar/"><em>https://www.calendarlabs.com/ical-calendar/</em></a></blockquote><blockquote><em>- The script</em></blockquote><blockquote><a href="https://gist.github.com/AlexPinhasov/605eef6f3ac7cc9201d48b1bdfbce685"><em>https://gist.github.com/AlexPinhasov/605eef6f3ac7cc9201d48b1bdfbce685</em></a></blockquote><blockquote><em>- Where to place it</em></blockquote><blockquote><a href="https://script.google.com/home"><em>https://script.google.com/home</em></a><em> (New project)</em></blockquote><blockquote><em>- Copy the ID’s of the new holiday calendars and place them in script</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*M4yZB28fgLgif7b_h_wqmQ.png" /><figcaption>Final look of the “Apps Script” after step 1 and 2</figcaption></figure><p>4. <br>To see the squads meetings make sure to invite this new calendar to the meetings you create, you can also auto-accept meeting as a calendar.</p><p>5. <br>Add “Google Calendar For Teams” to your slack</p><p><a href="https://slack.com/apps/A0F8149ED">Google Calendar for Team Events</a><br>Once connected, you will see this screen, click “Connect a Calendar…”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*7S7HjJxi5GftG7Pm.png" /></figure><p>Inside choose the shared calendar we have created in step 1, and if you have a group channel select it. A new set of options will present itself, choose when you want to send this information in the channel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*1HLA0JcC9OVt6vQodANvwg.png" /></figure><p>Since the calendar is a guest in the meetings every change to the event will be reflected in the slack channel as well! 😎</p><h3>✅ Thats it!</h3><p>If every thing is connected successfully you should start seeing this event information in you slack channel.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c33fe95a1ce3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[✓ Powerful Automations — Part ❶ — Daily Report]]></title>
            <link>https://alexpinhasov.medium.com/powerful-automations-part-%E2%9D%B6-daily-report-27d3a6dff664?source=rss-473c27980804------2</link>
            <guid isPermaLink="false">https://medium.com/p/27d3a6dff664</guid>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Alex Pinhasov]]></dc:creator>
            <pubDate>Thu, 15 Apr 2021 17:45:21 GMT</pubDate>
            <atom:updated>2021-04-22T12:34:05.843Z</atom:updated>
            <content:encoded><![CDATA[<h3>✓ Powerful Automations — Part ❶ — Daily Report</h3><h4>between (JIRA, Github, Slack, G-Calendar) a<em>nd how it effects you development process</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*e5Wrzc_RTIucPIGqTDSZoQ.png" /></figure><p>During my work as a Squad leader and a Scrum master I’v learned many powerful tips and tricks and how to improve our development process using automations and platform interrogations, follow this series to learn what I’v done and how you can do it yourself.</p><h3>1. ⏰🗒👤 Automated daily report</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*emgIXBM6CJMLu3pOkHOklw.png" /></figure><p>One of the biggest problems I faced is <strong>daily’s</strong>, specifically knowing whats being worked on every day and making sure the committed work is being done without blockers and on schedule.</p><p>The traditional way is scheduling a meetings not more than 15 min (obviously it take more than that) to circle trough the squad members and ask what they did yesterday and what they are going to work on today. <strong>The problem</strong> is that this conversation is <strong>not being documented</strong> and in retrospective stating why <strong>a feature/bug has been pushed to next sprint</strong> might be vague and not precise.</p><h4>What are the benefits</h4><ol><li>Documented daily work</li><li>Know the status of tickets worked on today “Done/Blocked/In Progress”</li><li>Allows more accurate retrospective report</li><li>Its automated! leaving more time to actually finish your tasks. this approche might not repalce meetings completly but its a step.</li></ol><p>JIRA is a powerful tool and we should utilize whats been given to us to serve us intelligently, specifically automations.</p><h4><strong>How does it work?</strong></h4><ol><li>A scheduled automation in JIRA runs every day at 5pm, gathering all the issues the team members of squad in that day.</li><li>A web hook between JIRA and Slack sends the information from JIRA to a dedicated channel of your choosing.</li></ol><p>Using this automation you will have full knowledge about whats being worked on today, a true source of truth, whats the agenda, what ticket has been done or started progress and many more bits of information aiming at successfully finishing the sprint with the committed tasks.</p><h4>How can you do it?</h4><ol><li>Make sure you have the proper JIRA permissions to add automations</li><li>In JIRA go to Settings-&gt;Projects-&gt;Find you project and click the 3 dots on the right-&gt;Project Settings-&gt;Automations on the left</li><li>Click on “Create Rule” (top right corner) and select “Scheduled” trigger</li><li>set the “Cron expression” to “<strong>0 0 15 ? * SUN-FRI</strong>” which means: Run every Sunday — Friday at 2pm (my timezone is +3 so i will get it at 6pm)</li><li>Add the “Lookup issues” step, use the queary “issuekey IN updatedBy(&lt;Name of jira user&gt;, “0d”)”</li><li>Click Save and add a new step called “Send Slack message” and create a Web hook following the instructions</li><li>Then add this text to parse the results to make sense</li></ol><p>👤 &lt;Member Name&gt; Worked on:</p><p>{{#lookupIssues}}<br> ~ 📣 [{{status.name}}] — {{summary}} -&gt; {{URL}} <br>{{/}}</p><p>to add more members to the report continue the rule again from step 5, the end result will look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*YOK2gsWjYvmswHWbYA4xlg.png" /></figure><h4>Click Save and publish rule, Thats it!</h4><p>This looks like a lot of work especially since this must be done for each user BUT once it&#39;s done no extra works is necessary.</p><p>Part ❷ — <a href="https://alexpinhasov.medium.com/powerful-automations-part-%E2%9D%B7-automated-smart-calendar-for-teams-c33fe95a1ce3">Automated Smart Calendar For Teams</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27d3a6dff664" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[✓ Step-up your localization management in Xcode using swift]]></title>
            <link>https://alexpinhasov.medium.com/step-up-your-localization-management-in-xcode-using-swift-32bba37840ee?source=rss-473c27980804------2</link>
            <guid isPermaLink="false">https://medium.com/p/32bba37840ee</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[swift-package-manager]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[script]]></category>
            <category><![CDATA[localization]]></category>
            <dc:creator><![CDATA[Alex Pinhasov]]></dc:creator>
            <pubDate>Thu, 10 Dec 2020 07:26:20 GMT</pubDate>
            <atom:updated>2020-12-30T08:34:40.960Z</atom:updated>
            <content:encoded><![CDATA[<h3>✓ Step-up Series — Localization management in Xcode using swift</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*xReXM2QIXGeu5uV1i2Yjbg.jpeg" /></figure><p>I can safely say most of the apps today use localization to support languages, this is welcomed and encouraged to make sure you reach the biggest audience you can.</p><p>Most of the times the localization files (a.k.a .strings) tent to get big very fast, and with size comes chaos represented as:</p><p><em>✖︎</em> <em>Keys are not sorted.</em></p><p><em>✖︎ You might have duplicate values for different keys</em></p><p><em>✖︎ You don&#39;t know which keys are being used.</em></p><p><em>✖︎ You don&#39;t know if the keys you use in your project actually exist in .strings file</em></p><p><em>✖︎ You dont know if all the localization files have matching keys to make sure your text is translated in all supported languages.</em></p><p><em>✖ You don’t know if the new keys entered use a convention you’re project follows.</em></p><p>The list can go on and on, but the point is Xcode doesn&#39;t help you manage it and honestly developers cant go and waste time finding all of those issues.</p><p>I had the same problem with my project at work, yes we are using SwiftLint and that’s a great framework, you can even add you own rules but it doesn&#39;t do everything I listed above, you might succeed in writing a few rules to cover some issues.</p><p><strong>But the problem I am trying to solve it the validation rules between the project files(.swift, .xib…) AND the localization files (.strings).</strong></p><p>So what were my guiding rules:</p><ol><li>Easy integration.</li><li>Simple, short, readable code written in swift.</li><li>Run on every build.</li><li>Use Swift package manager.</li><li>See the errors/warning in Xcode natively, point out what the issue and where.</li><li><strong>Customisable</strong></li></ol><p>I decided to create a new framework called “AutoLocalized” to solve that, I created an executable package using swift that runs on every build using Xcode build phases run script.</p><p>I am adding a link to the framework, check it out, I am always happy to get good/bad criticism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n4CVkvQOFFtZ_Dr50_e9dA.png" /></figure><p><a href="https://github.com/AlexPinhasov/AutoLocalized">AlexPinhasov/AutoLocalized</a></p><p>There are a lot of possibilities and ideas I want to add to the framework, but the core functionality works, and it works great! check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uF2BHyW_pBVlk-4v-gMFEA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32bba37840ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Feature toggle architecture]]></title>
            <link>https://alexpinhasov.medium.com/feature-toggle-architecture-fed98ad9d662?source=rss-473c27980804------2</link>
            <guid isPermaLink="false">https://medium.com/p/fed98ad9d662</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[oop-concepts]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Alex Pinhasov]]></dc:creator>
            <pubDate>Tue, 03 Dec 2019 19:11:48 GMT</pubDate>
            <atom:updated>2019-12-15T14:44:22.455Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using abstraction and polymorphism in Swift</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lklC5F7Xa8RohL5DEokdLw.png" /></figure><blockquote>A <strong>feature toggle</strong> is a technique that attempts to provide an alternative to maintaining multiple source code branches, such that a feature can be tested even before it is completed and ready for release as well as A/B testing. Feature toggle is used to hide, enable or disable the feature during run time.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*RQecjWopksz5rVaRihi47A.gif" /></figure><p>A few weeks ago my company decided to use Feature toggle to control features on production. As part of the iOS team I was tasked to integrate it, I did my homework and read some articles about the idea of it and common pitfalls as well as videos explaining the advantages and disadvantages of using it.</p><h4>And this is the summary of it :</h4><ol><li>Never reuse a toggle</li><li>Short lifespan</li><li>Name toggles well</li><li>Architecture matters</li></ol><p>Every one of these bullets is important and can have enough material to write a full article about, yet I want to focus on <strong>#4</strong> <strong>Architecture</strong>.</p><p>When we think about using feature toggle we must remember that as great as a feature this is we still need to maintain it and make sure both scenarios (false flow and true flow) are working seamlessly and most importantly independently from one another.</p><p>A quick example of how features toggles are used in the most simple way:</p><p>Let’s assume we have a <strong>CarFleet</strong> class that controls the company cars, inside we have 2 methods: <strong>moveCarsToPosition</strong> and <strong>refuel, </strong>both have dependency for the feature toggle status, this is how it looks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*U5uD9rZ0e5-B5FBx6Cw-aQ.gif" /></figure><p>What you see in this gif is that both functions representing the false and true flows of the toggle are part of the class regardless the toggle state, and we want to avoid that.</p><h4>Let’s break down what’s wrong here:</h4><ol><li>CarFleet <strong>doesn’t care</strong> <strong>how</strong> cars are being moved and what fuel is being used. The only thing it cares about is that the cars would get to the customer and be fuelled.</li><li>Using “if-else” everywhere will make your code less understandable and “pollute” the class.</li><li>We can assume that “Toggles.Vehicle.carsCanFly” toggle we’ll be used in more than 1 file/class, hopefully, the toggle will be removed and the code embedded in the source-code, at that point we want to quickly and safely delete every occurrence of the toggle, going inside each file and removing them is time-consuming and unnecessary.</li></ol><p>We should aim for abstracting the toggles completely from our code and break any dependency on them.</p><p>One way of abstracting is using Protocols (a.k.a Interfaces), let’s use POP (protocol-oriented programming) to achieve that goal.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b55ad20c6eafb04db940491f32f17ce/href">https://medium.com/media/1b55ad20c6eafb04db940491f32f17ce/href</a></iframe><p>When we combine protocols together with “where Self: <strong>x</strong>” we make sure only <strong>x</strong> has a default implementation, as well as access to all the public parameters and methods.</p><p>Make sure to properly document each computed variables and methods as shown in the example, this will ensure anyone after you know why this toggle is there and what each flow returns. This will ensure fewer mistakes and misunderstanding whether for future you or a developer after you.</p><p><strong>Remember your name is attached to the top of the file, what and how you write is your personal identification as a developer.</strong></p><h4>How does CarFleet look after the abstraction:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a81eb0a8b6d51825b0096e72de30fcc/href">https://medium.com/media/0a81eb0a8b6d51825b0096e72de30fcc/href</a></iframe><p>Simple, readable and understandable that’s how your code should look like especially when using toggles but not only.</p><p>More about readability:</p><p><a href="https://medium.com/ios-os-x-development/making-your-ios-application-easy-to-read-with-these-simple-steps-b63067900b72">Making your iOS application easy to read with these simple steps.</a></p><h4>Lets see a full flow diagram represented in code</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4xevyESY2Uf9aPXnlbTP0w.gif" /></figure><p>What are we seeing here?</p><ul><li><strong>CarFleet has no idea</strong> it is affected by a feature toggle — <strong>Abstraction</strong> ✅</li><li>We have a dedicated <strong>abstract class to handle everything related to feature toggle</strong> for CarFleet, plus all the “if-else”s are under one roof — <strong>Scalability</strong> ✅</li><li>We have <strong>2 files representing the Enabled logic and Disabled logic</strong> for this toggle, meaning all we need to do in order to delete the toggle is delete the file and follow the functions hierarchy until you get to the class (CarFleet) — <strong>Easy Toggle deletion</strong> ✅</li></ul><p>With these 3 bullets, you can rest assure that you have combined abstraction and polymorphism in your architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fed98ad9d662" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The art of eliminating when solving bugs.]]></title>
            <link>https://medium.com/ios-os-x-development/the-art-of-eliminating-when-solving-bugs-part-1-107af449207a?source=rss-473c27980804------2</link>
            <guid isPermaLink="false">https://medium.com/p/107af449207a</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[problem-solving]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Alex Pinhasov]]></dc:creator>
            <pubDate>Fri, 06 Jul 2018 08:55:28 GMT</pubDate>
            <atom:updated>2022-04-24T06:52:06.948Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*3jayOTSAEi3maaNPD5NPdw.png" /><figcaption>Image From: <a href="https://iqdoodle.com/solve-life-problems/">https://iqdoodle.com/solve-life-problems/</a> by <a href="https://iqdoodle.com/author/adam-sicinski/">Adam Sicinski</a></figcaption></figure><h4>An effective way of solving bugs in iOS developing.</h4><p>Bugs. Every software developer will have to face them sooner or later, some of them will be easy to solve others not so much, some might make you loose your mind others will make you feel like this industry was waiting only for you Sherlock. In some rare cases a portion of the app needs to be re-written just to overcome an unwanted bug.</p><p>If bugs are such a big thing than how come no one is teaching us how to solve them, or better how to face them? in most cases thats the developers code that <strong>behaves</strong> <strong>exactly</strong> <strong>as they wrote it</strong>, <strong>but not as they intend</strong>. One might think that the more experience you get the less bugs you&#39;re likely to write, but the truth is that the more experience you get the more complex your code gets thus finding the source of the bugs becomes a time consuming job.</p><p>I faced some nasty bugs, data racing, core data inconsistency, reference cycles, you name it. Sometimes the bug crashed my app and there wasn&#39;t even a stack trace and sometimes the app didn’t crash but something wasn’t working properly. I was on my own, playing guessing games , with no useable stack trace I couldn’t even google it.</p><h4>🤷🏻‍♂️ What do you do when:</h4><ul><li>There is no crash log, or lacking meaningful hints.</li><li>The bug is inconsistent.</li><li>The app does not crash but simply wont behave the way you wrote it.</li><li>Everything seems ok but nothing works.</li></ul><p><strong>The answer is simple:</strong> I put on my Sherlock Holmes goggles and start “Eliminating” possible suspects. Sometimes the best way to understand what causing a bug is to <strong>understand whats</strong> <strong>not causing it</strong>. What? 🤯</p><p>As the title says solving bugs is an art, some bugs are strait forward others require some thinking, not how to solve them but <strong>what causing them</strong>.</p><h4><strong>🤔 What skill will you achieve by the end of this article ?</strong></h4><p>Will you solve any possible bug? probably not, but thats not the point . Instead I’m going to <strong>“rewire” your brains concept of bugs</strong>, hopefully you will be able the identify the cause faster with these steps.</p><h3><strong>First step: </strong>Understand what you&#39;re dealing with.</h3><ul><li><strong>⛔️ Optional unwrapping failed.</strong></li><li><strong>⛔️ UI different then intended.</strong></li><li><strong>⛔️ Memory Issues.</strong></li><li><strong>⛔️ Data racing.</strong></li><li><strong>⛔️ etc…</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*watwINdor7HPhNm_yKm4AQ.png" /></figure><h3>Second Step: Understand what you do know vs what you don’t.</h3><p>Suppose we have a UI issue, we have a UILabel with some text that we want to show, for some reason the label isn’t shown when the app runs. I wont provide any context of how the view hierarchy is built, although the experienced developers might come up with the fix quickly I want focus on the way of solving, not the solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7w6oYPnse4mIraKFsohuA.png" /></figure><h3>Following the chart I provided:</h3><p>Ask your self questions about the situation, what can cause this type of behaviour, <strong>I wouldn&#39;t advice to start coding a solution right away</strong>, firstly understand why this is happening, once you figured it out located the root of the problem. Avoid using pointed patches even when time is tight in most cases bugs can be solved by a few simple changes.</p><p>Since this is a UI issue lets open our “View Hierarchy Debugger”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*QNw9rKiYqJYjvMqtrQZzhw.png" /><figcaption>View Hierarchy Debugger</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MvWfs3FDpf9UgfdasCw7Xg.png" /></figure><h4>🤨 What do we do know for sure?</h4><ol><li>The app does not crash <strong>therefore its probably not a broken @IBOutlet</strong>.</li><li>The view hierarchy shows the the label is not hidden, and the alpha set to 1.0, <strong>which means that it&#39;s not a game of hide and seek</strong>.</li><li>The label is part of the view hierarchies, <strong>which means the label was added properly to the view.</strong></li><li>The background colour did set and the text is correct, the label’s background is pink so no-one is assigning it clear by accident, same for the text its correct and coloured white. <strong>Which hints to us that no-one is messing with label properties, yet we cant see the label.</strong></li></ol><h4><strong>By this point we can assume it not a “UILabel” problem. Moving on.</strong></h4><p>5. The Label is a subview of “View” (the white view in the middle) How does this help us? What do we know about views?</p><ul><li>A view has a frame and bounds one represents its location in its parent view, the other its location relative to it self. Which hints to us that maybe the label position has exceeded the parent visible area. If the “Clip To Bounds” checkbox was selected then we wouldn’t see the label in our storyboard, but we do see it.</li><li>Views often have some sort of constraints, which hints to us that maybe this is a constraint issue.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QMWVvNO_j-CPYsUUE1gNJw.png" /></figure><p>When looking on our label’s “Frame” we can see that the label positioned correctly in the X axis but the Y axis is 150 extra from the parent Y point.</p><p>Next we see that one of the constraint causing it, “self.top = superview.top + 150 @ 1000”, obviously the constraint is causing the problem right? Yes…, but why cant we see the label?. Remember we don’t have context about this project we don&#39;t know why the developer chose the behaviour of <strong>assigning 150+superview.top might not be a bug but a request</strong>, the bug as we know it is that we can’t see the label at all.</p><h3>👩🏻‍💻 Third Step: Fix it or search it</h3><p>Views have a property named “clipToBounds” which means that everything beyond the view’s frame will be clipped and not visible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*veshHDuS2-aLxpB6P35-AQ.png" /></figure><p>The thing is if we see the label in our storyboard then we should see it when the app runs, make an assumption that someone is messing with this properties in the code,</p><p>If you are correct, locate the exact line and reason, make the necessary changes and VIOLA, problem solved. Otherwise, keep digging.</p><p>If you ever seen a “Sherlock Holmes” episode you know that even though he is a great detective and can solve any crime, <strong>he always needs someone to ask him questions</strong>, the better your questions the more likely you will solve the problem sooner then later, thats a promise.</p><p>It might sound like a sentence taken from an inspirational film, but I always say:</p><blockquote>“If your stuck your not asking the right questions” — Alex.P</blockquote><p>I would love to hear what you guys think about solving bugs and if this article changed the way you address bugs, even by a bit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=107af449207a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ios-os-x-development/the-art-of-eliminating-when-solving-bugs-part-1-107af449207a">The art of eliminating when solving bugs.</a> was originally published in <a href="https://medium.com/ios-os-x-development">iOS App Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fail-safe Algorithm for iOS DateFormatter]]></title>
            <link>https://medium.com/ios-os-x-development/fail-safe-algorithm-for-ios-dateformatter-b59a1f8ebe52?source=rss-473c27980804------2</link>
            <guid isPermaLink="false">https://medium.com/p/b59a1f8ebe52</guid>
            <category><![CDATA[parse]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[dateformatter]]></category>
            <dc:creator><![CDATA[Alex Pinhasov]]></dc:creator>
            <pubDate>Mon, 11 Jun 2018 13:14:52 GMT</pubDate>
            <atom:updated>2019-02-24T08:10:07.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*c2jriccwwDkcfk1nUGHlnA.jpeg" /><figcaption>(CC) by Dean Meyers</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f972c4ae4d721e05af15f684f238368/href">https://medium.com/media/2f972c4ae4d721e05af15f684f238368/href</a></iframe><p><strong>iOS applications</strong> in most cases use REST API to get and post data, we rely on the data we receive to show feedback UI to the user. In some cases we can continue without a property and give it a default value when we couldn’t parse the data, but in other cases the app can’t deliver it’s purpose without a property or an object expected to be given to us, what do we do then?</p><p>I would like to share with you an algorithm I wrote, it’s efficient, fast and simple, to make sure you could parse any date format given to you from a source other then the app.</p><p>If you are interested to see the code right away jump to end, if you’re curious to read how and why I wrote it, what are the benefits and what makes it efficient, then stay tuned.</p><h4><strong>Background story</strong></h4><p>A year ago I was working on a big project, the server side was developed and managed by a different company, we built the API and started developing the app. The app relied heavily on dates, all from post date to last sync date. We (server side and our team) agreed on a date format that will be used though out the app, we will send dates with this format and receive and parse to that format, and everything worked great.</p><p>Until one day during development the app behaved weird, and in rare cases crashed. After a few days and many phone calls we figured that the server for some reason sent us wrong date formats, since the app relied on dates, 89.5% of the app was unusable. Although the source of the problem was fixed in the server side, I had feeling that this kind of thing could happen again. Long story short, the fail safe algorithm was created to deal with this issues in the future.</p><h4><strong>What are the benefits?</strong></h4><ul><li>Covering most of the known date formats (you can add new ones).</li><li>Flexible and efficient = Faster phrasing.</li><li>Easy to read and understand.</li></ul><blockquote><strong>More on readability and its importance</strong>: <a href="https://medium.com/ios-os-x-development/making-your-ios-application-easy-to-read-with-these-simple-steps-b63067900b72">https://medium.com/ios-os-x-development/making-your-ios-application-easy-to-read-with-these-simple-steps-b63067900b72</a></blockquote><p><strong>DateFormatter is an expensive object</strong> and should be used with care, performance wise it should be shared in your app and not created on demand, every time you want to parse a given date from “String” to “Date” object you need to provide the correct date format otherwise it will fail.</p><h4><strong>What makes it </strong>efficient<strong>?</strong></h4><p>Our DateFormatter object needs a format to parse the date string to, if we previously found a match we will use it all the time hence saving time, if the given date string has a different format and we couldn’t parse it using the current selected format we locate a suitable format and use it. simple, easy and well understood.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f372518c08c99f16fb3b8635e6e7b9c6/href">https://medium.com/media/f372518c08c99f16fb3b8635e6e7b9c6/href</a></iframe><p>When we find a format suitable for parsing a given date we try and parse all dates using that format, only when we fail we try other formats until we hit the one that fits, once we found it we make it the default format.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/683ea7b09314d458e58dbb4a12d752b9/href">https://medium.com/media/683ea7b09314d458e58dbb4a12d752b9/href</a></iframe><h3>Full algorithm :</h3><p>Feel free to add new date formats if these cases are not covering what you need.</p><h4>How to use it ?</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f972c4ae4d721e05af15f684f238368/href">https://medium.com/media/2f972c4ae4d721e05af15f684f238368/href</a></iframe><h4>DateFormatter Extension:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/897ebd3d634e58b8fdb5007bce4968ac/href">https://medium.com/media/897ebd3d634e58b8fdb5007bce4968ac/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b59a1f8ebe52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ios-os-x-development/fail-safe-algorithm-for-ios-dateformatter-b59a1f8ebe52">Fail-safe Algorithm for iOS DateFormatter</a> was originally published in <a href="https://medium.com/ios-os-x-development">iOS App Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making your iOS application easy to read with these simple steps.]]></title>
            <link>https://medium.com/ios-os-x-development/making-your-ios-application-easy-to-read-with-these-simple-steps-b63067900b72?source=rss-473c27980804------2</link>
            <guid isPermaLink="false">https://medium.com/p/b63067900b72</guid>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[readability]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[programming-tips]]></category>
            <dc:creator><![CDATA[Alex Pinhasov]]></dc:creator>
            <pubDate>Sat, 07 Apr 2018 07:27:34 GMT</pubDate>
            <atom:updated>2018-06-11T13:13:19.367Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*HM_kG9mdiFs8cmhpvhjMrA.jpeg" /></figure><p>Good programmers are the ones who explain what they do in the most simple way they can. Even physicists explain wormholes with a piece of paper and a pencil pinned in it. What makes us different?.</p><p>I have always tried to write my code as simple and well read as I could, everything from picking the right name for a variable to using code conventions, but something was still missing, a way to understand the code without trying to understand the “how” I did it, but rather the outcome I was trying to achieve.</p><p>You might even say the ability to<em> </em><strong><em>read the code as a story</em></strong>, rather than a bunch of code.</p><p>Let’s address 3 main topics:</p><h3>The Problem</h3><p>Reading other programmers code can be a real struggle. Without providing the proper context one can simply find him self lost in finding the meaning of a function or a property.</p><h3>The Suggestion</h3><p>From 1’s and 0’s to low-level code to elite languages, it is noticeable that code syntax becomes more and more user-friendly, thus inviting new programmers to the developer’s universe. As the syntax becomes clearer to read in plain English so should our code be, simple,to the point and self-explaining.</p><h3>The Outcome</h3><p>A well writing code that masks itself as a story making it easy to read and understand (even without context).</p><h4>Naming functions</h4><p>How to do it the right way:</p><p>When we write function we assume that the person reading the function has enough context to understand what we were trying to achieve. Naming our function in a vage meaning “handleRedView()” will raise many questions about what does “RedView” stands for? what is the main goal of this function?.</p><p><em>It seems that in some cases</em> the <em>function purpose is vague and too complicated to understand without providing context.</em></p><p>We can separate our function proposes into 4 categories:</p><pre>1. Informer   functions<br>2. Management functions<br>3. Router     functions<br>4. Execution  functions</pre><h4>1. Informer function</h4><p>Usually triggers router/management functions.</p><p>function examples:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2f2a1a6d6ef33c5f408dfd67fec3b5a/href">https://medium.com/media/b2f2a1a6d6ef33c5f408dfd67fec3b5a/href</a></iframe><p>Call back function, inform that something did/will happen and gives you the option to react.</p><p>Mostly used as delegate trigged actions, or notification handling functions .</p><h4>2. Management function</h4><p>Used to unite multiple function to achieve 1 higher purpose without dependency, <strong>all the code inside the block will execute.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee0cddd448b51cfe389c5559ae3f5340/href">https://medium.com/media/ee0cddd448b51cfe389c5559ae3f5340/href</a></iframe><p>Reading this function we have all the information we need, execute this functions when the car has started, at this point we don’t care “how” its done rather the “what” it does.</p><h4>3. Router function</h4><p>Used to unite multiple functions to achieve 1 higher purpose <strong>with some sort of dependency</strong>,<strong> </strong>the<strong> </strong>code will execute only when intended to<strong>.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/033eb55c624508541ced9e32b3902bd6/href">https://medium.com/media/033eb55c624508541ced9e32b3902bd6/href</a></iframe><p>Router <strong>function</strong> mostly <strong>points</strong> to <strong>execution</strong> <strong>functions</strong> but in some cases can include logic itself only if the code won’t exceed 1 line.</p><h4>4. Execution function</h4><p>The <strong>implementation </strong>of the <strong>function</strong> <strong>name.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8330f7df27b955059e06f78bb3948991/href">https://medium.com/media/8330f7df27b955059e06f78bb3948991/href</a></iframe><p>The logic itself could potently be complicated to understand but we already <strong>declared</strong> <strong>what</strong> the <strong>function</strong> <strong>does</strong> in the name, the function turns exterior lights on, the function checks for burned bulbs, understanding this may ease locating bugs in the future, and make it easier to add logic to the function without changing it’s name.</p><p>Eventually, after implementing these ideas into your application you should have organized objects with <strong>informer</strong>, <strong>management</strong> and <strong>router</strong> functions in your class segment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b50533897c8d9d9f69bc97adeb5deac0/href">https://medium.com/media/b50533897c8d9d9f69bc97adeb5deac0/href</a></iframe><p>and all the <strong>execution/logic</strong> in the extension block in the same file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9051554ea1e5bf23d9789e3f08363cd/href">https://medium.com/media/c9051554ea1e5bf23d9789e3f08363cd/href</a></iframe><p>The outcome would be a clean short class, readable and easily maintained.</p><h4><strong><em>* Remember functions should always be written by the single<br> responsibly principle.</em></strong></h4><p><strong>Avoid</strong> using &quot;and&quot; in function name: <br>play<strong>And</strong>Minimize()<br>load<strong>And</strong>Play()<br>This bad practice breaks the single responsibility principle and makes you write code suitable for both situations.</p><p><strong>Avoid </strong>playing guessing games when naming a function:<br><em>moveRedViewIfNeeded()</em><br>This example guarantees future programmers would have to dive inside the function only to understand <strong>what the trigger</strong> for moving the Red View, which by the way also ambiguous.</p><pre>* and no <strong>layoutIfNeeded()</strong> is <strong>not</strong> <strong>the same thing</strong>, in this case we know that self should re-layout its view&#39;s when setNeedsLayout bool is true. This example is universal to swift programming language while your function will probably remain private to your application.</pre><h3>Bonus (food for thought)</h3><p>The first thing that comes in mind when thinking about readable code is using code convention, they are well known and commonly used, but using them does not necessarily makes your code better, it will make it cross-application but less readable.</p><blockquote>“is” prefix should be used for boolean variables and methods to explain that the returned value is of type Boolean. #CodingConventions</blockquote><p><em>“if”</em> statement <strong>always</strong> addresses boolean values, then why do we need to declare <em>“is”</em> in each boolean property? why did apple changed swift syntax from <strong>view.hidden</strong> <strong>~&gt;</strong> <strong>view.isHidden</strong> ? there’s only one answer I could think of…. because <strong>“if view.isHidden”</strong> feels natural.</p><p>Let’s try implementing “is” prefix by this laws:</p><ul><li>If a boolean property/method of a class used on an <strong>instance of that class (public) </strong>then “is” prefix is justified.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fbf532f608205bc96a72a54a9e281973/href">https://medium.com/media/fbf532f608205bc96a72a54a9e281973/href</a></iframe><ul><li>If a boolean property used <strong>inside the class</strong> (private) then the prefix is redundant.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08b90692c34110eb4a0c50a370f52dba/href">https://medium.com/media/08b90692c34110eb4a0c50a370f52dba/href</a></iframe><ul><li>if a boolean property/method <strong>used</strong> <strong>privately</strong> and <strong>publicly</strong> then a computed propery should return the private property value.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93610e68d67026772454239b51e37c8b/href">https://medium.com/media/93610e68d67026772454239b51e37c8b/href</a></iframe><p>We could have used private(set ) and still use it publicly but think about the side effect achieved here, we have implemented encapsulation.</p><blockquote>Encapsulation is <strong>used to hide the values or state of a structured data object inside a class</strong>, preventing unauthorized parties’ direct access to them.</blockquote><blockquote><a href="https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)">https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)</a></blockquote><p>You might be asking your self what about booleans that don’t address self directly, in this case, we should write that property name like so:</p><p>private var player<strong>Is</strong>Playing: Bool</p><p>private var gridConstraint<strong>Is</strong>Enabled()</p><p>“is” needs something to refer to: view.<strong>is</strong>Hidden, “is” refer to view. In the example above we have done that same thing, player<strong>Is</strong>Playing, “is” refers to the player.</p><p><strong>Remember:</strong> Developers usually read the code inside the function to try and understand its purpose long before they even bother on reading the declaration of properties.</p><pre>/if playerIsPlaying { }/ <strong>opposing to</strong> /if isPlayerIsPlaying {}/</pre><p>which of this options sound natural?, I’ll let you decide.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b63067900b72" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ios-os-x-development/making-your-ios-application-easy-to-read-with-these-simple-steps-b63067900b72">Making your iOS application easy to read with these simple steps.</a> was originally published in <a href="https://medium.com/ios-os-x-development">iOS App Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>