<?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 Aldi Naufal Fitrah on Medium]]></title>
        <description><![CDATA[Stories by Aldi Naufal Fitrah on Medium]]></description>
        <link>https://medium.com/@aldi.naufal?source=rss-1b2e970d256e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3knZukeSaplHYli7</url>
            <title>Stories by Aldi Naufal Fitrah on Medium</title>
            <link>https://medium.com/@aldi.naufal?source=rss-1b2e970d256e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:07:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aldi.naufal/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[What is Software Architecture?]]></title>
            <link>https://medium.com/@aldi.naufal/what-is-software-architecture-1b9fdfb55620?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b9fdfb55620</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[mvc]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Thu, 12 May 2022 14:45:27 GMT</pubDate>
            <atom:updated>2022-05-12T14:45:27.238Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/375/0*2k6-ROZBoUDzD2RH.jpg" /><figcaption>source: <a href="https://stock.adobe.com/au/search?k=software+architecture&amp;asset_id=260822874">https://stock.adobe.com/</a></figcaption></figure><p>Any software flaw has a substantial influence on an organization’s business. The selection of incorrect software architecture can be the primary cause of any software failure. With prior experience, however, you would be able to assist designers and developers in the creation of components and their interactions.</p><p>Many developers frequently begin the application development process without a formal architecture in place. They overlook the fact that the lack of an architectural pattern can force the development team to choose an arbitrary pattern with no guidelines. They eventually end up with codes that lack defined roles, responsibilities, and interrelationships.</p><h3>Definition</h3><p>An architectural pattern is an outline that allows you to articulate and construct a structural schema for many types of software systems. It’s a reusable solution that includes a set of preset subsystems, roles, and responsibilities, as well as the rules and roadmap for building relationships between them. It aids you in addressing a variety of software engineering challenges, such as performance constraints, high availability, and limiting business risk, and many others.</p><p>A software architecture pattern indeed is a blue print of your system, but keep in mind that it’s not your actual system architecture. It should be treated as a concept that aids in the comprehension of software architectural parts. There might be numerous examples of the same trend throughout architecture. That is why patterns are referred to as “strictly specified and widely used.” Software architecture decision is critical to the system’s success.</p><h3>Why is it Important?</h3><p>Software architectural patterns are important because they may solve a variety of problems in a range of aspects. Complicated user requests, for example, can be efficiently broken down into smaller portions and transmitted across numerous servers rather than relying on a single server. Another example is that rather than evaluating the entire software at once, testing protocols can be simplified by breaking it into chunks. Another reasons are:</p><p><strong>Defining an Application’s Basic Characteristics. </strong>Knowing the capabilities, benefits, and limitations of each architecture is essential for selecting the best one to suit your business goals. Architecture patterns have been found to serve in defining an application’s essential characteristics and behaviors. Some architecture patterns, for example, are inherently suited to highly scalable applications, whereas others are better suited to rapid application development solutions.</p><p><strong>Maintaining Efficiency and Quality. </strong>Any application you develop has a good chance of having issues with quality. Selecting an architecture pattern based on your software development quality attributes can assist minimize quality issues while retaining efficiency.</p><p><strong>Rising Productivity. </strong>There must be certain established principles, regardless of one’s talents and knowledge of a programming language, framework, or application. With an appropriate application pattern in place, the organization can swiftly better understand the project’s status. Furthermore, once an architecture pattern is in place to define the project scope, productivity rates improve.</p><p><strong>Fostering Agility. </strong>It is common for software products to go through multiple iterations and adjustments during development and even after release. As a result, defining a basic software architecture ahead of time gives the program agility and makes future moderations simple.</p><h3>Is it the same with Design Pattern?</h3><p>The distinction between an architecture pattern and a design pattern is subtle, and most people get them mixed up. Both of them defines a blueprint of something and let the implementation detail left to us. Both also exists because of a problem and is there to solve the problem. One thing for sure, the software architecture pattern is more high-level than design pattern.</p><p>For example, if you are assigned to construct a building from the ground up. Ideally, you would need an architect to design a blueprint of the building and some civil engineering people to plan on how to build it. After it has been built, then you will need to fill it with various interior to make it comfy and worth living. It is just like software architecture patterns which is represented by your building initial design in this analogy, and design pattern that is represented by the interior design.</p><p>When talking about software architecture, you will most likely be talking about data flow, protocol, the number of servers that will be used, scalability, etc. On the other hand, things that are revolving around design pattern are more related to the problems during the software development itself which should be more low-level and in many cases, would not impact the whole application.</p><h3>Common Software Architecture</h3><h3>MVC Pattern</h3><p>MVC stands for Model-View-Controller, the three this that build the entire application. The three play their own important roles, which are:</p><ol><li><strong>Model</strong> — contains all the necessary data items</li><li><strong>View</strong> — displays the information to the user (more than one view may be defined)</li><li><strong>Controller</strong> — deals with user’s input</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jraD-iM-yPuUYHAQ" /><figcaption>source: <a href="https://developer.mozilla.org/en-US/docs/Glossary/MVC">https://developer.mozilla.org/en-US/docs/Glossary/MVC</a></figcaption></figure><h3>Layered Pattern</h3><p>This pattern can be used to organize programs that can be broken down into groups of subtasks, each with its own degree of abstraction. Each layer provides support to the layer above it.</p><p>The following are the four most frequent tiers of a general information system:</p><ul><li><strong>Presentation layer</strong> (also known as <strong>UI layer</strong>)</li><li><strong>Business logic layer</strong> (also known as <strong>Domain layer</strong>)</li><li><strong>Data access layer</strong> (also known as <strong>Persistence layer</strong>)</li><li><strong>Database layer</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/0*SRlL6uRDjO3HwvqF" /><figcaption>source: <a href="https://www.jianshu.com/p/1241f19905f9">https://www.jianshu.com/p/1241f19905f9</a></figcaption></figure><h3>Client Server Architecture</h3><p>A distributed application structure with two primary components — a client and a server — is described as a client-server architecture pattern. This architecture makes it easier to communicate between a client and a server that may or may not be on the same network. A client requests certain resources from the server, which could include data, content, services, files, and so on. The server recognizes the requests and responds accordingly by sending the requested resources to the client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/0*t1_rNNXNI0P5w-nY" /><figcaption>source: <a href="https://nimesha-dilini.medium.com/simple-introduction-to-client-server-architecture-concept-7d2979bed31d">https://nimesha-dilini.medium.com/simple-introduction-to-client-server-architecture-concept-7d2979bed31d</a></figcaption></figure><h3>Personal Experience</h3><p>In my limited personal experience, there’s not so many software architecture patterns that I have used before. In fact, the majority of those that I have used was determined by the framework I chose to utilize. Django, Laravel, Code Igniter, and Ruby on Rails for instances, which used MVC as their main architecture. However, what framework or library you are using should not have the absolute decision of what architecture you’ll be using. I also have cases where the pattern I use is kind of a mix of several patterns. One of them can be seen here <a href="https://github.com/uasoft-indonesia/badaso-lms-module">https://github.com/uasoft-indonesia/badaso-lms-module</a> <a href="https://github.com/uasoft-indonesia/badaso-ilma-theme">https://github.com/uasoft-indonesia/badaso-ilma-theme</a> where I mainly creating an app with client server architecture, with a separated frontend and backend service where the backend service itself is using Laravel and as mentioned, Laravel is a framework with MVC pattern. So, in my opinion, it is more than possible for an app to use a collection of software architectures.</p><h3>Conclusion</h3><p>Choosing the right software architecture in the beginning of your project in the majority of cases will benefit you in the long run. Not only will it makes the application runs smoother, but also provides your team with the agility over uncertain changes that might occur in the future. Without one clearly defined software architecture, your application probably will still work, but for how long? There are also a myriad of architectures that hasn’t been talked in this article and I strongly recommend you to look for them, especially ones that are being used by the giant tech companies.</p><h3>References:</h3><ul><li><a href="https://nimesha-dilini.medium.com/simple-introduction-to-client-server-architecture-concept-7d2979bed31d">Simple Introduction to Client-Server Architecture Concept</a></li><li><a href="https://www.guru99.com/mvc-tutorial.html">MVC Framework Tutorial for Beginners: What is, Architecture &amp; Example</a></li><li><a href="https://blog.pusher.com/laravel-mvc-use/">How Laravel implements MVC and how to use it effectively</a></li><li><a href="https://www.simform.com/blog/software-architecture-patterns/">10 Software Architecture Patterns You Must Know About</a></li><li><a href="https://medium.com/the-legend/software-arsitektur-dan-design-90f76288078e">Software Arsitektur dan Design</a></li><li><a href="https://towardsdatascience.com/10-common-software-architectural-patterns-in-a-nutshell-a0b47a1e9013">10 Common Software Architectural Patterns in a nutshell</a></li><li><a href="https://martinfowler.com/architecture/">Software Architecture Guide</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b9fdfb55620" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Have You Tested Your Code Correctly?]]></title>
            <link>https://medium.com/@aldi.naufal/have-you-tested-your-code-correctly-72d44b23232?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/72d44b23232</guid>
            <category><![CDATA[end-to-end-testing]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Wed, 11 May 2022 17:02:17 GMT</pubDate>
            <atom:updated>2022-05-11T17:02:17.043Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KqWhEFjJlhOqzX9o" /><figcaption>source: <a href="https://www.360logica.com/blog/use-unit-testing/">https://www.360logica.com/blog/use-unit-testing/</a></figcaption></figure><p>Testing has been an inseparable part of software development. It is because normally, all developers would want to ensure that their application has worked as it should before rolling it into production. However, there are many choices of how to test your code.</p><h3>Manual Testing</h3><p>Manual tests entail traversing your product and determining whether it will function as planned. This is, to some extent, a nice thing to do. This is usually beneficial when the tests only be executed for a small number of times. In some cases, it also cuts the amount of time you usually spend creating automated tests, not to mention if the automated test itself is pretty hard to formulate.</p><h3>Automated Testing</h3><p>Automated tests, on the other hand, speed up your development process and allow you to quickly find flaws, breaking changes, and side effects. How so?</p><p>Save time. Unlike manual tests, automated tests will run much much faster. As we know, computer can normally operate up to 10⁸ operations in a second. As long as we have written down the correct test script, automated test will absolutely beat manual test in terms of performance.</p><p>Self-validated. During each and every manual test, the tester will need to validate whether the behavior is correct or not. This can be super exhausting and prone to human error.</p><p>Integrated to the build workflow. As the technology has become more advanced, we can now integrate our set of tests into the build workflow. Every time we want to release our app, the test will be automatically executed and will only proceed to the next step if all the tests are passed.</p><h3>Different Types of Automated Tests</h3><h3>Unit Tests</h3><p>Unit testing is one of the most well-known techniques of our day. The idea is simple and straightforward. The goal is to isolate the code as much as possible in order to execute a unit test in a simple, quick, and efficient manner.</p><p>What kinds of things can unit tests be used for? It could theoretically be applied to any piece of code, including classes, functions, lines of code, components, and so on. It is actually ill-defined, as Martin Fowler mentioned on his website. There are so many arguments out there on what should be considered as a <em>unit</em>. A single function may be considered a unit in procedural or functional techniques, but object-oriented design treats a class as the unit. But it’s essentially a situational thing. The team defines what constitutes a unit for the purposes of understanding and testing the system.</p><p>When it comes to this debate, there is another thing that people tend to confuse as well. It is about to mock or not to mock. Mocking makes the isolation more real. By mocking dependencies, we assume that all the dependencies of the current unit work as we think. Jay Fields calls this style as Solitary Tests. However, sometimes the dependencies changed and we forgot to modify our mock, and this will lead to an undetected error. That is why, some people still rely on the dependencies as they are, so any breaking changes will notify the developer and prevent it to occur in the production. Those who don’t mock the dependencies are using the Sociable Tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HVIH3p8qSqkn5JhA" /><figcaption>source: <a href="https://martinfowler.com/bliki/UnitTest.html">https://martinfowler.com/bliki/UnitTest.html</a></figcaption></figure><p>As an example, let’s say you have this simple function.</p><pre>public static function greet($firstName, $lastName)<br>{<br>    return &#39;Hello &#39; . $firstName . &#39; &#39; . $lastName&#39;;<br>}</pre><p>Then one of your unit tests would look like:</p><pre>public function testGreetShouldIncludeFirstNameAndLastName()<br>{<br>    $text = greet(&#39;Aldi&#39;, &#39;Fitrah&#39;);<br>    $this-&gt;assertEquals(&#39;Hello Aldi Fitrah&#39;, $text);<br>}</pre><p>If by any chance, someone changed our greet function and modified the return value, then our unit test will raise an error and prevent us from breaking the code.</p><h3>Integration Tests</h3><p>It’s actually pretty similar to unit tests, but it has more complexity. One thing that differs them is dependency. For most cases, we would not like to mock our dependencies in an integration test. As the name denotes, the test will check whether our units are integrated perfectly or not. Mocking the dependencies might lead to a false-positive test because the mocked value might differ from the real one.</p><p>But why do we still need some integration tests if we already have a bunch of unit tests? You may believe that your system is operating flawlessly because you are covering each unit independently. But this is rarely the case. Two components working independently doesn’t mean that they will work together as expected.</p><p>Using the previous example:</p><pre>public static function greet($firstName, $lastName)<br>{<br>    if (!validate($firstName) || !validate($lastName)) {<br>        return null;<br>    }</pre><pre>    return &#39;Hello &#39; . $firstName . &#39; &#39; . $lastName&#39;;<br>}</pre><p>In unit test, some might be tempted to mock the validate method since it’s an external dependency of the greet function. But in integration test, we’ll just keep it right there and do the test without mocking. We can even use the same unit test code as before. Yep, we didn&#39;t add any special syntax, it’s just the same as we used in unit tests. Because it&#39;s testing code that relies on another, it&#39;s simply termed integration.</p><h3>End-to-End Tests</h3><p>End-to-end tests, which include UI and API tests, replicate a specific user interaction flow with your app. The UI tests (clicking, typing text, and so on) run in the browser, but they don’t launch your app. They only require a JavaScript environment (i.e., an empty browser window loaded from the background).</p><p>However, we’ll need a browser that can load our app for end-to-end/UI testing. We also need to be able to utilize code to control that browser (so that we can program certain user interactions and simulate them).</p><p>By including this testing layer in our application, we can ensure that we cover all conceivable human interactions and avoid problems as a result.</p><p>Make sure you don’t mix up end-to-end and integration. Although the goal is to test application flows, we can clearly distinguish one from the other because, unlike integration, they run in the browser from beginning to end.</p><p>The syntax of an end-to-end test is heavily influenced by the framework being utilized. One of the commonly used framework for this kind of test is Cypress.</p><h3>The Right Mixture</h3><p>While working on testing our code, we should not just rely only on one of the unit tests, integration tests, or E2E tests. These 3 elements should be combined and be run at the right moment. The key is to find the right balance between the three. The testing pyramid is the finest visual help for finding the proper balance between all three test kinds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*Dy3SyP-saD6V9B8_" /><figcaption>source: <a href="https://dev.to/betoyanes/unit-vs-integration-vs-e2e-tests-4b2o">https://dev.to/betoyanes/unit-vs-integration-vs-e2e-tests-4b2o</a></figcaption></figure><p>At the bottom of the pyramid, unit tests make up the majority of your tests. Your tests normally get bigger as you travel up the pyramid, but the number of tests (the width of your pyramid) gets smaller. The left and right icons on the pyramid also indicate that the more difficult the tests are, the slower and more expensive they are.</p><p>Google frequently recommends a 70/20/10 split: 70% unit tests, 20% integration tests, and 10% end-to-end tests as a reasonable starting point. Each team’s specific composition will vary, but in general, the pyramid shape should be maintained.</p><h3>Conclusion</h3><p>Regardless of the test we do or how we combine them, the most essential thing is to have confidence and certainty that what we’ve done is safe and fits the functionality’s needs. I myself have also seen a myriad of projects that didn’t contain any tests but still working flawlessly and are able to deliver values to the users.</p><p>However, implementing any form of automated test also has numerous advantages for our project. It not only builds trust, but also serves as a code documentation base, assists us in identifying potential flaws as we write code, and so on. And as a rule of thumb, do keep in mind that our test suite should retain the pyramid shape.</p><h3>References:</h3><ul><li><a href="https://www.atlassian.com/continuous-delivery/software-testing/types-of-software-testing">The different types of testing in software | Atlassian</a></li><li><a href="https://dev.to/betoyanes/unit-vs-integration-vs-e2e-tests-4b2o">Unit vs Integration vs E2E Tests</a></li><li><a href="https://codeahoy.com/2016/07/05/unit-integration-and-end-to-end-tests-finding-the-right-balance/">Unit, Integration and End-To-End Tests - Finding the Right Balance</a></li><li><a href="https://moduscreate.com/blog/an-overview-of-unit-integration-and-e2e-testing/">An Overview of Unit, Integration, and E2E Testing</a></li><li><a href="https://martinfowler.com/bliki/UnitTest.html">bliki: Unit Test</a></li><li><a href="https://www.practitest.com/qa-learningcenter/resources/unit-test-vs-integration-test/">Unit Test Vs Integration Test</a></li><li><a href="https://www.quora.com/What-are-the-differences-between-unit-test-integration-test-and-end-to-end-test-in-automated-testing">What are the differences between unit test, integration test and end to end test in automated testing?</a></li><li><a href="https://lawrey.medium.com/unit-tests-ui-tests-integration-tests-end-to-end-tests-c0d98e0218a6">Unit Tests, UI Tests, Integration Tests &amp; End-To-End Tests</a></li><li><a href="https://www.360logica.com/blog/use-unit-testing/">What is the Use of Unit Testing?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72d44b23232" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intro to Our Whale Bestfriend: Docker]]></title>
            <link>https://medium.com/@aldi.naufal/intro-to-our-whale-bestfriend-docker-4c0afa977c2d?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c0afa977c2d</guid>
            <category><![CDATA[isolation]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[build]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Tue, 10 May 2022 04:05:55 GMT</pubDate>
            <atom:updated>2022-05-10T04:05:55.301Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*DBN11KJ9LJMXdAdX" /><figcaption>source: <a href="https://www.docker.com/">https://www.docker.com/</a></figcaption></figure><h3>What is Docker?</h3><p>Initially invented in 2008 by Kamel Founadi, Solomon Hykes, and Sebastien Pahl, Docker is an open-source software whose function is to pack an application altogether with its dependencies that are needed to run the application. With Docker, your app and dependencies configuration will be melted into the so-called “Image” which then can be instantiated into a “Container” that is ready to run.</p><p>I myself like to imagine this process from Image to Container as when I am installing software on my computer. When you run a software installer, the software itself will be installed on your machine and you can run it effortlessly afterward. You also can uninstall and reinstall it again to get a fresh restart or you can even delete the installer from your computer to save your storage. This concept is pretty similar to Docker, where the software installer is a Docker Image, and the installed software is a Docker Container. You can create a Container from an Image (even multiple Containers from the same Image), run the container, remove it and create it again to get a fresh restart, and many more.</p><h3>Why Docker?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/0*H7YrjuaPW5j9G6Yh" /><figcaption>source: <a href="https://www.reddit.com/r/ProgrammerHumor/comments/cw58z7/it_works_on_my_machine/">https://www.reddit.com/r/ProgrammerHumor/comments/cw58z7/it_works_on_my_machine/</a></figcaption></figure><p>One of the problems Docker has solved is perfectly pictured in the meme above. It has been an issue for quite a long time that an application was working on your machine but was not on the others. So, instead of trying to configure the settings and all the dependencies to match your environment, why don’t we isolate the environment itself and use it for development or even deployment? With Docker Image and Container, this is absolutely achievable.</p><p>By using Docker, we can ensure that the environment that we use to run the app will be the same across all machines. What makes it better is that we are not obliged to install all the dependencies one by one. Imagine if we need a PostgreSQL database, Redis, and Apache Kafka to run our web service. One might spend an entire day just to install all of those and use the correct configuration. With Docker, as long as we listed the required dependencies correctly, Docker will do its magic and get things ready for us.</p><p>Other than that, there is a myriad of benefits of using Docker. Some of them are:</p><ol><li>Multi-Cloud Platform. For the past years, the majority of cloud providers such as Amazon Web Services, Google Cloud Platform, Microsoft Azure and many more have been adopting docker as a containerization platform. Our magical Docker Container can be run in an AWS EC2 instance, GCP Compute Engine, and other cloud providers, effortlessly.</li><li>Consistent and Isolated Environment. Using containers, developers can create predictable environments that are isolated from other apps. Every aspect of the app remains consistent wherever the app is deployed, which means less time spent on debugging, and more time launching new features and functionality for users.</li><li>Cost-effectiveness with Fast Deployment. Containers powered by Docker are notable for cutting deployment time down to seconds. By any measure, that’s a remarkable achievement. Before this, things like provisioning and getting the hardware up and running used to take days or even weeks. You also have a lot of overhead and extra work to deal with. When each process is put into a container, it can be shared with new apps. The deployment process becomes quick, and you’re practically ready to go.</li><li>Repeatability and Automation. You’re writing code that relies on repeatable infrastructure and configuration. This greatly accelerates the development process. It should be noted that Docker images are frequently small. As a result, new application containers are delivered quickly and deployed more quickly. Another benefit is the ease of maintenance. Containerization isolates an application from other apps operating on the same system. In other words, apps do not clash, making application maintenance much simpler. It lends itself to automation; the faster you repeat, the fewer errors you make, and the more time you have to focus on the business or application’s core value.</li><li>Flexibility. If you need to upgrade a product throughout its release cycle, Docker containers make it simple to make the necessary modifications, test them, and deploy new containers. Another significant benefit of Docker is its versatility. Docker makes it possible to create, test, and distribute images that can be deployed across numerous hosts. The procedure remains the same even if a new security patch is available. You can install the patch, test it, and put it into production. Additionally, Docker allows you to quickly start and stop services or apps, which is particularly handy in the cloud.</li></ol><h3>Example</h3><p>Let’s say you already have a simple Node.js express application that has its entry point on app.js file located in the root repository. What you need to do to dockerize your application is by creating a file named Dockerfile that contains the following:</p><pre>FROM node:14<br>WORKDIR /usr/src/app<br>COPY package*.json app.js ./<br>RUN npm install<br>EXPOSE 3000<br>CMD [&quot;node&quot;, &quot;app.js&quot;]</pre><p>What we’ve just created is a script to tell docker about how to build our application. Next, we need to create an image of the app by running the following script:</p><pre>docker build -t examplenode .</pre><p>-t stands for tag, it means that we are tagging our newly built image with the name “examplenode”. Now, you should be able to see the image on the list when running docker image ls .</p><p>After creating the image, now it’s time to run our app inside a container. To do so, run the following command:</p><pre>docker run -p 3000:3000 --name node-app examplenode</pre><p>-p stands for port, which means that we can now access port 3000 of our docker container by accessing port 3000 of our machine. --name should be self-explanatory, we give our container a name to be able to distinguish it easier from other containers. The last argument examplenode is the image name that we based our container on. After a while, you should be able to see that your container is running smoothly and that <a href="http://localhost:3000/">localhost:3000</a> is now accessible as our node.js application.</p><p>Congratulations! Now you have already run an application with the help of docker.</p><p>This article, as the title, is only an introduction to Docker. There are a bunch of concepts that is not covered here ranging from docker-compose to network bridge, and many more.</p><p>After all, docker is not a must-use technology when you are developing software. In fact, people are able to develop rapidly even before docker exists. But with Docker, it is getting easier and enables developers to develop faster. Furthermore, it is already part of our job to keep up with the latest technology, otherwise, we’ll become obsolete and not relevant anymore in the industry.</p><p>References:</p><ul><li><a href="https://hentsu.com/docker-containers-top-7-benefits/">https://hentsu.com/docker-containers-top-7-benefits/</a></li><li><a href="https://www.docker.com/">https://www.docker.com/</a></li><li><a href="https://opensource.com/resources/what-docker">https://opensource.com/resources/what-docker</a></li><li><a href="https://www.freecodecamp.org/news/what-is-docker-used-for-a-docker-container-tutorial-for-beginners/">https://www.freecodecamp.org/news/what-is-docker-used-for-a-docker-container-tutorial-for-beginners/</a></li><li><a href="https://flaviocopes.com/docker-node-container-example/">https://flaviocopes.com/docker-node-container-example/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c0afa977c2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance Testing: With Example Using Locust]]></title>
            <link>https://medium.com/@aldi.naufal/performance-testing-with-example-using-locust-ee623e8fdcb5?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee623e8fdcb5</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[locust]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Sat, 16 Apr 2022 09:11:05 GMT</pubDate>
            <atom:updated>2022-04-16T09:11:05.785Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NqPGu0epVRTnG9xk.jpg" /><figcaption>Source: <a href="https://www.fissionlabs.com/how-to-design-the-right-strategy-for-performance-testing/">https://www.fissionlabs.com/how-to-design-the-right-strategy-for-performance-testing/</a></figcaption></figure><p>As software developers, we obviously want our software to be functional, easy to use, and performant. Each aspect needs different tests to make sure that they are working as expected. For the functionalities, unit, integration, and end-to-end tests are the right tool to use. As long as your tests are not rubbish, the functionalities can almost be guaranteed. For a good user experience, we can utilize usability testing and evaluate the result. And for the performance of the application, performance testing is the one we needed.</p><p>Performance testing is a process that is done under a particular load. Things that are usually being tested in performance testing are the response time, CPU &amp; memory usage, and failure rate. By knowing those, we’ll hopefully be able to identify the bottlenecks in our app and eliminate them.</p><h3><strong>Why Do We Have to Test the Performance?</strong></h3><p>Sometimes, a software failure is caused by some logical error in the code, which is pretty easy to be spotted and most of the time affects only a small part of the app. Some other times, the failure is caused by the unprepared infra or some leakages that make the entire system down. This could cost a lot, especially for companies like Google or Amazon. For example, Google was reported to suffer as much as $545,000 for only a 5-minute downtime in 2013. This kind of downtime could also be escalated to things that are more valuable like lives, if we’re talking about some sort of medical system or a space launch program. Thus, doing performance testing is very crucial.</p><h3><strong>Types of Performance Testing</strong></h3><p>There are many, but I will just mention 3 that I think are the most important.</p><p><strong>Load testing.</strong> Aims to check the application performance given some user loads. This one is the simplest one and can be used to “simulate” your application before it goes live.</p><p><strong>Stress testing.</strong> Instead of giving a specific load to the application, you keep increasing the load until your application breaks. Thus, we know the limit of the application.</p><p><strong>Endurance testing.</strong> Pretty much the same as load testing where we test it with a specific load, but now we test it for a longer time. Usually, this can help us figure out memory leaks or some hidden error that only happens over a long period.</p><h3><strong>When to Do Performance Testing</strong></h3><p>Unlike functionality tests that should be done each time we want to deploy our application to the production environment, performance testing couldn’t be treated the same way. Imagine you have to wait for an additional 30 minutes before the app can finally go live, just to do load testing. That way, the development and deployment process will be slowed down and the value we want to deliver to our customers will also be delayed.</p><p>Instead, this should be done when the application has gone live, so the customers are able to get the newest value first. And ideally, performance testing should be made a routine in the development process, so it’s faster for us to spot any flaws in the application.</p><h3><strong>Where Should It Be Done</strong></h3><p>Some say that the staging environment is the perfect place to do this, as it imitates the production one but still doesn’t interfere with the live application. However, some also argue that the production environment should be the one we test. I personally stand with the former, so if bad things happened during the test, our real users won’t be affected. Doing so also ensures that we won’t disturb the database we use in production, so our data will still be reliable.</p><h3><strong>Performance Testing using Locust</strong></h3><p>Locust is an open-source testing tool built on top of Python. It’s so easy to use given the friendly UI yet very powerful and is able to accommodate most if not all our testing needs.</p><p>To start using locust we need to install it first. Assuming that you already have Python on your machine, then we only need to execute the following command:</p><pre>python -m pip install locustio</pre><p>After that, we can start creating our testing program. I will create the simplest one based on my project.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b36424c93d3285901a0db188dfc607d/href">https://medium.com/media/8b36424c93d3285901a0db188dfc607d/href</a></iframe><p>What it’s declaring there is a task to get my project’s homepage, and each user will do the task within 2 to 5 seconds interval. If you want a more complex logic, then feel free to refer to <a href="https://locust.io/">locust documentation</a>.</p><p>The next step is to run the locust server</p><pre>locust -f sample_locustfile.py</pre><p>If everything is ok, the server will be accessible at http://localhost:8089/.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uzcE6N1czhTujuDt" /></figure><p>The configuration above is the last thing we have to set. It says that I will swarm the given host with 20 new users per second, and stop when there are already 200 active users in the locust server. Keep in mind that it doesn’t mean there eventually will be 200 requests per second, because as we set earlier, each user will have to wait 2–5 seconds to make their next HTTP request.</p><p>After clicking start swarming, locust will then provide us with this kind of chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cOS8kp68XVST2i8E" /><figcaption>Please zoom it to see the details</figcaption></figure><p>Looking at it, we can at least obtain 3 pieces of information such as requests per second, response time, and the number of users. Locust actually provides us with the peak response time and the average response time information after the test has been done. To get information like CPU &amp; memory load, we can use the top command in the machine where we’re running the application in. After the test has been terminated, things to do next is to analyze the chart and identify any possibilities of leakage or bottleneck inside our app.</p><p>All in all, performance testing is the kind of testing used to guarantee that our application work as expected, given a specific load over a period of time. It should be done routinely in the staging environment, even though the production environment could also be a choice (with extra caution of course). One of the best tools (and maybe the easiest one) that we can utilize to do performance testing is locust, as it also provides us the information we need so some analysis can be made and important decisions can be taken.</p><p>References:</p><ul><li><a href="https://locust.io/">Locust.io</a></li><li><a href="https://www.infopulse.com/blog/performance-testing-with-locust">Performance Testing with Locust | Software Testing Tools</a></li><li><a href="https://www.paessler.com/manuals/webserver_stress_tool/whenshouldistartperformancetesting">When Should I Start Performance Testing?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee623e8fdcb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Do We Really Need Personas?]]></title>
            <link>https://medium.com/@aldi.naufal/do-we-really-need-personas-bef3411ba545?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bef3411ba545</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[user-centered-design]]></category>
            <category><![CDATA[personas]]></category>
            <category><![CDATA[product]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Sat, 16 Apr 2022 09:10:52 GMT</pubDate>
            <atom:updated>2022-04-16T09:10:52.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*SlbEb_rxsvfdzVq8BWXtPg.png" /><figcaption>Source: <a href="https://ui4free.com/uikit/user-persona-templates.htm">https://ui4free.com/uikit/user-persona-templates.htm</a></figcaption></figure><p>As one who came from an engineering background, I always take personas for granted. In fact, I leave them to my teammates most of the time, so I can focus on the technical things instead. But keep in mind, there always be some purposes behind creation, and so are personas.</p><p>As I was always told by my lecturer, personas are some characters that are made up to aid a development team so they can know their users better. Thus, if you want your development process to be user-centered, creating personas at the early stage of product development is crucial. By doing so, we should at least know 3 essential things about our target users:</p><ol><li>Their behaviors</li><li>Their motivations and desires</li><li>Their frustrations and pain points</li></ol><p>And by knowing those, we eventually are able to decide the purpose of the product. It is of course to fulfill their desires and diminish their pain points by adjusting to their behaviors.</p><h3><strong>The Advantages</strong></h3><p><strong>Cost-saving.</strong> Oftentimes we unconsciously expanded our product scope to cover some spots that actually were not that impactful, and even worse, were not a part of our users. So instead of experiencing that again in your development process, it’d be better to stick to the created personas and focus on them. Doing so, not only will you save a lot of resources during the development, but perhaps also some resources after the development process.</p><p><strong>Single source of truth.</strong> Along the development process, there must be times when a decision has to be taken. It could be related to the functionalities, some details in the design, whatever. Blindly deciding this kind of thing may affect your final output in a bad way and we absolutely don’t want it to happen. Therefore, we need personas to be our single source of truth, so every argument can then be referred back to our existing personas, not our personal feeling or desire.</p><p><strong>Obtaining insights from different points of view. </strong>It is sometimes easy for us to overlook the fact that others have different problems and think in different ways. Ingraining this fact in our mind will doubtlessly help us, especially when developing a product that will be used by others so we can provide the features they really need and are able to solve their problems.</p><p><strong>Easily onboard new member to the team. </strong>As the product grows and as the time flies, part of your team may also come and go. Anyway, you obviously want to keep your team well-informed of who the user is. Persona is the answer to this, and it’s one of the quickest and most efficient ways to share knowledge with the new member.</p><h3><strong>An Example</strong></h3><p>I’m currently working on an open-source customizable LMS project, that can be found <a href="https://github.com/uasoft-indonesia/badaso-lms-module">here</a>. It is quite easy given the situation now where almost all learning activities are done online and a myriad of LMS is being used out there, yet a bit tricky because the scope must be well-defined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*53w3_wOZO-7jJ5RXwYQMEQ.png" /><figcaption>Source: One of the personas in the project I’m working on</figcaption></figure><p>One of Adela’s pain points is a complex user interface. We took this seriously and did some research regarding it. The development team then tried several LMSs and in the end, we decided to make Google Classroom our benchmark. Compared to other LMS like Moodle and Edmodo, we all agreed that Google Classroom is the most beginner-friendly and the system is very easy to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H0Fhou0iVywTS3aE7B0_gw.png" /><figcaption>Source: Another persona of my project</figcaption></figure><p>Andrew on the other hand has a goal to get the important information from his teacher as soon as possible. Given that target, the first decision we took is to display announcements from teachers on top of the course homepage, sorted from newest to oldest. Hopefully, all course members can grasp the information faster as a result. Additionally, we discussed the possibility of designing a notification system for this specific purpose, but given the complexity of the feature, we have yet to finalize it.</p><p>In summary, personas are almost a necessity, especially when developing a product that will be used by many people. Having them created prior to the product development process is important so the entire team can have their attention focused on them. As a result, the whole process can be truly user-centered and the final outcome will most likely be accepted by the majority of the target users.</p><p>References:</p><ul><li><a href="https://www.linkedin.com/pulse/what-do-prince-charles-ozzy-osborne-have-common-three-holly-steger/">What do Prince Charles and Ozzy Osborne Have in Common? Three Ways to Leverage your Personas</a></li><li><a href="https://www.usability.gov/how-to-and-tools/methods/personas.html">Personas</a></li><li><a href="https://medium.com/@h_locke/do-you-need-personas-for-every-project-b2334e124d29">Do you need personas if you’re doing regular user research?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bef3411ba545" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of Refactoring Based on When to Do It]]></title>
            <link>https://medium.com/@aldi.naufal/types-of-refactoring-based-on-when-to-do-it-ac88ace129b7?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac88ace129b7</guid>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[pair-programming]]></category>
            <category><![CDATA[refactor]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Sat, 09 Apr 2022 15:45:42 GMT</pubDate>
            <atom:updated>2022-04-09T15:45:42.167Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/256/0*-L3hm27g1hMYbnv5" /><figcaption>source: <a href="https://refactoring.guru/refactoring">https://refactoring.guru/refactoring</a></figcaption></figure><p>Refactoring is a term specifically used by developers. So what is it?</p><blockquote>Refactoring is the process of changing a software system in a way that does not alter the external behavior of the code yet improves its internal structure.<br> — Refactoring: Improving the Design of Existing Code Book (2nd Edition)</blockquote><p>Refactoring is done with improved code design, not the other way around. That’s quite odd since some of us might have been taught that we should design first, and only jump to the code when we already got the proper design. But Martin Fowler believes that the initial design only remains for a short time, and will eventually be gradually changed given the growing requirements.</p><p>Therefore, with refactoring, we can take any code regardless of how bad and poorly written or even chaotic the code is, and rework it into a well-structured code. The steps to refactor have also been extensively explained in the refactoring book, and each one is very simple and should be easy to implement. Yet the cumulative tiny changes, as Martin Fowler said, can radically improve the design of our code.</p><p>Saying a code is bad or poorly written may sound pretty harsh. However, we are not in the right shoes to blame the original authors of the code. Oftentimes, it was nicely written, but then the changing needs make things added on the fly and reduce the code quality until one can only curse while looking at the code. One thing to keep in mind is there might always be a certain purpose for why the code was written that way, and it was the best decision back then. So there’s no need to blame someone else.</p><h3>When to Refactor?</h3><p>According to Kent Beck, as I have mentioned in my previous <a href="https://medium.com/@aldi.naufal/tdd-what-was-it-designed-for-f42e0b6e936e">article about TDD</a>, refactoring is one part of the TDDs mantra. It should be done after all the tests have passed and there’s duplication in our codebase. Using this logic, then as long as there’s no duplication, we don’t need to refactor.</p><p>Martin Fowler proposes The Rule of Three which was inspired by Don Roberts:</p><blockquote>The first time you do something, you just do it.<br>The second time you do something similar, you wince at the duplication, but you do the duplicate thing anyway.<br>The third time you do something similar, you refactor.</blockquote><p>It sounds like it has the same principle as Kent Beck proposed, where refactoring should only happen when there’s duplication. However, Martin Fowler also presented several categories of refactoring, and some of them do not follow the said rule.</p><p><strong>Preparatory Refactoring: Making It Easier to Add a Feature.</strong> Imagine you’re obliged to go to a place 10 km away. Instead of directly taking a walk to the place, you can do some little research first, perhaps discovering there is some public transportation you can take to make your move quicker, and then commute faster.</p><p><strong>Comprehension Refactoring: Making Code Easier to Understand.</strong> Usually, when you need to implement a new feature, you also need to understand some lines of code interacting with the one you need to change or add. When looking at those legacy codes, you may need some time to understand them thoroughly, and most of the time there comes the thoughts in your mind, “I think it should be written this way instead”, “why does the function named like this?”, etc. Given that signals, you know that it is time for you to refactor the old codes. Thus, not only is the change applied in your head, but also in the codebase, making it easier for your teammates to understand it in the future.</p><p><strong>Litter-Pickup Refactoring.</strong> Based on the old camping adage that says, “always leave the campsite cleaner than when you found it”. This is quite similar to the previous category, but may require more time to fix. Therefore, sometimes you can fix it immediately, but some other times when you have a startling deadline that is coming closer and closer, the code smell will prolong your tech debt list instead.</p><p><strong>Planned Refactoring.</strong> The 3 previous categories, as you might have realized, are all opportunistic. It happens along the way we’re going to add a new feature to our code. However, some code smells might not be able to be refactored given the limited time. Some also argue that it’s better to allocate dedicated time so they can focus on refactoring things. As this may suit some teams’ conditions, Martin Fowler still doesn’t really agree with the method.</p><p><strong>Long-Term Refactoring.</strong> Some refactoring may require even larger effort, like replacing an existing library with the new one for example. Logically, this kind of change should also be done in a dedicated time, or we can call a planned refactoring. Yet, Mr. Fowler is still reluctant to do so. He strongly believes that a gradual refactoring is better as it gives small values along the process which will be accumulated in the end, rather than working solely to change the library which will take a long time for sure, and only give us the value after all the processes have been done.</p><p><strong>Refactoring in a Code Review.</strong> As pull requests and code reviews are more common nowadays, they could be a great medium where refactoring ideas come from. It allows other developers (that is not the author of the PR) to give many suggestions that the author might have missed before. This kind of refactoring also happened several times in my project, like this one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/0*xnSeO4j5aP3ZaOUO" /><figcaption>source: <a href="https://github.com/uasoft-indonesia/badaso-ilma-theme/pull/62#discussion_r842224872">https://github.com/uasoft-indonesia/badaso-ilma-theme/pull/62#discussion_r842224872</a> (When writing this article, I realized that `isAuthoredByCurrentUser` could be a better name😕)</figcaption></figure><p>After the review, the code has now become pretty much like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f10f9b3b826ce0c1832a58bdf3a174a/href">https://medium.com/media/7f10f9b3b826ce0c1832a58bdf3a174a/href</a></iframe><p>The technique is named Decompose Conditional by Martin Fowler. After refactoring, it is now very clear the v-menu appears only if the current user is the author of whatever wrapping the v-menu.</p><p>The suggestions raised in a code review are pretty good, but most of the time the reviewers don’t get any context of what the author is trying to do. This is why Martin Fowler likes to do a one-on-one session with the author, going through the code, and refactoring it as they go. That way, the author is also freer and can easily explain what he/she is going to achieve using the code. The method then can be upgraded to the pair programming style, where code review is embedded within the process of programming.</p><p>To recap, refactoring is a process where you modify an internal structure without affecting external behavior. It should be done along the way you’re adding new features to the code, specifically when you see something that can be written better so others could understand it quicker. But if a team has decided that they need dedicated time to refactor, then feel free to do so, because each team has a different style and culture.</p><p>References:<br>&gt; Fowler, M., &amp; Beck, K. (2019). <em>Refactoring: Improving the Design of Existing Code</em> (2nd ed.). Addison-Wesley.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac88ace129b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TDD: What Was It Designed For?]]></title>
            <link>https://medium.com/@aldi.naufal/tdd-what-was-it-designed-for-f42e0b6e936e?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f42e0b6e936e</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[unit-testing]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Tue, 22 Mar 2022 13:59:56 GMT</pubDate>
            <atom:updated>2022-03-22T14:02:59.582Z</atom:updated>
            <content:encoded><![CDATA[<p>Posterior to my writing about clean test that can be found <a href="https://medium.com/@aldi.naufal/one-thats-as-important-as-clean-code-clean-test-a7dfd3709495">here</a>, the time now has come for me to talk a bit about TDD. Test-Driven Development was originally developed by Kent Back in the late 1990s as part of the well-known software development method, Extreme Programming. Was developed about twenty years ago, but the powerful concept is still relevant at least until this article is being written.</p><p>So what is TDD about? A must-do method for our projects? One thing that will ensure our code is working as expected? Annoying thing that will ban the existence of the Quality Assurance team from the world?</p><blockquote>Test-Driven Development is a way of managing fear during programming</blockquote><blockquote>— Kent Beck</blockquote><p>That was written as the opening of <strong>Test-Driven Development By Example</strong> book written by Kent Beck. With that being said, the core concept Mr. Beck trying to introduce to us is the ability to manage our anxiety when developing software. The aim is to discourage us from being too careful or afraid to take even the smallest step to cross the river since TDD is there as your stepping stone.</p><h3>The Guide, The Mantra</h3><p>There are mainly 2 things that we are obliged to do when applying TDD. It is to write new code only if we already have a failing automated test, and to eliminate duplications. The rules then cast TDDs mantra, which is Red/Green/Refactor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/0*7RwrVVuap_mblZr9.png" /><figcaption>source: unknown, but I got it from another <a href="https://medium.com/ppl-2019-c3/tdd-pada-team-development-fd64db2525de">medium</a></figcaption></figure><p>Red — write a simple test that obviously will fail, or cannot even be compiled. This will help us to take a baby step every time we want to develop a feature.</p><p>Green — type as less code as possible which just aims to pass the currently failing test.</p><p>Refactor — get rid of the duplication you just made in order to pass the previous test, or in other words, DRY your code.</p><h3>What does it look like when you are implementing TDD?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*YqyIHgAdmiypglAzacfBYg.png" /><figcaption>source: <a href="https://github.com/uasoft-indonesia/badaso-lms-module/pull/19">https://github.com/uasoft-indonesia/badaso-lms-module/pull/19</a></figcaption></figure><p>I am currently working on an extension module of an open-source CMS which is also a part of my study in the uni where my team and I agreed to adopt the TDD style in our development process. As you can see, most if not all of my commits are granular and focused on achieving one thing at a time. The label on each commit makes it even clearer that TDD is being put into practice (I personally prefer more to use conventional commit style though, but since this was the agreement in the team, there’s nothing better than following it). Indeed, refactoring is not a mandatory ritual that comes right after we pass a test. It is only needed when duplication occurs in your codebase.</p><p>However, applying this pattern of commits is not enough to guarantee that one is doing TDD the right way. One may manipulate the commits just so it looks like a TDD pattern. Obviously, it is counterproductive with the initial purpose of TDD, and whoever performing it is just wasting their time (unless there’s another hidden purpose that needs to be fulfilled). And most of the time, it is hard to detect whether one really does TDD or not, because in the end, there would be a similar amount of feature code and test code in the repository. But one senior programmer told me, that an experienced TDD practitioner would be able to distinguish it effortlessly due to the mindset and the approach behind the code.</p><p>The thing that may hold us back from performing TDD is perhaps the confusion of what to test, or maybe the laziness to test everything, even the most trivial code that is very obvious and straightforward. There are so many arguments out there regarding this, and my take on the particular topic is to not blindly follow TDD. Flexibility is a must-have mindset and don’t let the strictness brings you too far away from the main objective of TDD. Remember that it exists to obliterate your fear during programming so you eventually become a lot more productive and are able to produce a good quality code faster. If what happens is the opposite, then there might be something wrong with your practice. Even the originator of TDD, Kent Beck himself does not write tests for things that do not tend to break, as he wrote in <a href="https://stackoverflow.com/a/153565/13276861">this forum</a>.</p><p>To sum up, TDD is an undoubtedly well-developed style that’s still relevant up till now and aimed to be beneficial when adopted in our work. Still and all, it should not be religiously followed so please stop being that obnoxious person that dragoons others to blindly implement it. One thing that is more important is the philosophy behind its creation, which in my opinion, is more essential to be engrained in ourselves.</p><p>References:</p><ul><li><a href="https://martinfowler.com/bliki/TestDrivenDevelopment.html">https://martinfowler.com/bliki/TestDrivenDevelopment.html</a></li><li>Beck, K. (2002). <em>Test-Driven Development By Example</em>. Three Rivers Institute.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f42e0b6e936e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One That’s As Important As Clean Code: Clean Test]]></title>
            <link>https://medium.com/@aldi.naufal/one-thats-as-important-as-clean-code-clean-test-a7dfd3709495?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7dfd3709495</guid>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[clean-test]]></category>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[clean-code]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Mon, 21 Mar 2022 18:42:53 GMT</pubDate>
            <atom:updated>2022-03-21T18:42:53.626Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*g4l5Kmv9z-GL3SunzLdRVw.png" /><figcaption>source: <a href="https://www.behance.net/gallery/53068979/clean-code-icon">https://www.behance.net/gallery/53068979/clean-code-icon</a></figcaption></figure><h3>Clean Code</h3><p>Ever since before Robert Cecil Martin, or we may call him “Uncle Bob” published his stunning masterpiece titled <strong>“Clean Code: A Handbook of Agile Software Craftsmanship”</strong>, the term clean code had already become massively popular and been referenced in almost every software project. After the release, the book itself has already become such the Bible for programmers, where most if not all of our codes will most likely be justified based on that “holy” book.</p><blockquote>Code is clean if it can be understood easily — by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility, and maintainability.</blockquote><blockquote>— Wojtek Lukaszuk</blockquote><p>As a beginner in the programming world, one would not really care about the code quality he/she wrote, because understanding the logic itself might have gobbled up a large amount of brainpower and therefore nothing much left to think about the cleanliness of the code. It is not totally wrong considering the scope of a beginner project, but it will eventually become a serious issue as the scope grows. Consistently writing a bad code is like forming a snowball towards our work which will grow exponentially and one day will crush all our effort on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D4J4-a7rUVTVFDMA" /><figcaption>source: <a href="https://campcamp.fandom.com/wiki/Campfire_Tales">https://campcamp.fandom.com/wiki/Campfire_Tales</a></figcaption></figure><p>No, it was not just a spooky tale that we usually tell kids in a campfire. Uncle Bob himself wrote that there was a successful company which was selling an app that was vastly used by lots of professionals in the late 80s. Everything went well until the release cycle began to slow down, bugs were not fixed, the load time took longer than ever, and crashes were inexorable. The company then went to bankruptcy and it was confirmed by the former engineer there that they had rushed their way to deliver the product, and had injected a huge amount of messy code in the process. As time goes by, more features were added and so were low-quality code, to the extent that they were not maintainable anymore. “<em>It was the bad code that brought the company down</em>”, wrote Uncle Bob.</p><p>However, writing a good quality code for the features is not the only thing that is necessary for a big software development project. Our speed will in the end become slower if clean code is only applied in our production code, as we will run into the situation where changes need to be done but we are very afraid to do so due to a lack of guarantee that it will not break any other parts of the code. In this case, unit test is here to save the day.</p><h3>Clean Test</h3><p>In the Clean Code book, Uncle Bob allocated one chapter on this topic. He mentioned one of his experience in coaching a team that enabled quick and dirty code in their tests. This led to several severe issues that hindered their performance. Dirty test code is just the same with dirty production code, they are hard to change. But as the wise man said,</p><blockquote>Uncertainty is the only certainty there is, and knowing how to live with insecurity is the only security.</blockquote><blockquote>— John Allen Paulos</blockquote><p>Therefore, as the team modify the production code, numerous old tests begin to fail and it is extremely hard to alter them to pass again. As a result, majority of the developers blamed the messy and hard to change tests when their managers questioned about the prolonged estimation. “<em>Test code is just as important as production code. It is not a second-class citizen</em>” was Uncle Bob’s take from the story. He strongly believes that unit test is the one that gives flexibility, maintainability, reusability, and so many other -ilities that in the end and the most important, will obliterate our fear of making changes to the code.</p><p>So what makes our tests clean? 3 things, as written in the book, which are readability, readability, and readability. These 3 things themselves came from clarity, simplicity, and the density of expression. This also implies that standard rules like indentation and meaningful names for variables &amp; functions also apply to our tests. The following codeblocks will show you an example of a messy and a clean test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/0*vnfOUPeRu2gYfYbb" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*m_mhCWHvvKJV7E-q" /><figcaption>source: <a href="https://github.com/uasoft-indonesia/badaso-lms-module/blob/staging/tests/Feature/CourseApiTest.php#L14-L19">https://github.com/uasoft-indonesia/badaso-lms-module/blob/staging/tests/Feature/CourseApiTest.php#L14-L19</a></figcaption></figure><p>I personally like to follow the Given-When-Then convention which is highly encouraged when writing test, not only on the body, but also in the test name. I use the pattern test&lt;FuntionOrBehaviorName&gt;&lt;Condition&gt;Expect&lt;Result&gt; for the test function name. Even though it may end up in a so long name, it won’t be a problem since no other part of our codes will call the function. On the other hand, this makes the readers understand what the test is all about without even reading the whole function body and this way, test report will also be more readable.</p><p>Another concept that you may want to apply to your test culture is One Assert per Test. It may seem too verbose and repetitive, but the advantage can be clearly seen when applied continuously where each tests has one and only one assertion and readers won’t have to think twice of what scenario is being tested in a particular test. Yet, I found myself on the same boat as Uncle Bob, where he agreed on this principle as a good guideline, but cannot be blindly followed for the rest of our lives.</p><p>Instead of One Assert, I support the one suggested by Uncle Bob, that is Single Concept per Test. It is pretty similar with One Assert per Test, but we are more encouraged not to be afraid to add more assertion as long as it still lies in the same concept we are testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/0*-08GRHdoUg9Ee9Du" /><figcaption>source: <a href="https://github.com/uasoft-indonesia/badaso-lms-module/blob/staging/tests/Feature/CourseApiTest.php#L36-L78">https://github.com/uasoft-indonesia/badaso-lms-module/blob/staging/tests/Feature/CourseApiTest.php#L36-L78</a></figcaption></figure><p>The example above hopefully is able to show what I meant by single concept per test. I have several assertions there in one test function, but all of them is part of one same objective.</p><h3>F.I.R.S.T.</h3><p>Last thing I want to address regarding to the clean test is the F.I.R.S.T. principle. It said that clean tests should comply the following rules:</p><p><strong>Fast</strong>. It should run quickly so you’re not afraid to run them frequently and able to spot mistakes swiftly.</p><p><strong>Independent</strong>. No matter how the order is, each test should result in the same outcome because they don’t depend on each other. This also means that one can run a particular test separately and still getting the same result.</p><p><strong>Repeatable</strong>. We most likely have several environments while developing our projects. A good test should be executed and give the same output regardless of where we are running the test.</p><p><strong>Self-Validating</strong>. Verdict of a test should be in boolean. It is either the test passed or failed. One should not need to read through a long logs just to find out whether the test crashed or not.</p><p><strong>Timely</strong>. As the TDD technique suggested, tests should be written just before the production code to ensure that there’s no excuse such as the production code is too hard to test.</p><p>To summarize my quite long writing, clean code is decidedly important in a software development process as it prevents the bad quality code to creep in and trigger a time bomb. Nevertheless, it won’t grant us the power to make changes in our code without anxiety, but clean tests will. It will guard you from breaking the existing production code so you have no worries even when deconstructing the most complicated logic in the legacy code. For that reason, do start your consistent test culture and do not treat tests as a second-class citizen. Quoting from Uncle Bob’s conclusion in the same chapter, “<em>If you let the tests rot, then your code will rot too. Keep your tests clean.</em>”</p><p>References:<br>- Martin, R. (2008). Clean Code. Prentice Hall.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7dfd3709495" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Brief About Waterfall, Agile, & Scrum]]></title>
            <link>https://medium.com/@aldi.naufal/a-brief-about-waterfall-agile-scrum-4ea6fd7939c9?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ea6fd7939c9</guid>
            <category><![CDATA[waterfall]]></category>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[process]]></category>
            <category><![CDATA[scrum]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Tue, 01 Mar 2022 16:29:25 GMT</pubDate>
            <atom:updated>2022-03-01T16:29:25.955Z</atom:updated>
            <content:encoded><![CDATA[<h3>Waterfall 🌊</h3><p>A long time ago, the majority of software projects were developed using the waterfall approach. This approach upholds a neat plan very much. The team would typically compile all the needs and requirements from users and then run in a long marathon to construct the software all at once. After the gathering process, there would be an “unbreakable vow” to make sure that everyone is on the track and no one can distort the initial target (quite exaggerated, but hopefully you guys are able to get my point).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*OQVUQYAG0qZDdMU9" /><figcaption>Unbreakable Vow</figcaption></figure><p>As a result, the team would not have the ability to shift even a bit for the sake of keeping the product relevant in the market. Their eyes would just be focusing on the initial blueprint and hope that users would be satisfied when the product is released, which is normally only at the very end of the development process.</p><p>While the approach was highly suitable for the past circumstances, it has become less relevant nowadays. The reality contrasts a lot with their hope, given the hyper-competitive market and the “madly” demanding customers. In the real case, what has planned months ago is often not enough to satisfy users, and waterfall is not able to solve this. Businesses then needed a more flexible methodology that is able to deal with this problem.</p><h3>Agile</h3><p>Like all the common things in this world, a great solution comes to solve a problem. It’s the same with Agile, which was born when a group of developers was seeking for alternative for the old process that they saw as complicated, unresponsive, and overly focused on the contract. They genuinely believed that the status quo is not sufficient anymore. The Agile Manifesto then is their solution to the current unreliable method.</p><p>The Agile Manifesto identifies 4 core values and 12 principles that the authors believe should be the guidance of software developers in their work. The 4 values are:</p><ul><li>Individuals and interactions over processes and tools;</li><li>Working software over comprehensive documentation;</li><li>Customer collaboration over contract negotiation; and</li><li>Responding to change over following a plan.</li></ul><p>And the 12 key principles articulated in the Agile Manifesto are:</p><ol><li>Satisfying customers through early and continuous delivery of valuable work.</li><li>Breaking big work down into smaller tasks that can be completed quickly.</li><li>Recognizing that the best work emerges from self-organized teams.</li><li>Providing motivated individuals with the environment and support they need and trusting them to get the job done.</li><li>Creating processes that promote sustainable efforts.</li><li>Maintaining a constant pace for completed work.</li><li>Welcoming changing requirements, even late in a project.</li><li>Assembling the project team and business owners on a daily basis throughout the project.</li><li>Having the team reflect at regular intervals on how to become more effective, then tuning and adjusting behavior accordingly.</li><li>Measuring progress by the amount of completed work.</li><li>Continually seeking excellence.</li><li>Harnessing change for a competitive advantage.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WTGrstq2DY6YLq1s.jpg" /><figcaption>Source: <a href="https://www.jetorbit.com/blog/mengenal-apa-itu-scrum-master-dan-manfaatnya/">Mengenal Apa Itu Scrum Master dan Manfaatnya (jetorbit.com)</a></figcaption></figure><h3>Scrum</h3><p>While Agile Manifesto is only considered as a philosophy, there are several frameworks that implement this in practice. One of them that has been broadly used is scrum.</p><blockquote><em>Scrum is a lightweight framework that helps people, teams and organizations generate value through adaptive solutions for complex problems.</em></blockquote><p>By the definition above, we know that Scrum aims to continuously deliver values using solutions that have the ability to adapt in various situations. Practicing scrum in a software development team targeted the entire team to be agile and able to adapt no matter what. This kind of spirit does align so well with the current situation, and is undoubtedly able to meet the business needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/0*QDApbxYVR_KUltPW" /><figcaption>Source: <a href="https://twitter.com/henrikkniberg/status/691932339354599425">https://twitter.com/henrikkniberg/status/691932339354599425</a></figcaption></figure><p>By using the waterfall methodology, we tend to put our business at risk, because what users needed 4 months ago probably has changed and it happened frequently in this era. On the contrary, Scrum does offer us a much better approach, which allows the team to ship a ready-to-use software repeatedly and gradually. This way, not only programmers be more productive, but also the product team will be able to gather early feedback from users which then can be used to determine the next step that has to be taken for the upcoming development process.</p><p>All in all, the software development process has evolved to match the team and business needs throughout the years. The usage of waterfall which was widely used back then has been slowly decreasing, followed by the massive adoption of Agile that most people think is beneficial for them. After all, there is no such thing as the silver bullet that could solve all the problems we have. With that being said, waterfall is not absolutely obsolete and scrum may be not needed for your particular project. One has to carefully choose the most suitable methodology that is able to fulfill their needs and will bring the best out of them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ea6fd7939c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Merge Request in Git: Brand New Culture in the 21st Century]]></title>
            <link>https://medium.com/@aldi.naufal/merge-request-in-git-brand-new-culture-in-the-21st-century-2c6385270f55?source=rss-1b2e970d256e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c6385270f55</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Aldi Naufal Fitrah]]></dc:creator>
            <pubDate>Tue, 01 Mar 2022 04:50:13 GMT</pubDate>
            <atom:updated>2022-03-01T04:50:13.536Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2jgWdBsOChGCJjGf.jpg" /></figure><p>Git is a version control system that currently is being widely used by the majority of programmers across the globe. Since it was created back then in 2005 by the creator of Linux, Linus Torvalds, it now has become an unseparated part of almost every programmer (and even non-programmer) in their daily life.</p><p>Prior to Git, there was so many other version control system that engineers have used before the era of git. Starting from SCCS which is almost 50 years old now, to Perforce which was highly leveraged by Google (or perhaps they still use it), until BitKeeper that Linus Torvalds himself used in the early development of Linux Kernel (The story of him leaving BitKeeper is very interesting, I suggest you read the full story!). Whatever the reason Torvalds stopped using BitKeeper, I personally as a programmer am very grateful for his decision, because it brought us to Git.</p><p>What makes git very special is the UI on top of it, which is very popular now and supported by at least 2 well-known platforms, GitHub and GitLab. This kind of idea makes Git even more approachable to everyone. Consequently, it also shapes the way we develop, release, and maintain our software.</p><p>The one I will talk about in this writing is merge request (or pull request if you use GitHub). Technically, a merge request is a request from a particular branch to another branch in the same repository. Normally, people create this merge request to the main branch like master (or main), staging, develop, etc depending on which workflow you use or your organization has agreed upon.</p><p>The merge request feature usually contains a description, a list of commits, CI/CD pipeline information, and code changes. Even though it may vary depending on which platform you use, those 4 data are the essentials and most likely will be looked at first when someone reviews a merge request. In GitHub and GitLab, you can also add the assignee, some labels, and reviewers of a merge request.</p><p>For the description section, a good merge request should contain the purpose of the merge request, what changes it will bring, and sometimes several screenshots regarding the changes (screenshot of changed payload, or interface). In my prior workplace, we also need to attach a link to the API contract if the merge request will affect the current API contract.</p><p>After looking at the description, we usually will take a look at the list of commits one created. This will show the history of the creation of the merge request. Additionally, it also provides you the information on how one did the process, including the behavior used during the development. For instance, if the business logic code was committed first prior to the tests, then it was absolutely not following the TDD (Test Driven Development) principle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*tRybqimftaN_UrKq4m_ZYg.png" /><figcaption>Source: A pull request from uasoft-indonesia/badaso-lms-theme repository</figcaption></figure><p>The next section is the CI/CD pipeline status. This is actually optional, because not all projects have set their CI/CD pipeline up. But having it neatly set in your project is totally beneficial, especially when creating a merge request. The script will run automatically and as code reviewers, we do not have the need to review your code in the first place if the CI/CD pipeline has not passed yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*qGcB1sFbksuaTr4-7mFY0A.png" /><figcaption>Source: A pull request from uasoft-indonesia/badaso-lms-theme repository</figcaption></figure><p>The last mandatory part of a merge request is the code changes. This shows us a crystal clear difference between the old and the new proposed code. Through this feature, the code review process usually takes place. The interface is very intuitive and beginner-friendly. To add a comment, we just need to click the blue button with the + icon on the line we want to comment, type your review, and click add a single comment to immediately notify the merge requester, or start a review to send your review in bulk. Again, it may vary depending on your favorite platform, but the flow is pretty much the same.</p><p>The code review process could be as simple as asking the merge requester to remove a comment, add some whitespace, or format the code using tools like prettier. On the other hand, it could be a very long discussion like this one <a href="https://github.com/django/django/pull/14437">Fixed #33012 — Added Redis cache backend. by abbasidaniyal · Pull Request #14437 · django/django (github.com)</a>. Either one is really useful in maintaining the code quality of a repository, and hopefully, also aids the merge requester to build a better programming habit.</p><p>To summarise, the emergence of Git supported by the creation of several user-friendly online repositories such as GitHub and GitLab has tremendously helped us in developing software and speed the development process up. These online repositories came with numerous features that were able to shape some disruptive cultures in the software construction process, which is undoubtedly advantageous for all, starting from individual programmers, a small team, to the extent of enterprise organization. These cultures not only will be lucrative for the organization, but doubtlessly, for the programmers themselves.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c6385270f55" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>