<?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 Mohammed Abdullatif on Medium]]></title>
        <description><![CDATA[Stories by Mohammed Abdullatif on Medium]]></description>
        <link>https://medium.com/@mohammedsafwat?source=rss-168707555fd4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3GYtgdKX8KHKQ2QAFc5qew.jpeg</url>
            <title>Stories by Mohammed Abdullatif on Medium</title>
            <link>https://medium.com/@mohammedsafwat?source=rss-168707555fd4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 07:46:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohammedsafwat/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[I have never been this tired in my entire life.]]></title>
            <link>https://medium.com/@mohammedsafwat/i-have-never-been-this-tired-in-my-entire-life-03fe6e454e8a?source=rss-168707555fd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/03fe6e454e8a</guid>
            <category><![CDATA[thoughts-and-feelings]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[meaning-of-life]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Mohammed Abdullatif]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 12:10:02 GMT</pubDate>
            <atom:updated>2026-03-10T12:10:02.097Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>When everything feels urgent, yet somehow meaningless.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xjijLAWFeVYs2XY3" /><figcaption>Photo by <a href="https://unsplash.com/@eduardoflorespe?utm_source=medium&amp;utm_medium=referral">Eduardo Flores</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Sometimes I stop and find myself asking, quietly, almost in disbelief:</p><p><em>How did I arrive here?</em></p><p>The past few years feel like a blur, like a stretch of road I somehow traveled without seeing. I know that things happened — my mind and my body remember that much — but when I look back, there are only fragments. A few scattered memories, floating in a fog.</p><p>And I wonder: when did everything start to feel so numb?</p><p>When did things lose their meaning?</p><p>There was a time when life moved through me with a kind of fire. I cared deeply. I was curious, restless, alive with that small but powerful spark that made ordinary things feel full of possibility. But somewhere along the way, over the past few years, something slowly dimmed that light. Not all at once, more like a quiet erosion, grain by grain.</p><p>Now I often feel exhausted in a way that sleep cannot fix. Not just tired, but worn down by something invisible. So much so that even the things I once loved feel distant, as if they belong to another version of me.</p><p>At first glance, this might sound like depression. But I know that road well enough to recognize it. I have spent years doing the work: therapy, journaling, reading and reflection, trying to understand myself and rebuild something steadier inside. This feels different. Deeper, somehow.</p><p>It feels less like something that lives only inside me, and more like something that has settled over the world itself.</p><p>People feel tired. The air around conversations feels heavier. Things seem to be getting worse in slow, quiet ways. Compassion feels thinner, patience shorter. Sometimes I catch myself thinking that even the world outside reflects this fatigue that even the trees, the plants, the living things around us carry a kind of weariness.</p><p>Maybe it’s because we live in an age where everything seems to revolve around power, money, conflict, and now machines that promise to reshape everything. The things that once looked bright and promising no longer shine the same way. It feels as if the surface of the world has peeled back a little, revealing truths that are harder, less comforting.</p><p>And once you see that, it’s difficult to unsee it.</p><p>Sometimes it feels like I’ve spent years running — running toward something that was supposed to matter. Chasing a version of life that was meant to feel meaningful. But the strange part is that I’m not even sure what it was I was chasing.</p><p>Just movement. Just momentum.</p><p>I know that meditation, exercise, or returning to the things I’m passionate about might help in small ways. They always do. But this feeling sits somewhere deeper than habits or routines. It feels tied to something larger, something shifting both within me and in the world around us.</p><p>And yet life continues in its ordinary rhythm.</p><p>Every morning I wake up, put on a smile, join my meetings, do my work, move through the day as if everything is fine. As if nothing underneath the surface has changed.</p><p>But deep down, I know it has.</p><p>For the first time in my life, it feels difficult to imagine a clear plan even a year from now. The ground beneath everything seems to be moving: wars, layoffs, technology reshaping entire industries overnight. Sometimes the present itself feels surreal, as if we’re all quietly trying to find our balance while the world shifts under our feet.</p><p>And so we keep going.</p><p>Showing up.</p><p>Working.</p><p>Smiling.</p><p>Trying, somehow, to make it through whatever this moment in history is asking of us. I just keep wondering, will I ever be able to answer the question: “<em>How did I arrive here</em>”?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03fe6e454e8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first 90 days as an Engineering Manager]]></title>
            <link>https://medium.com/@mohammedsafwat/my-first-90-days-as-an-engineering-manager-eace6e954a4d?source=rss-168707555fd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/eace6e954a4d</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[career-paths]]></category>
            <category><![CDATA[life-transitions]]></category>
            <category><![CDATA[engineering-mangement]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Mohammed Abdullatif]]></dc:creator>
            <pubDate>Wed, 30 Nov 2022 14:02:42 GMT</pubDate>
            <atom:updated>2022-11-30T14:04:11.286Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EDgrhs5CBA1bTnLOWgxsdg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/es/@aperturevintage?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Aperture Vintage</a> on <a href="https://unsplash.com/s/photos/zen-horizontal-stones?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Almost three months ago, I transitioned from an IC to an EM role at <a href="https://engineering.atspotify.com/">Spotify</a>. Almost three months ago, a new squad came to life starting with just one person: me.</p><p>My new team’s main responsibility is to look after some internal tools that exist today and allow our stakeholders to easily integrate Spotify’s playback and Web API capabilities with their products. I still remember the conversations I had with my hiring managers when I was interviewing for the role and I remember how exciting the mission of this new team felt to me. As a former iOS engineer at Spotify for 3 years, I understand how internal tools can bring so much value to engineers, stakeholders, and the whole organization. I also know how challenging it can be to look after those internal tools that were initially the efforts of individual remarkable engineers who wrote them during hack days or hack weeks. In 2020, <a href="https://retool.com/blog/state-of-internal-tools-2020/">Retool launched a survey</a> to learn about how engineers build and maintain their internal tools. The survey had 310 respondents and more than <strong>50%</strong> of them indicated that one of their biggest problems building internal tools is that they don’t have enough time or resources to iterate on them. The incremental stakeholder asks, the lack of clear ownership, and the difficulty justifying the impact of those tools usually leads to pushing them to the bottom of the priority list. Realizing all of that, one of our tribes started an initiative to create a new squad that can look after the internal tools that help many engineers and stakeholders today and can create a tooling platform that can scale in the future too.</p><p>Starting a new team can be challenging enough, but starting a new team in a new tribe and taking on a new role tripled that challenge. I can’t deny that I felt very overwhelmed in my first weeks, but I was lucky enough to have a wonderful buddy and mentor who helped me so much and guided me through many aspects of the role that were totally new to me. I felt better as I knew that I have people around me who can support me and the new team. It was just very important for me to be honest with myself and define a plan that I can follow. Eisenhower had this famous quote: “Plans are worthless, but planning is everything” and I always keep that in mind. I know that my plans will always change but at the same time, I know that I should have a plan in the first place. The question for me was, for how long should I create this plan?</p><h4>The first 90 days</h4><p>To find an answer to this question, I started reading about <a href="https://blog.pragmaticengineer.com/things-ive-learned-transitioning-from-engineer-to-engineering-manager/">other people’s experiences</a> transitioning from engineers to engineering managers. I came across “<a href="https://l.workplace.com/l.php?u=https%3A%2F%2Fhbr.org%2Fbooks%2Fwatkins&amp;h=AT0FFP_hndvc_90EgXelBW4JK9Ugv2Bc0pRO1q-rHGafBazYkQZy5nZEnJzE1VvAXK9QcrEgb3OKM-uti34OgUu9eDemT3yA4v5VdxouKf9hgtP0uDe5pLhZsWYb0sRnpV3p9hxN6cl1CyUw6FUE1GVWlsg82F2RlYs3ZAWqTv5iJRiXgrY&amp;__tn__=-UK-R&amp;c[0]=AT21cvruSOJf57o7YSciQoGsg0_ymKnqdjF4POjPGLeP60BsXBASAP716uTlRBtp36bRGcypdi7yQNwrXMjlA-NnkqX4KAFT4BMIBkMbJA8-KvQqQ8UubDhqQCXOVbt7MB2gsLgVIHHvwuEnNseFbLZib0ZB7OdA37979UaDPbYcWYupZyE3MXW75h_mSJPx10jffnrR-m0rP7nPJ8noQw">The first 90 days</a>” book that had this sentence on page 1: <em>“The president of the United States gets 100 days to prove himself; you get 90”</em>. So, I have fewer days than the president of the United States to prove myself? I’m not panicking, you are panicking!</p><p>Okay — let’s take a deep breath! We can do this. To lay out a plan for the first 90 days, I had two things in mind:</p><ul><li>How can we create a foundation for the team?</li><li>How can we start securing easy wins?</li></ul><p>What I found was that this plan needs to also include a few goals for my own development and for the new engineers who will join the team. It was also important to get everyone on board and ask for constant feedback to fill in the gaps and identify what I might be assuming or missing.</p><h4>The plan</h4><p>I tried to identify three areas that I would like to focus on during the first 90 days: <strong>People</strong>, <strong>Process</strong>, and <strong>Product</strong>. I created a matrix to lay out the goals in each area mapped to each month. In the first month, the plan focused on “education”. Committing to my own education and helping the new team members get onboarded was crucial. It is important to take the time to understand what’s going on: who are we as a business? what’s our vision and mission? what’s expected from us? what is our tech stack? how do teams work together and what’s the culture in our tribe? how can we guarantee seamless onboarding for our new engineers?</p><p>The second month of the plan was more about “reaching out”, or in other terms, expanding our connection and knowledge circles. We wanted to get to know our stakeholders better, we wanted to know what’s bothering our users when they use the tools, what are they hoping to see in the future and how can we help them. We wanted also to lay the grounds for the future handover plans that will happen with the current owners of the tools and get to know them better. After all, they are the ones who will support us in making this transition happen. In short, we wanted to make more friends.</p><p>The third month’s theme is “establishing”. We know that by this time we will have two new engineers joining the team and the goal here is to make them feel welcomed and supported. We wanted to make sure that we have a process in place and that we start developing a culture of trust and openness in the team. It’s important to have strong grounds that can make the team feel that we have clear ways of working and that their development plans and goals are a priority.</p><h4>What we achieved in 90 days</h4><ul><li>We welcomed and onboarded two new engineers to the team.</li><li>We defined a vision and mission for the new team. Or at least, the first version of them. We know that this is a process that will evolve over time.</li><li>We defined the first version of our short-term and long-term goals.</li><li>We learned more about the current state of the tools that we plan to own by running different audits to identify the strength, weaknesses, and opportunities for each of them.</li><li>We started conducting user interviews with the stakeholders of our internal tools.</li><li>We started building transition and handover plans for the tools as our new team will be the one responsible for their future tech and product health.</li><li>We started building backlogs for the proposed fixes and feature requests for each tool. What helped us here is the amount of qualitative data that we gathered from the user interviews.</li></ul><p>As we are a very small and young team, it was important for us to define our priorities and know which one of the tools that exist today needs our attention first. Gathering both quantitative and qualitative data helped us a lot to define that. We are also looking to expand our tooling platform in the long term by owning more tools that can align with our vision and by creating new tools that can make integrations with Spotify’s playback capabilities and content consumption easier.</p><p>As a new team, we are hopeful that the future holds exciting opportunities for us and we believe that we will have a big impact on our tribe and Spotify. Being part of this journey is kind of exhilarating and many times I feel glad that I took this leap of faith to make the transition to an EM. I always wondered about the next step in my career and after getting the role I told myself: “Hey, maybe this is the sign that you have been looking for!”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eace6e954a4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mocking in Swift]]></title>
            <link>https://medium.com/swlh/mocking-in-swift-3026b438b56c?source=rss-168707555fd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3026b438b56c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Mohammed Abdullatif]]></dc:creator>
            <pubDate>Fri, 01 May 2020 23:14:10 GMT</pubDate>
            <atom:updated>2020-05-03T17:44:02.819Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FcuITBu4VFJ_HH2TdOfP6g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@keilahoetzel?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Keila Hötzel</a> on <a href="https://unsplash.com/s/photos/boxes-minimal?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>When I started learning about what defines a good unit test, an important concept to remember was that good unit tests should be isolated and that the goal of a single unit test is to verify that a specific unit of our code works properly while being isolated from the rest of the system. This means that if for example, we have a Shop class that contains a method sellItem(:item) and if we want to write a unit test that will test the behavior of sellItem(:item), our unit test should not care at this point about the implementation details of the item argument that sellItem(:item) accepts. If our unit test cares about the implementation details of the item argument, this means that our unit test is not isolated and actually at this point, we might not be able to call it a unit test anymore. It’s more of an integration test now.</p><p>To make our unit test isolated and not forced to work with other parts of our code that might introduce other problems, we have to <strong><em>fake </em></strong>those other parts that we don’t want to depend on or care about. During my development years, there has been lots of confusion about what does <strong><em>faking</em></strong> means here. After reading a few books and articles on the subject, I found that there are many ways to <strong><em>fake </em></strong>the behavior of the objects that we don’t care about. Those objects, in this case, can get many different names: “<strong><em>mocks</em></strong>, <strong><em>stubs</em></strong>, <strong><em>dummies</em></strong>, <strong><em>fakes</em></strong>, <strong><em>spies</em></strong>,..”. I used to get confused all the time when I heard those words. At some point, they all seemed very similar to me. Many times I used to refer to <strong><em>stubs</em></strong> as <strong><em>mocks</em></strong> and vice versa, but thankfully I learned more about the differences as I progressed in my career. I hope that I have a better understanding of those concepts now and that I can help you understand them too.</p><h3>Test Doubles</h3><p>Gerard Meszaros’s has a nice definition for what does <strong><em>faking </em></strong>an object mean in <a href="https://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054">his book</a> “xUnit Test Patterns”. He uses the term “<strong><em>Test Double</em></strong>” to refer to any kind of fake or pretend object that is used in place of a real object for testing purposes.</p><p>There are different types of “<strong><em>Test Doubles</em></strong>” that we might need for writing our tests. While the definitions can be slightly different among developers, I would love to share my understanding in this article and hear any other definitions or thoughts about them. This is a list of the most common “<strong><em>Test Doubles</em></strong>” used in the testing world:</p><ul><li><strong>Dummy Object: </strong>An object that does nothing. The main importance of creating a dummy object is for our code to compile. We can have some parameters to fill and in this case, we need to create some dummy objects so that our code can successfully compile. Those dummy objects can be of the type <strong><em>class</em></strong> or <strong><em>struct</em></strong> and they might conform to any number of protocols but they don’t have any functionality.</li><li><strong>Fake Object: </strong>An object that is an actual working implementation of a class for example, but the implementation takes some sort of shortcut that makes testing easier. The most common example is an in-memory database fake object. Fake objects can make our tests run faster. An in-memory database runs faster than a real one.</li><li><strong>Stub Object: </strong>An object that always returns fixed data. For example, if you want to write a test that verifies the correct creation of a model object after decoding some JSON data, it’s better in this case to create an object that will always return a fixed JSON response. This helps to make your tests faster and always reliable.</li><li><strong>Mock Object: </strong>An object that uses behavior verification. Mock objects are widely used to verify that an object was initialized successfully, that specific methods were called inside the object or that some methods were called a certain number of times. Mock objects track all the data so that you can verify it later but they don’t do any meaningful action. Mocks are very powerful because we set them up with a series of expectations, trigger some action, and then we will be able to inspect all the work that happened in a sealed black box with no actual work happening. They give us just enough feedback to build real objects.</li><li><strong>Spy Object: </strong>A<strong> </strong>spy object is similar to a mock object except that it can make actual work happen. A spy object tracks the behavior of an object (to check if specific methods were called successfully or called a certain number of times) and also does an actual work (like sending a real network request).</li></ul><p>Regardless of which implementation you choose to create your test double, all test doubles need to conform to the correct protocols required for them to stand in place for the real type. All types of test doubles are important, but “<strong><em>mocks</em></strong>” and “<strong><em>stubs</em></strong>” are maybe the two most common types that are being used in the world of testing.</p><p>In this article, we will talk more about mocking in Swift and see some examples.</p><h3>Mocking</h3><p>You probably have heard the term “<strong><em>mocking</em></strong>” so many times until now. It is so popular today and is widely used that many developers use it to refer to the act of creating a test double of some sort.</p><p>If we recall, the main job of a mock object is to verify that some sort of behavior happened on this mock object. Mocks simulate the behavior of a real object but they don’t cause any actions to take place.</p><p><strong>Remember</strong>: An important characteristic of a good unit test is that it is isolated and that it tests one single unit of code at a time. Things outside the tested code are faked or simulated because unit tests shouldn’t have dependencies on outside systems. If we have one object that we want to test and this object depends on some other objects, to make sure that a unit test is focusing only on verifying the behavior of our object and doesn’t get complicated by using instances of the dependencies, we tend to simulate the behavior of those dependencies, i.e. <strong><em>mocking</em></strong> them.</p><p>Let’s start with an example: people buying books from a BookStore. Our BookStore has an inventory of 1000 books and every time a customer buys a book the inventory’s count gets decreased by one. This is how our Buyer class may look like:</p><pre><strong>class</strong> Buyer {</pre><pre><strong>    func</strong> buy(bookStore: BookStore) {</pre><pre>        bookStore.executePurchase()<br>    }</pre><pre>}</pre><p>And this is how our BookStore class may look like:</p><pre><strong>class</strong> BookStore {</pre><pre><strong>    var</strong> numberOfBooks = 1000</pre><pre><strong>    func</strong> executePurchase() {</pre><pre>        numberOfBooks -= 1</pre><pre>    }<br>}</pre><p>Testing BookStore by itself is straightforward. We can do the following:</p><pre><strong>func</strong> testExecutePurchaseDecreasesInventoryByOne() {</pre><pre>    // given</pre><pre><strong>    let</strong> bookStore = BookStore()</pre><pre>    // when</pre><pre>    bookStore.executePurchase()</pre><pre>    // then</pre><pre>    XCTAssertEqual(bookStore.numberOfBooks, 999)</pre><pre>}</pre><p>What about testing the Buyer class? If we look at buy(bookStore:) method we will realize that our Buyer class has a dependency on the BookStore class. Remember that we want our test to be focused on the buyer and be less distracted by the implementation details of the book store. We want our test to verify that when buy(bookStore:) is called on any Buyer object, then this causes the inventory of the book store to get decreased by one, but we don’t want to use a real object of the book store in this case. To achieve that, we will create a mock class forBookStore, a class that simulates what happens inside the BookStore but it’s smaller, faster, and easier to change for any future testing needs.</p><p>Let’s see how can we write a test for Buyer using a mocked BookStore instead of using a real instance of BookStore:</p><pre><strong>func</strong> testBuyerBuyingBookDecreasesBooksInventoryByOne() {</pre><pre>    // given</pre><pre><strong>    let</strong> buyer = Buyer()</pre><pre><strong>    let</strong> bookStoreMock = BookStoreMock()</pre><pre>    // when</pre><pre>    buyer.buy(bookStore: bookStoreMock)</pre><pre>    // then</pre><pre>    XCTAssertEqual(bookStoreMock.numberOfBooks, 999)</pre><pre>}</pre><p>Okay, now we need to create BookStoreMock, a class that will act as a test double for BookStore, meaning that it will be a class that simulates the functionalities that BookStore does but will focus on one aspect. In our case, it will be a class that simulates the book store’s <strong><em>behavior </em></strong>in executing a purchase.</p><p>The classic computer science book <a href="https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612">Design Patterns</a> by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (The Gang of Four Book) mentions that if we want to define one or more behavior for a class, we should then design to <strong><em>interfaces</em></strong>, not <strong><em>implementations</em></strong>. In Swift, this means using <strong><em>protocols</em></strong> rather than concrete types. Creating a protocol gives us the power to create different classes that conform or agree to the same behaviors but implement them differently. For example, we will create a BookStoreProtocol that declares the method executePurchase, and we will create two classes BookStore and BookStoreMock. Both of these classes will conform to BookStoreProtocol, but inBookStore’s implementation of executePurchase, it will choose to write the numberOfBooks when a purchase happens to a local database, while BookStoreMock&#39;s implementation of executePurchase will just return a number and writes something to our logs.</p><p>Using protocols gives classes the freedom to have different implements for the same behaviors defined in one protocol. This makes creating tests doubles that are needed for writing unit tests easier.</p><p>Let’s write a protocol that will define the expected behaviors from the BookStore class:</p><pre><strong>protocol</strong> BookStoreProtocol {</pre><pre><strong>    var</strong> numberOfBooks: Int { <strong>get</strong> <strong>set</strong> }</pre><pre><strong>    func</strong> executePurchase()</pre><pre>}</pre><p>Now, let’s make our original BookStore class conform to it:</p><pre><strong>class</strong> BookStore: BookStoreProtocol {</pre><pre><strong>    var</strong> numberOfBooks = 1000</pre><pre><strong>    func</strong> executePurchase() {</pre><pre>        numberOfBooks -= 1</pre><pre>    }</pre><pre>}</pre><p>and let’s create our mock class for BookStore :</p><pre><strong>class</strong> BookStoreMock: BookStoreProtocol {</pre><pre><strong>    var</strong> numberOfBooks = 1000</pre><pre><strong>    func</strong> executePurchase() {</pre><pre>        numberOfBooks -= 1<br>        print(&quot;BookStoreMock: The current number of books in the inventory is \(numberOfBooks)&quot;)</pre><pre>    }</pre><pre>}</pre><p>In our simple example, the implementation of executePurchase is not that different if we compare BookStore and BookStoreMock, but in larger projects, mocked methods tend to have a simpler implementation compared to the concrete implementation.</p><p>There’s one more change that we need to do, we need to change the buy method inside our Buyer class to accept an argument of our protocol type BookStoreProtocol instead of the concrete type BookStore. This allows us to call buy(bookStore:) in our production code by passing an instance of BookStore and allows us to call buy(bookStore:) in our unit tests by passing an instance of BookStoreMock. The key player here is our protocol BookStoreProtocol that allowed us to do that. This is how the Buyer class will look like after this change:</p><pre><strong>class</strong> Buyer {</pre><pre><strong>    func</strong> buy(bookStore: BookStoreProtocol) {</pre><pre>        bookStore.executePurchase()<br>    }</pre><pre>}</pre><p>If you run the unit tests now, they should be green.</p><h3>Partial Mocks vs. Full Mocks</h3><p>The approach that we followed in the previous example with our BookStore and BookStoreMock classes is called <strong><em>full or complete mocking</em></strong> because we create completely separate types for our testing purposes. There’s another approach called <strong><em>partial mocking</em></strong>, it involves subclassing a specific type and overriding the parts that we want to simulate in our tests doubles only.</p><p>Let’s see how we can implement that. In the scenario of partial mocking, we want our partially mocked class to implement a different behavior for executePurchase method. Instead of decreasing the number of books by 1, we will decrease the number of books by 10 when executePurchase is called. Our unit test should verify that deduction behavior is happening successfully.</p><p>This is our partially mocked class:</p><pre><strong>class</strong> BookStorePartialMock: BookStore {</pre><pre><strong>    override</strong> <strong>func</strong> executePurchase() {</pre><pre>        numberOfBooks -= 10</pre><pre>    }</pre><pre>}</pre><p>In this case, our buy(bookStore:) method inside our Buyer class can accept an argument of the type BookStore with no problems:</p><pre><strong>class</strong> Buyer {</pre><pre><strong>    func</strong> buy(bookStore: BookStore) {</pre><pre>        bookStore.executePurchase()</pre><pre>    }</pre><pre>}</pre><p>and our unit test now can look like the following:</p><pre><strong>func</strong> testBuyerBuyingBookDecreasesBooksInventoryByOne() {</pre><pre>    // given</pre><pre><strong>    let</strong> buyer = Buyer()</pre><pre><strong>    let</strong> bookStoreMock = BookStorePartialMock()<br></pre><pre>    // when</pre><pre>    buyer.buy(bookStore: bookStoreMock)</pre><pre>    // then</pre><pre>    XCTAssertEqual(bookStoreMock.numberOfBooks, 990)</pre><pre>}</pre><p>At this point, I hope that I managed to make the mocking concept in Swift a little bit approachable for you. In this article, I shared the basic definition of what a “<strong><em>test double</em></strong>” means and what are the different types of test doubles that we can create. I also talked a little bit about the definition of mocking and why mocking can be useful when we write tests. If you have any questions, suggestions, or improvements I’m always happy to learn more and exchange knowledge with all of the awesome developers everywhere. Please feel free to write a comment, <a href="https://www.twitter.com/_MohamadSafwat">tweet me</a>, or <a href="/service/mailto:mailmsafwat@gmail.com">drop me a line</a>!</p><p><strong>Resources:</strong></p><ul><li><a href="https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612">Design Patterns: Elements of Reusable Object-Oriented Software</a></li><li><a href="https://martinfowler.com/articles/mocksArentStubs.html">Mocks aren’t Stubs: Martin Fowler</a></li><li><a href="https://www.amazon.com/xUnit-Test-Patterns-Refactoring-Code/dp/0131495054">xUnit Test Patterns: Refactoring Test Code</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3026b438b56c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/mocking-in-swift-3026b438b56c">Mocking in Swift</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The ‘this’ keyword in JavaScript, demystified]]></title>
            <link>https://itnext.io/the-this-keyword-in-javascript-demystified-c389c92de26d?source=rss-168707555fd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c389c92de26d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[theory]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mohammed Abdullatif]]></dc:creator>
            <pubDate>Mon, 11 Feb 2019 05:50:49 GMT</pubDate>
            <atom:updated>2019-02-13T10:23:35.041Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u98adouc8-eKxM34eqi5Lw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/k_T9Zj3SE8k?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Simon Abrams</a> on <a href="https://unsplash.com/search/photos/coding?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>When I first started learning JavaScript, it took me some time to understand the this keyword in JavaScript and be able to quickly identify which object does the this keyword point to. I found that the hardest thing about understanding the this keyword is that you usually forget the different cases and situations that you have read about or watched people explain during one or more of the JavaScript courses or resources that you study from. After introducing the arrow functions in ES6, things got more confusing too because arrow functions deal with the this keyword in a different way. I wanted to write this article to state what I have learned and try to explain it in a way that could help anyone who is learning JavaScript and having difficulty understanding the this keyword as I did before.</p><p>As you may know, the environment (or the scope) in which any JavaScript line is being executed is called “The Execution Context”. The Javascript runtime maintains a stack of these execution contexts and the execution context present at the top of this stack is currently being executed. The object that this variable refers to changes every time when the execution context is changed.</p><p>By default, the execution context is global which means that if a code is being executed as part of a simple function call then the this variable will refer to the global object. In the case of a browser, the global object is the window object. In a Node.js environment, for example, a special object global will be the value of this.</p><p>For example, try the following simple function call:</p><pre>function foo () {<br>  console.log(&quot;Simple function call&quot;);<br>  console.log(this === window);<br>}</pre><pre>foo();</pre><p>By calling foo(), we will get this output:</p><pre>“Simple function call”<br>true</pre><p>This proves that this here refers to the global object, which is the window object in our case.</p><p>Note that, if strict mode is enabled for any function then the value of this will be undefined because in strict mode global object refers to undefined in place of the window object.</p><p>Let’s try the following example:</p><pre>function foo () {<br>  &#39;use strict&#39;;<br>  console.log(&quot;Simple function call&quot;);<br>  console.log(this === window);<br>}</pre><pre>foo();</pre><p>Our output, in this case, will be:</p><pre>“Simple function call”<br>false</pre><p>Let’s imagine now that we have the following constructor function:</p><pre>function Person(first_name, last_name) {<br>    this.first_name = first_name;<br>    this.last_name = last_name;<br>  <br>    this.displayName = function() {<br>        console.log(`Name: ${this.first_name} ${this.last_name}`);<br>    };<br>}</pre><p>Let’s create some Person instances:</p><pre>let john = new Person(&#39;John&#39;, &#39;Reid&#39;);<br>john.displayName();</pre><p>If we try that in our console, we should get the following output:</p><pre>&quot;Name: John Reid&quot;</pre><p>What happened here? When we call new on Person, JavaScript will create a new object inside the Person function and save it as this. Then, the first_name, last_name and displayName properties will be added on the newly created this object. I used this awesome <a href="https://tylermcginnis.com/javascript-visualizer">JavaScript visualizer tool</a> from <a href="https://medium.com/u/c52389e3ee63">Tyler McGinnis</a> to see how this actually looks like behind the scenes. This is what I got:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wybUfnpHLdxaWJd-0314hQ.png" /></figure><p>You will notice that we have a this object created inside the execution context of Person and that this object has the three properties first_name, last_name and displayName. This tool animates the steps happening behind the scenes in an interesting way that will help you understand how the this object is created and filled.</p><p>We have now discussed two common cases related to the this keyword binding. There’s one more case that I wanted to mention and that could be a little confusing too. Imagine that we have this function:</p><pre>function simpleFunction () {<br>    console.log(&quot;Simple function call&quot;)<br>    console.log(this === window); <br>}</pre><p>We now know that if we do a simple function call like the following, the this keyword will refer to the global object, in our case, it’s the window object. Let’s do that:</p><pre>simpleFunction();</pre><p>Indeed, we get this in as our output:</p><pre>“Simple function call”</pre><pre>true</pre><p>Let’s create a simple user object like the following:</p><pre>let user = {<br>    count: 10,<br>    simpleFunction: simpleFunction,<br>    anotherFunction: function() {<br>        console.log(this === window);<br>    }<br>}</pre><p>Now, we have a simpleFunction property referring to our simpleFunction function. We have also added another property as a method called anotherFunction.</p><p>If we call user.simpleFunction() , we will get this in our console’s output:</p><pre>“Simple function call”<br>false</pre><p>Why did that happen? Because simpleFunction() is now a property of the user object, then the this keyword will refer to the user object and not the global object in this case.</p><p>If we call user.anotherFunction() now, we should expect the same thing too. Our this keyword will refer to the user object. So, console.log(this === window); should return false and we should get this output in our console:</p><pre>false</pre><p>Let’s discuss one more case. What will happen if we do something like the following?</p><pre>let myFunction = user.anotherFunction;</pre><pre>myFunction();</pre><p>If you try this, you should get this output:</p><pre>true</pre><p>But why did this happen? In this case, we do a simple function call. As we already know by now, if a method is invoked as a simple function, then the this keyword will refer to the global object which is in our case equals to the window object, and hence console.log(this === window); will print true.</p><p>Let’s see another example:</p><pre>var john = {<br>    name: &#39;john&#39;,<br>    yearOfBirth: 1990,<br>    calculateAge: function() {<br>        console.log(this);<br>        console.log(2016 - this.yearOfBirth);</pre><pre>        function innerFunction() {<br>            console.log(this);<br>        }<br>        innerFunction();<br>    }<br>}</pre><p>What will happen now if we call john.calculateAge() ? We should get something similar to this:</p><pre>{name: &quot;john&quot;, yearOfBirth: 1990, calculateAge: ƒ}<br>26<br>Window {postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, parent: Window, …}</pre><p>Inside the calculateAge function, thisrefers to the calling ‘john’ object. But inside innerFunction function, this this refers to the global object which in this case is the window object. Some people see that as a bug in JS, but the rule says that whenever we do a regular function call, then this will refer to the global object.</p><p>What I learned also is that a function in JavaScript is also a special type of object. Every function has a call, bind and apply methods. These methods can be used to set a custom value of this to the execution context of the function. Let’s see the following example:</p><pre>function Person(firstName, lastName) {<br>    this.firstName = firstName;<br>    this.lastName = lastName;</pre><pre>    this.displayName = function() {<br>        console.log(`Name: ${this.firstName} ${this.lastName}`);<br>    }<br>}</pre><p>And let’s create two new persons:</p><pre>let person = new Person(&quot;John&quot;, &quot;Reed&quot;);<br>let person2 = new Person(&quot;Paul&quot;, &quot;Adams&quot;);</pre><p>And call:</p><pre>person.displayName();<br>person2.displayName();</pre><p>This should print:</p><pre>Name: John Reed<br>Name: Paul Adams</pre><p>Now, let’s use call on person object:</p><pre>person.displayName.call(person2);</pre><p>What we are doing here is setting the value of this to be person2 object. So, this should print:</p><pre>Name: Paul Adams</pre><p>The same also will happen if we use apply:</p><pre>person.displayName.apply([person2]);</pre><p>We will get:</p><pre>Name: Paul Adams</pre><p>The only difference between call and apply methods is the way arguments are passed. In the case of apply, the second argument is an array of arguments where in case of call method, arguments are passed individually.</p><p>Let’s also try doing the same with the bind method. bind returns a new method with this referring to the first argument passed. For example:</p><pre>let person2Display = person.displayName.bind(person2);</pre><p>If we now call person2Display, we should get Name: Paul Adams too.</p><h4>Arrow Functions</h4><p>As part of ES6, there is a new way introduced to define a function. It looks like the following:</p><pre>let displayName = (firstName, lastName) =&gt; {<br>    console.log(Name: ${firstName} ${lastName});<br>};</pre><p>Unlike normal functions, arrow functions don’t get their own this keyword. They simply use the this keyword of the function they are written in. They have a lexical this variable.</p><p>Let’s see an example of something that we used to do in ES5:</p><pre>var box = {<br>    color: &#39;green&#39;, // 1<br>    position: 1, // 2<br>    clickMe: function() { // 3<br>        document.querySelector(&#39;body&#39;).addEventListener(&#39;click&#39;, function() {<br>            var str = &#39;This is box number &#39; + this.position + &#39; and it is &#39; + this.color; // 4<br>            alert(str);<br>        });<br>    }<br>}</pre><p>If we call:</p><pre>box.clickMe();</pre><p>An alert will be displayed with the content: ‘This is box number undefined and it is undefined&#39;.</p><p>Let’s analyze what’s happening here step by step. If you look at the above example, I have added some comments // 1 , // 2 and // 3. At lines // 1 and// 2, our this keyword has access to color and position properties because it refers to box object.</p><p>Inside clickMe method also, our this has access to color and position properties because it’s still referring to box object. But, clickMe method defines a callback function for querySelector, and the callback function now is a regular function call so our this now will refer to the global object which in this case is the body object. Of course, position and color are not defined in the body object, so that’s why their values will be undefined and we get an alert displaying ‘This is box number undefined and it is undefined’.</p><p>We can fix this issue using an ES5 approach, by doing something like the following:</p><pre>var box = {<br>    color: &#39;green&#39;,<br>    position: 1,<br>    clickMe: function() {<br>        var self = this;<br>        document.querySelector(&#39;body&#39;).addEventListener(&#39;click&#39;, function() {<br>            var str = &#39;This is box number &#39; + self.position + &#39; and it is &#39; + self.color;<br>            alert(str);<br>        });<br>    }<br>}</pre><p>Adding var self = this is a workaround to make the closure function use the value of the this keyword that refers to the box object. We just need to use the new self variable inside the callback function now.</p><p>If we call:</p><pre>box.clickMe();</pre><p>We should get an alert displaying: ‘This is box number 1 and it is green’.</p><p>How can the use of arrow functions help us in cases like these? Let’s see the following example that’s based on the last one we have discussed. We will replace the callback function of the click event listener inside clickMe with an arrow function:</p><pre>var box = {<br>    color: &#39;green&#39;,<br>    position: 1,<br>    clickMe: function() {<br>        document.querySelector(&#39;body&#39;).addEventListener(&#39;click&#39;, () =&gt; {<br>            var str = &#39;This is box number &#39; + this.position + &#39; and it is &#39; + this.color;<br>            alert(str);<br>        });<br>    }<br>}</pre><p>The amazing thing about arrow functions is that they share the lexicalthis keyword of their surroundings. So, in our example here it shares the this keyword with its outer function. This this keyword for the outer function refers to the box object, so this.position and this.color will have the correct values of green and 1.</p><p>Let’s have one more example:</p><pre>var box = {<br>    color: &#39;green&#39;,<br>    position: 1,<br>    clickMe: () =&gt; {<br>        document.querySelector(&#39;body&#39;).addEventListener(&#39;click&#39;, () =&gt; {<br>            var str = &#39;This is box number &#39; + this.position + &#39; and it is &#39; + this.color;<br>            alert(str);<br>        });<br>    }<br>}</pre><p>Oh! Now, we got an alert saying: ‘This is box number undefined and it is undefined’. What happened here?</p><p>The this keyword of the click event listener’s closure shares the value of thethis keyword of its surroundings. Its surroundings in this case is the arrow functionclickMe. The this keyword of the clickMe arrow function refers to the global object, in this case the window object. So, this.position and this.color will be undefined because our window object does not know anything about the position or the color properties.</p><p>I want to show you one more example that’s a common case with the map function which can be helpful in many situations. We defined a Person constructor method above:</p><pre>function Person(firstName, lastName) {<br>    this.firstName = firstName;<br>    this.lastName = lastName;</pre><pre>    this.displayName = function() {<br>        console.log(`Name: ${this.firstName} ${this.lastName}`);<br>    }<br>}</pre><p>Let’s add a new method called myFriends to Person&#39;s prototype:</p><pre>Person.prototype.myFriends = function(friends) {<br>    var arr = friends.map(function(friend) {<br>        return this.firstName + &#39; is friends with &#39; + friend;<br>    });<br>    console.log(arr);<br>}</pre><p>Let’s create a new person:</p><pre>let john = new Person(&quot;John&quot;, &quot;Watson&quot;);</pre><p>If we call john.myFriends([&quot;Emma&quot;, &quot;Tom&quot;]), we will get this output:</p><pre>[&quot;undefined is friends with Emma&quot;, &quot;undefined is friends with Tom&quot;]</pre><p>This is very close to the examples we have discussed above. myFriends function will have a this keyword in its body that is referring to the calling object. But, the closure inside the map function is a normal function call, so the this keyword inside the closure of the map function will refer to the global object, in this case it’s the window object which makes the value of this.firstName undefined. Now we know how to fix that! we have at least three ways to fix this situation:</p><ol><li>By Assigning this inside myFriends function body to another variable, called self for example and using it inside the map function’s closure:</li></ol><pre>Person.prototype.myFriends = function(friends) {<br>    // &#39;this&#39; keyword maps to the calling object<br>    var self = this;<br>    var arr = friends.map(function(friend) {<br>        // &#39;this&#39; keyword maps to the global object<br>        // here, &#39;this.firstName&#39; is undefined.<br>        return self.firstName + &#39; is friends with &#39; + friend;<br>    });<br>    console.log(arr);<br>}</pre><p>2. By using bind on the map function’s closure:</p><pre>Person.prototype.myFriends = function(friends) {<br>    // &#39;this&#39; keyword maps to the calling object<br>    var arr = friends.map(function(friend) {<br>        // &#39;this&#39; keyword maps to the global object<br>        // here, &#39;this.firstName&#39; is undefined.<br>        return this.firstName + &#39; is friends with &#39; + friend;<br>    }.bind(this));<br>    console.log(arr);<br>}</pre><p>Calling bind will return a new copy of the map callback function but with a this keyword mapped to the outer this keyword, which is, in this case, will be the this keyword referring to the object calling myFriends.</p><p>3. We can create the callback of the map function to be an arrow function:</p><pre>Person.prototype.myFriends = function(friends) {<br>    var arr = friends.map(friend =&gt; `${this.firstName} is friends with ${friend}`);<br>    console.log(arr);<br>}</pre><p>Now, the this keyword inside the arrow function definition will share the lexical scope from its surroundings, which is the instance myFriends that we have created.</p><p>All of the above three solutions should give us this result:</p><pre>[&quot;John is friends with Emma&quot;, &quot;John is friends with Tom&quot;]</pre><p>At this point, I hope that I have managed to make the this keyword concept a little bit approachable for you. In this article, I shared some of the common situations that I have faced and how to deal with them, but of course, you will face more situations as you build more projects. I hope that my explanation can help you maintain a solid base when you approach the this keyword binding topic. If you have any questions, suggestions or improvements I’m always happy to learn more and exchange knowledge with all of the awesome developers everywhere. Please feel free to write a comment, <a href="https://www.twitter.com/_MohamadSafwat">tweet me</a>, or <a href="/service/mailto:mailmsafwat@gmail.com">drop me a line</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c389c92de26d" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/the-this-keyword-in-javascript-demystified-c389c92de26d">The ‘this’ keyword in JavaScript, demystified</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why software developers need therapy, too]]></title>
            <link>https://medium.com/@mohammedsafwat/why-software-developers-need-therapy-too-cea53c89230e?source=rss-168707555fd4------2</link>
            <guid isPermaLink="false">https://medium.com/p/cea53c89230e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[therapy]]></category>
            <category><![CDATA[mental-health]]></category>
            <dc:creator><![CDATA[Mohammed Abdullatif]]></dc:creator>
            <pubDate>Sat, 26 Jan 2019 16:26:13 GMT</pubDate>
            <atom:updated>2019-01-26T16:26:13.108Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6kXJ1fI3gRb7DbL7elFa3A.jpeg" /></figure><p>I arrive at my office. I walk next to my colleagues’ desks. I see most of them with their headphones on. The office is quiet, except if one of our teams is having a standup meeting or a mandatory discussion. Does that scene seem familiar to you too?</p><p>Software developers spend a long time thinking, experimenting, implementing and experiencing many different feelings, mostly alone. Since I started my software development journey until now, I have been witnessing this scene mostly every day and in most of the companies that I have worked for. Being a person who does that also (putting my headphones on for almost eight hours every day), I started to realize some changes happening to myself and my character over the years. Many of them affected my personality and my mental health, and this is why I wanted to write this article, to share my experience and to tell a personal story.</p><p>Software development is a very exciting field. There’s an infinite amount of opportunities and a ton of things to learn every day. Once you start learning how to code, you will be amazed by the huge amount of books, tutorials, resources and communities out there sharing knowledge and encouraging people to learn more. But on the other hand, this field is moving so fast. Every day there’s a new framework or a new technology out there to learn. And this is the first thing that you start to feel: <strong>anxiety</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jWCruGT9viMbE3xTP6Fjug.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/5i8l46zW8do?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Brunel Johnson</a> on <a href="https://unsplash.com/search/photos/sadness?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I know many people (and I’m one of them) who have this feeling that they want to learn everything at the same time. I always check the new technologies out there and add them to my “To Study” list. And this list keeps getting bigger and bigger every day. A simple morning skimming through my Twitter feed can make me very anxious for the rest of the day because I read about so many technologies and new things that I have to learn. And whenever I see more people talking about those technologies, I get more anxious because I keep telling myself that I should have known these technologies by now, but my list is so big and my day is not enough to learn everything.</p><p>So I get many bad feelings about myself. That I’m not a good developer because I don’t know what these people are talking about. I keep telling myself many times that I should focus only on a few technologies and don’t stress myself about other things, but the reality is that I just can’t. While doing iOS development with Swift, I’ll also think about learning JavaScript and React. And I know that I also need to be very good in Algorithms and Data Structures. I should also know about Kafka, Docker and all of these hot topics. And of course, I should master one or two programming languages, like Python or Java. So, I keep moving back and forth between so many topics which adds more stress to my daily life.</p><p>My second source of more anxiety and self-doubt is job interviews. To be specific, being rejected after a job interview. I still remember that for every job interview that didn’t go well I would spend at least one week trying to recover and trying to forget about my experience. Getting rejected by a company is not the end of the world, but it just makes you question yourself a lot. Am I good enough to get jobs like that? What did I do wrong? What am I doing wrong now? Is software development the right job for me? Suddenly, it feels like you will never be able to get a job or join the company of your dreams. And with more rejections, this feeling starts to get stronger and stronger. It just makes you question your performance also at your current job (even if you are good at it) and makes you feel that you don’t deserve it. Impressive, right?</p><p>Having some of your friends or your connections who work at one of the tech giants like Google, Amazon, and Facebook can add more stress too. When you check their updates and their photos from their cool offices and workplaces, you will ask yourself: why am I not there too? This question itself is enough to make you lose a significant time roaming in your thoughts and self-doubts. The constant comparison to our friends and colleagues can make us doubt our abilities and our achievements. Our network is small and we are well connected in a way that makes it hard for us to avoid reading about their updates, even if we wanted to.</p><p>All of the above points mentioned only some of the external factors for anxiety and self doubt that I feel and that most of my friends who do software development experience too. But what about mentioning some other factors like the competition inside your team? When for example you see one of your colleagues committing a huge amount of code every day, or another one finishing his tasks in no time. How do you feel at this moment? Let’s add also one more thing: if this brilliant colleague is younger than you! How many times did you get the feeling that you have wasted so much time in your life and that you should have done more to be able to keep up with these brilliant colleagues?</p><p>What about the new exciting project that you are working on now? How many days did you say that you will do just one extra hour today only but you end up leaving the office at 9:00 pm? How many weekends did you spend fixing bugs and doing more work just to feel that you are doing a great job and to make yourself feel better even if you are not paid for this extra time?</p><p>I feel also that I should mention an important point, which is the “office politics”. I don’t need to go through this term and explain it in more details, I’m sure that many of you know what does it mean. Being in a toxic work environment which is filled with politics can also make us very depressed and just hate the idea of waking up and going to the office.</p><p>All of the above is just a small part of what I have experienced and seen through many years of my software development career. But the list is very long indeed. The most important point is that because software developers spend a long time and experience many different feelings alone, this can make them transform into more silent human beings who can’t even explain their feelings or their problems at a certain point. They will not also realize that something is wrong with them. And I see that this can be very dangerous. For a long time, I felt that this is normal and that I’m fine. That I should keep up with the office politics, with my self-doubts and my anxiety. But the truth is that we shouldn’t be like that. Being a software developer should not negate the fact that you are still a human being. You should be happy with your life and you should enjoy your job. You should be excited about every line of code that you right. You shouldn’t feel that you are forced to do your job. So, when you see that this is not the case, you should know that you need to make a change. The most important change that you can make is, to be honest with yourself and to ask for help if you feel that something is wrong with you. It’s not shameful to say that you need help, and it’s not shameful to seek it.</p><p>Software development is beautiful, but we should always remember that our mental health is more important than writing the most amazing code or finishing a project in the shortest time possible.</p><p>In the end, I have to say thank you to <a href="https://itunes.apple.com/us/podcast/brainfork/id1436014505?mt=2">Brainfork</a>. I have been thinking about writing and sharing some of my feelings about anxiety, depression and mental health for a while, but after listening to this list of podcasts I became more inspired and this is why I wrote this post. I encourage you to listen to these podcasts too if you have time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cea53c89230e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>