<?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 Ali Karaca on Medium]]></title>
        <description><![CDATA[Stories by Ali Karaca on Medium]]></description>
        <link>https://medium.com/@alikrc?source=rss-f3b3dab062fe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DQEhKBWTPr2GwVHxDY4Mxg.jpeg</url>
            <title>Stories by Ali Karaca on Medium</title>
            <link>https://medium.com/@alikrc?source=rss-f3b3dab062fe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 11:48:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alikrc/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[Building CatGPT: A Vue 3 and Vuetify Guide for Cat Image Lovers]]></title>
            <link>https://medium.com/multinetinventiv/building-catgpt-a-vue-3-and-vuetify-guide-for-cat-image-lovers-7af89f88f567?source=rss-f3b3dab062fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/7af89f88f567</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[english]]></category>
            <category><![CDATA[vuetify]]></category>
            <category><![CDATA[vue]]></category>
            <dc:creator><![CDATA[Ali Karaca]]></dc:creator>
            <pubDate>Fri, 24 May 2024 11:11:37 GMT</pubDate>
            <atom:updated>2025-01-09T18:27:33.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*eArRkbJyDKyI11oKxbNaQw.jpeg" /></figure><p>Calling all cat-loving developers! Unleash your passion for felines and hone your Vue.js skills with CatGPT, a project designed to bring joy to cat enthusiasts and coders alike. This guide delves into the step-by-step process of building your own CatGPT application, complete with code examples and insights for a robust development experience.</p><p>This guide will take you through the process of building your own CatGPT application. Here is a sneak peak.</p><p>Live demo: <a href="https://cat-gpt-nu.vercel.app/">https://cat-gpt-nu.vercel.app/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HEbst0KxjH0KTJ1h9QfdHA.png" /></figure><p>But before move on, want to see the code behind the purrfection? Check out the CatGPT project on GitHub and don&#39;t forget to give it a star ⭐!</p><p><a href="https://github.com/alikrc/CatGPT">GitHub - alikrc/CatGPT: Love cats and Vue 3? This interactive project lets you search for adorable cat images using the power of Vue 3 and Vuetify! Explore different breeds and categories with a user-friendly interface built with Material Design principles.</a></p><h4><strong>1. Project Scaffolding: A Speedy Foundation</strong></h4><p>Let’s leverage the power of Node Package Manager (npm) to establish a solid base for your project. npm offers pre-configured templates to jumpstart development, saving you valuable time. Here’s the command to initiate the magic:</p><pre>npm create vuetify@latest</pre><p>This command instructs npm to create a new Vue project using the latest version of the Vuetify template. Vuetify, a fantastic Material Design component framework, streamlines UI development by providing pre-built components for buttons, cards, text fields, and more, all adhering to the Material Design principles.</p><h4><strong>2. Project Structure: A Roadmap for Success</strong></h4><p>The newly created project boasts a well-organized structure, serving as a roadmap for your development journey. Key folders include:</p><ul><li><strong>src</strong>: This folder houses the heart of your application, containing components, views, and the core logic.</li><li><strong>public</strong>: This folder stores static assets like images and fonts used throughout your application.</li><li><strong>node_modules</strong>: This automatically generated folder by npm holds all the external dependencies your project relies on, such as Vuetify itself.</li></ul><h4><strong>3. Hello, Vuetify! Building a User-Friendly Interface</strong></h4><p>With the project structure established, it’s time to explore Vuetify’s capabilities. This framework empowers you to create a user-friendly interface for your CatGPT application. Imagine constructing beautiful and functional elements like:</p><p><strong>a. Random Cat Button:</strong></p><pre>&lt;template&gt;<br>  &lt;v-container&gt;<br>    &lt;v-row align=&quot;center&quot;&gt;<br>      &lt;v-text-field<br>        v-model=&quot;searchQuery&quot;<br>        label=&quot;Search Breeds&quot;<br>        clearable<br>        @click:prepend=&quot;toggleBreeds&quot;<br>      /&gt;<br><br>      &lt;v-col cols=&quot;4&quot;&gt;<br>        &lt;v-row&gt;<br>          &lt;v-col cols=&quot;2&quot; offset=&quot;4&quot;&gt;<br>            &lt;v-icon<br>              :icon=&quot;includeBreeds ? &#39;mdi-paw&#39; : &#39;mdi-paw-off&#39;&quot;<br>              @click=&quot;toggleBreeds&quot;<br>            &gt;&lt;/v-icon&gt;<br>          &lt;/v-col&gt;<br>          &lt;v-col cols=&quot;6&quot;&gt;<br>            &lt;v-btn @click=&quot;getRandomCats&quot;&gt;Random 😺&lt;/v-btn&gt;<br>          &lt;/v-col&gt;<br>        &lt;/v-row&gt;<br>      &lt;/v-col&gt;<br>    &lt;/v-row&gt;<br>  &lt;/v-container&gt;<br>&lt;/template&gt;<br><br>&lt;script setup&gt;<br>import { ref } from &quot;vue&quot;;<br>import api from &quot;@/api/service&quot;;<br><br>let includeBreeds = ref(true);<br><br>async function getRandomCats() {<br>  let response = await api.getRandomCatImage(includeBreeds.value);<br>  // Update your UI with the retrieved cat image URL(s) from the response<br>}<br><br>function toggleBreeds() {<br>  includeBreeds.value = !includeBreeds.value;<br>}<br><br>&lt;/script&gt;</pre><p>This code snippet demonstrates the creation of a random cat button with Vuetify&#39;s v-btn component. The includeBreeds variable, managed using ref, allows users to toggle including breeds with the random cat image. Clicking the paw icon (v-icon) or the &quot;Search Breeds&quot; label triggers the toggleBreeds function.</p><p><strong>b. Breed Search:</strong></p><p>This search bar allows users to search for specific cat breeds. Here’s how it interacts with your code:</p><pre>&lt;template&gt;<br>  &lt;v-container&gt;<br>    &lt;v-row align=&quot;center&quot;&gt;<br>      &lt;v-text-field<br>        v-model=&quot;searchQuery&quot;<br>        label=&quot;Search Breeds&quot;<br>        clearable<br>        @click:prepend=&quot;toggleBreeds&quot;<br>      /&gt;<br>    &lt;/v-row&gt;<br>  &lt;/v-container&gt;<br>&lt;/template&gt;<br>&lt;script setup&gt;<br>const searchQuery = ref(&quot;&quot;);<br>watch(searchQuery, (v) =&gt; {<br>  // Implement logic to handle search query changes (e.g., debounce, trigger search)<br>});<br>async function fetchCats(searchQuery) {<br>  let response = await api.searchBreeds(searchQuery);<br> // Update UI<br>}<br>&lt;/script&gt;</pre><p><strong>c. Displaying Feline Data:</strong></p><pre>&lt;template&gt;<br>  &lt;v-row&gt;<br>    &lt;v-col v-for=&quot;data in datas&quot; :key=&quot;data.id&quot; cols=&quot;12&quot; md=&quot;4&quot;&gt;<br>      &lt;v-card&gt;<br>        &lt;v-img :src=&quot;data.url&quot; height=&quot;200px&quot;&gt;&lt;/v-img&gt;<br><br>        &lt;v-card-title&gt;{{ data.title }}&lt;/v-card-title&gt;<br><br>        &lt;v-card-subtitle&gt;{{ data.subtitle }}&lt;/v-card-subtitle&gt;<br><br>        &lt;v-text&gt;{{ data.description }}&lt;/v-text&gt;<br>      &lt;/v-card&gt;<br>    &lt;/v-col&gt;<br>  &lt;/v-row&gt;<br>&lt;/template&gt;</pre><p>This code snippet showcases how to display retrieved cat information using Vuetify’s v-card components. It iterates through the datas array (which you&#39;ll need to populate from your API calls) and displays each cat&#39;s details using Vuetify&#39;s components like v-img, v-card-title, v-card-subtitle, and v-text.</p><h4><strong>4. Fetching Feline Data: Powering CatGPT with APIs</strong></h4><p>To populate CatGPT with cat information and captivating images, we’ll leverage external APIs. Popular choices include The Cat API (<a href="https://thecatapi.com/">https://thecatapi.com/</a>) and Catster (<a href="https://www.catster.com/">https://www.catster.com/</a>), offering rich datasets about various cat breeds. These APIs act as gateways to data repositories, allowing your application to retrieve details like breed names, origins, descriptions, and of course, adorable cat photos.</p><p><strong>Code Example: Fetching Feline Data (service.ts)</strong></p><pre>import axios from &quot;axios&quot;;<br>const baseUrl = &quot;https://api.thecatapi.com/v1&quot;;<br>const apiKey = process.env.API_KEY; // Replace with your actual API key OR put your key in a .env file in this format, API_KEY=&quot;...&quot;<br>async function getRandomCatImage(includeBreeds = false): Promise&lt;string&gt; {<br>  try {<br>    const response = await axios.get(`${baseUrl}/images/search`, {<br>      headers: {<br>        &quot;x-api-key&quot;: apiKey,<br>      },<br>      params: {<br>        size: &quot;small&quot;,<br>        limit: 2,<br>        has_breeds: includeBreeds,<br>        include_breeds: true,<br>      },<br>    });<br>    return response.data;<br>  } catch (error) {<br>    console.error(&quot;API Error:&quot;, error);<br>    throw error;<br>  }<br>}<br>async function searchBreeds(query): Promise&lt;string&gt; {<br>  try {<br>    const response = await axios.get(<br>      `${baseUrl}/breeds/search?q=${query}&amp;attach_image=1`,<br>      {<br>        headers: {<br>          &quot;x-api-key&quot;: apiKey,<br>        },<br>        params: {<br>          attach_image: 1,<br>        },<br>      }<br>    );<br>    return response.data;<br>  } catch (error) {<br>    console.error(&quot;API Error:&quot;, error);<br>    throw error;<br>  }<br>}<br>export default {<br>  getRandomCatImage,<br>  searchBreeds,<br>};</pre><p>This code snippet showcases the service.ts file, which handles communication with The Cat API. It defines two functions:</p><ul><li><strong>getRandomCatImage</strong>: Fetches a random cat image, optionally including breed information.</li><li><strong>searchBreeds</strong>: Searches for cat breeds based on a user query and retrieves representative images.</li></ul><h4><strong>5. Beyond the Basics: Unleashing Your Creativity</strong></h4><p>This guide offers a solid foundation for building your CatGPT application. With Vuetify by your side and a dash of creativity, you can expand upon these functionalities. Here are some potential enhancements:</p><ul><li><strong>User Accounts:</strong> Allow users to create accounts and curate their favorite breeds, fostering a personalized cat lover experience.</li><li><strong>Interactive Games:</strong> Integrate interactive games featuring cats, like trivia or quizzes, to engage users and add an extra layer of fun.</li><li><strong>Advanced Cat Facts:</strong> Implement features that display interesting facts about specific breeds, further enriching the user experience.</li></ul><p><strong>Embrace the Journey:</strong></p><p>Remember, the provided code on GitHub (<a href="https://github.com/alikrc/CatGPT">https://github.com/alikrc/CatGPT</a>) serves as a valuable starting point.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7af89f88f567" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multinetinventiv/building-catgpt-a-vue-3-and-vuetify-guide-for-cat-image-lovers-7af89f88f567">Building CatGPT: A Vue 3 and Vuetify Guide for Cat Image Lovers</a> was originally published in <a href="https://medium.com/multinetinventiv">inventiv</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Uncovering the Scent of Code: Understanding and Eliminating Code Smells]]></title>
            <link>https://medium.com/multinetinventiv/uncovering-the-scent-of-code-understanding-and-eliminating-code-smells-a3e620b1abae?source=rss-f3b3dab062fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3e620b1abae</guid>
            <category><![CDATA[code-smells]]></category>
            <category><![CDATA[english]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[refactoring]]></category>
            <dc:creator><![CDATA[Ali Karaca]]></dc:creator>
            <pubDate>Fri, 29 Sep 2023 12:10:19 GMT</pubDate>
            <atom:updated>2023-10-26T06:49:57.449Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*svb9DE9S5_mnMSvCGuXp6w.jpeg" /><figcaption>plague doctor from 17th century</figcaption></figure><p>In the world of software development, code is the driving force behind functionality, user experiences, and innovation. Code is like a recipe that tells the computer what to do. But just like not all recipes turn out tasty, not all code is perfect. Some code can be a bit, “smelly”.</p><p>Imagine you have a favorite dish, like pizza. If you add too many toppings, it becomes messy and hard to eat. In the same way, when people write code, they can make it messy and hard to understand. This messiness is what we call “code smells.”</p><h3>What are Code Smells?</h3><p>Code smells are like warning signs in your code. They don’t mean there’s a bug, but they suggest that something might be wrong or messy. Think of them as little red flags that developers should pay attention to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/234/1*nISq58MIhl_agiJwE8wnmw.png" /><figcaption>if it’s “working” don’t fix it</figcaption></figure><p>Code smells can be caused by a variety of factors, such as:</p><ul><li>Lack of experience or knowledge on the part of the developer</li><li>Time pressure</li><li>Rushing to meet a deadline</li><li>Changing requirements</li><li>Legacy code that has not been refactored</li></ul><h3>Why Do Code Smells Matter?</h3><p>Code smells might not seem like a big deal, but they can cause several problems:</p><h4>Increased development costs:</h4><p>It takes longer to develop new features and fix bugs.</p><h4>Reduced code quality:</h4><p>Makes code more prone to errors and security vulnerabilities.</p><h4>Increased technical debt:</h4><p>Code smells are a form of technical debt, which is the cost of fixing or changing poorly designed code in the future.</p><h4>Reduced developer productivity:</h4><p>It is more difficult for developers to understand and work with code, which can reduce their productivity.</p><h3>Common Code Smells</h3><p>Code smells come in various flavors, each signaling a different issue within the codebase. Some of the most common code smells include:</p><h4><strong>1. Long Methods/Functions:</strong></h4><p>Code smells often start with excessively long methods or functions. These make code hard to read and understand. Break them down into smaller, more focused units.</p><h4><strong>2. Large Classes/Modules:</strong></h4><p>Just as with methods, large classes or modules can be problematic. They often try to do too much. Split them into smaller, more manageable parts.</p><h4>3. Duplicated Code:</h4><p>Copy-pasting code is a telltale sign of a code smell. Duplication can lead to inconsistencies and make maintenance, a nightmare. Extract common functionality into functions or classes.</p><h4>4. Conditional Complexity:</h4><p>Excessive nested conditions and loops can make code hard to follow. Simplify complex conditionals by using techniques like the Strategy or State pattern.</p><h4>5. Inconsistent Naming:</h4><p>Meaningful and consistent variable and function names are essential for readability. Inconsistent naming can lead to confusion. Ensure your code adheres to a consistent naming convention.</p><h4><strong>6. Magic numbers/strings:</strong></h4><p>Magic numbers/strings are hard-coded values that are not explained in the code. This can make the code more difficult to understand and maintain, and it can also lead to errors if the values are changed.</p><h4>7. Primitive Obsession:</h4><p>Relying too heavily on primitive data types instead of creating custom types can lead to code that is hard to read and understand. By encapsulating related data and behaviors into well-defined classes, code becomes more expressive and maintainable.</p><h4>8. Shotgun Surgery:</h4><p>This smell occurs when making a small change requires modifying multiple unrelated parts of the codebase. Properly segregating responsibilities and ensuring code follows the Single Responsibility Principle can help avoid this smell.</p><h4>9. Data Clumps:</h4><p>When two or more pieces of data, such as variables or fields, are frequently used together in various parts of your code. These data elements are logically related or represent some meaningful concept together. By encapsulating related data into a single structure, you can improve code organization, reduce redundancy, and enhance the maintainability and readability of your code.</p><h4>10. Feature Envy:</h4><p>This happens when a method in one class excessively uses the data or behavior of another class. It indicates that a method is more interested in the features of another class than its own, suggesting a potential design flaw. Moving the method or behavior to the class that holds the relevant data can improve code organization and encapsulation.</p><h4>11. <strong>Inappropriate Intimacy:</strong></h4><p>When one class uses/depends on the internal fields and methods of another class excessively or inappropriately, which can cause maintenance and extensibility issues as changes in one class may have a significant impact on the other class.</p><p><strong>Difference between Inappropriate Intimacy and Feature Envy:</strong></p><p><strong>Inappropriate intimacy</strong> occurs when two classes are too tightly coupled. This means that one class has too much knowledge of the other class’s internal implementation. For example, one class might directly access the private fields or methods of another class.</p><p><strong>Feature envy</strong> occurs when a method in one class uses more features of another class than it does of its own. This can make the code difficult to understand, because it is not clear which class is responsible for what. For example, a method in one class calls three methods on another class and only one method on itself.</p><h3>Detecting and Eliminating Code Smells</h3><p>Detecting code smells requires experience and a keen eye, but several tools and techniques can assist you in the process:</p><h4>1. Code Review:</h4><p>Regular code reviews with your team can help identify code smells early in the development process. Peer reviews provide different perspectives on the code, which can reveal issues that might go unnoticed otherwise.</p><h4>2. Static Analysis Tools:</h4><p>There are numerous static analysis tools available that can automatically detect code smells in your codebase. Tools like ESLint, Checkstyle, and SonarQube can be integrated into your development workflow.</p><h4>3. Refactoring:</h4><p>Refactoring is the process of restructuring code to eliminate code smells while preserving functionality. Techniques like extracting methods, splitting classes, replacing primitives with objects, applying SOLID principles and removing duplication can help improve code quality.</p><h4>4. Coding Standards:</h4><p>Enforce coding standards and conventions within your development team. Consistent coding practices make it easier to spot and eliminate code smells.</p><h4>5. Education:</h4><p>Invest in the continuous education of your development team. Knowledgeable developers are more likely to write clean, maintainable code from the outset.</p><h3>Conclusion</h3><p>In conclusion, code smells are like warning signs in the world of software. They tell us when code might be messy or hard to work with. By understanding what they are and how to clean them up, developers can create better and more reliable software, just like a chef can make a delicious meal with a clean and organized kitchen.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3e620b1abae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multinetinventiv/uncovering-the-scent-of-code-understanding-and-eliminating-code-smells-a3e620b1abae">Uncovering the Scent of Code: Understanding and Eliminating Code Smells</a> was originally published in <a href="https://medium.com/multinetinventiv">inventiv</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the State Design Pattern: Simplifying State Management in Software Development]]></title>
            <link>https://medium.com/multinetinventiv/understanding-the-state-design-pattern-simplifying-state-management-in-software-development-17594a23232f?source=rss-f3b3dab062fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/17594a23232f</guid>
            <category><![CDATA[english]]></category>
            <category><![CDATA[state-design-pattern]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ali Karaca]]></dc:creator>
            <pubDate>Tue, 23 May 2023 11:16:48 GMT</pubDate>
            <atom:updated>2023-05-25T13:17:12.137Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*FNFLA7tqgaw84vNtzYDHGg.png" /></figure><h3><strong>Introduction</strong></h3><p>In the realm of software development, creating flexible and maintainable code is a top priority. One proven technique to achieve this is through the effective use of design patterns. One such pattern, the State pattern, empowers developers to manage complex state-dependent behaviors with ease. In this blog post, we’ll dive into the State pattern, exploring its key concepts, benefits, and practical implementation examples.</p><p>TLDR; visit implementation:</p><p><a href="https://github.com/alikrc/StateDesignPattern">GitHub - alikrc/StateDesignPattern</a></p><h3>The problem</h3><p>The State pattern solves the problem of changing behavior of an object based on its internal state. It allows an object to have multiple different behaviors depending on its current state, and makes it easier to add new states or modify existing ones without affecting the behavior of other states or the context in which the object is used. The state pattern can be particularly useful when the behavior of an object is complex, has several possible states, or involves a large number of conditionals.</p><h3>Understanding the State Design Pattern</h3><p>The State pattern is a behavioral design pattern that allows an object to alter its behavior when its internal state changes. It encapsulates each state within a separate class, providing a clean and modular approach to handle complex branching logic. The State pattern adheres to the Open-Closed Principle, promoting extensibility by allowing new states to be added without modifying existing code.</p><h4>Key Elements of the State Pattern</h4><ol><li><strong>Context:</strong> The context represents the object whose behavior changes based on different states. It contains a reference to the current state object and delegates the state-specific behavior to that object.</li><li><strong>State: </strong>The state interface defines a common set of methods that encapsulate the behavior associated with a particular state. Each state class implements this interface to provide its own unique behavior.</li><li><strong>Concrete States: </strong>Concrete state classes represent different states and implement the behavior defined by the state interface. These classes encapsulate the logic specific to a given state.</li></ol><h4><strong>Benefits of Using the State Pattern</strong></h4><ol><li><strong>Modularity and Maintainability:</strong> By encapsulating state-specific behavior within separate classes, the State pattern promotes modular code structure. Adding or modifying states becomes simpler, leading to increased maintainability and code reuse.</li><li><strong>Simplified Conditional Logic: </strong>The State pattern eliminates complex, nested conditional statements by encapsulating state transitions and behaviors. This results in cleaner and more readable code, making it easier to understand and debug.</li><li><strong>Scalability: </strong>With the State pattern, introducing new states does not require modifying existing code. This extensibility allows developers to scale the application effortlessly, accommodating future changes and requirements.</li><li><strong>Testing and Debugging: </strong>The separation of concerns in the State pattern facilitates unit testing and debugging. Each state can be independently tested, ensuring that specific behaviors and transitions are working as intended.</li></ol><h4>When to Use the State Design Pattern</h4><ol><li><strong>Dynamic Behavior Based on State:</strong> The State pattern is ideal when an object’s behavior needs to change dynamically depending on its internal state. Instead of using numerous conditional statements to handle different states, the pattern encapsulates each state and its behavior in separate classes, simplifying code management and promoting cleaner, more readable code.</li><li><strong>Complex State-Dependent Logic:</strong> If your application involves intricate state-dependent logic, such as complex workflows or behavior variations based on different states, the State pattern can be a valuable tool. It helps break down the complex logic into smaller, more manageable pieces by encapsulating each state’s behavior, resulting in more maintainable and understandable code.</li><li><strong>Easy State Transitioning:</strong> When your application requires seamless state transitions, the State pattern shines. It allows objects to transition from one state to another without relying on cumbersome conditional statements. The pattern manages the state transitions internally, reducing code complexity and making it easier to introduce new states or modify existing ones.</li><li><strong>Code Reusability and Extensibility:</strong> The State pattern promotes code reusability and extensibility. By encapsulating state-specific behavior in separate classes, you can reuse these state classes in different contexts or even in other projects. Additionally, adding new states becomes straightforward, as you can introduce new state classes without modifying the existing codebase.</li><li><strong>Testability:</strong> The State pattern enhances the testability of your code. With each state encapsulated in its own class, it becomes easier to write focused unit tests that validate the behavior of individual states. This isolation helps identify and fix issues specific to each state, leading to more robust and reliable code.</li></ol><h4>Bonus: Relationship With the Strategy Pattern</h4><p>The State pattern and the Strategy pattern share similarities in terms of encapsulating behaviors into separate classes. However, they differ in their intent and context of application. The Strategy pattern focuses on interchangeable algorithms or strategies, allowing objects to dynamically select and use different strategies. On the other hand, the State pattern is used to manage an object’s behavior based on its internal state, allowing it to switch between states and adapt its behavior accordingly. While the Strategy pattern enables dynamic algorithm selection, the State pattern facilitates behavior variation and state transitions.</p><h3>Conclusion</h3><p>The State pattern is a powerful tool in a developer’s arsenal, offering a clean and flexible approach to managing complex state-dependent behaviors. By encapsulating states within separate classes and allowing for easy state transitions, the State pattern enhances modularity, maintainability, and scalability of the codebase.</p><p>When faced with a software design challenge involving state-dependent behavior, consider leveraging the State pattern to create elegant and adaptable solutions. Embracing design patterns like the State pattern empowers developers to build robust and extensible applications that can evolve with changing requirements.</p><p>Thank you for reading. For implementation of the pattern please visit and star if you like:</p><p><a href="https://github.com/alikrc/StateDesignPattern">GitHub - alikrc/StateDesignPattern</a></p><h4>References</h4><p>Head First Design Patterns, 2nd Edition<br>Design Patterns in C#: A Hands-on Guide with Real-World Examples<br>Design Patterns Using C# and .NET Core<br>refactoring guru<br>Wikipedia</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17594a23232f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multinetinventiv/understanding-the-state-design-pattern-simplifying-state-management-in-software-development-17594a23232f">Understanding the State Design Pattern: Simplifying State Management in Software Development</a> was originally published in <a href="https://medium.com/multinetinventiv">inventiv</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Build and Release Pipeline in Azure DevOps]]></title>
            <link>https://medium.com/multinetinventiv/creating-build-and-release-pipeline-in-azure-devops-6d80180a2cd0?source=rss-f3b3dab062fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d80180a2cd0</guid>
            <category><![CDATA[english]]></category>
            <category><![CDATA[releases]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[azure-devops-pipeline]]></category>
            <dc:creator><![CDATA[Ali Karaca]]></dc:creator>
            <pubDate>Wed, 13 Oct 2021 06:17:15 GMT</pubDate>
            <atom:updated>2021-10-13T06:17:15.713Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ysJX4XkD8klNviWQ" /></figure><h3>Introduction</h3><p>Azure Pipelines automatically builds and tests code projects to make them available to others. Azure Pipelines combine continuous integration (CI) and continuous delivery (CD) to test and build your code and ship it to any target. You can accomplish this by defining a pipeline. You build pipelines by using a GUI editor in Classic Editor or you build pipelines as code with YAML. You define a <em>build pipeline</em> to build and test your code, and then to publish artifacts. You also define a <em>release </em>to consume and deploy those artifacts to deployment targets.</p><p>With the help of this guide, one will be able to set up build and release pipelines with Classic Editor on Azure DevOps. The image below shows the overall workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*t009ht-EhLdt7qp9JNYryg.png" /></figure><p>A self-hosted windows agent is used in this article. Agent and Deployment servers are different machines. These machines are on the same network and the agent can control the server remotely. If self-hosted windows agent will be used, Azure Pipelines Agent windows service user credentials must be provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*PJ5eRmmG10wiefOrbvHqQw.png" /></figure><h3>Steps of Creating Build Pipeline</h3><p>Several version control systems can be used such as Git or Subversion. GitHub is used in this project.</p><p>Classic editor is preferred to build the pipeline. Build can also be configured with YAML.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*SYfP-2oCn47K-cGY0KEPog.png" /></figure><p>Repository and branch are selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*iSXF7aDPQh8OhkvgHuMgig.png" /></figure><p>Build template is selected according to the development stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*NcSC17Y21R1EWWgzsQc-qA.png" /></figure><p>To build code or deploy software using Azure Pipelines at least one agent is needed. In this article self-hosted agent is used, however other agents can be picked from the agent pool.</p><p>The build process is split into tasks regarding the build steps. In this example, tasks are used for restoring NuGet packages, building solution, assembly tests and publishing the artifact. Other task templates can be found on Azure Marketplace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*any6sma5G9DfXEOgEcWLQQ.png" /></figure><p>Click Save &amp; Run to run the pipeline and build the project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*YadvVyR4TxuCEkOzCjyAZQ.png" /></figure><p>This page is used to view pipelines and output details of previous runs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*4UsoUZcM81U787HVUHg0EQ.png" /></figure><h3>Steps of Creating Release</h3><p>Release Pipeline is employed for automating the deployment. In this project, we start by downloading the artifact file generated by the build pipeline. Then we divided the pipeline into two stages, which are Backup and Deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*SKJc2hHnY6_fn7-bybV9Ug.png" /></figure><p>The backup stage consists of 2 tasks, archiving the source and creating a transient backup of the last version. These tasks are explained below.</p><p>The deployment stage consists of 2 jobs:</p><p>Deployment job:</p><ul><li>File transform for replacing config values from Azure Library,</li><li>IIS utilities to stop site,</li><li>IIS utilities to stop pool,</li><li>Delete files for clear application root for artifact files,</li><li>Extract files for extracting artifact file,</li><li>IIS utilities to start pool,</li><li>IIS utilities to start site,</li><li>Rest call to check if site is alive</li></ul><p>Rollback job:</p><ul><li>IIS utilities to stop site,</li><li>IIS utilities to stop pool,</li><li>Delete files task to clear application root for backup files,</li><li>IIS utilities to start pool,</li><li>IIS utilities to start site,</li><li>Rest call to check if the site is alive,</li><li>First new release pipeline is created.</li></ul><h4>Creating Release Pipeline</h4><p>Navigate to “Releases &gt; New &gt; New release pipeline”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*B6YDUkqE_a20SNTtvELHHg.png" /></figure><p>In order to create a custom template, click Empty Job.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*ooq0YN77m7cjmfLmQTUVvw.png" /></figure><p>An artifact is selected for deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*2rHro47AlK9QAVe5etGFRA.png" /></figure><p>In this project build is selected as source type. Different version control systems can be used if the need arises. Source alias is renamed to be used in other tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*bwqjN3-CI5248yZT_9Vysw.png" /></figure><p>In this step stages are customized and populated with tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Vw0U4PGxucz2v1YE7YzalA.png" /></figure><h4><strong>Backup Stage and Tasks</strong></h4><p>In this project first stage is renamed Backup Stage. Inside Agent job, artifact and pool settings are setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*4KLT0QFHbB17OXsxC3Vr-Q.png" /></figure><p>Since this agent won’t use any artifact, artifact download option can be disabled via unselecting artifact</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*SnvmJ__gx8WydzBhQfBilw.png" /></figure><ul><li><strong>Archive Files Task:</strong></li></ul><p>Click add a task to agent job, then search “archive” and select Archive Files task from Microsoft</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*UZ7RpsvvrqKHNJ29tPz09A.png" /></figure><p>Change values according to screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Krh2ONp447zMC3LjrVRQ9g.png" /></figure><p>Define appRemoteSourcePath and appRemoteSourceBackupFileName deployment release variables. For example:</p><p>appRemoteSourcePath : \\192.168.33.334\\c$\inetpub\wwwroot\HelloAzurePipelines</p><p>appRemoteSourceBackupFileName: \\192.168.33.334\\c$\Backup\HelloAzurePipelines\$[format(‘{0:yyyyMMddHHmm}’, pipeline.startTime)].zip</p><ul><li><strong>Copy Files Task:</strong></li></ul><p>Click add a task to agent job, then search “copy files” and select Copy Files task from Microsoft</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*ZDhCS-AwCyOm4FwA34EtDQ.png" /></figure><p>This task is conducted so that rollbacks can be done in case of failure. The latest stable source code is backed up in Latest folder.</p><p>Source Folder: $(appRemoteSourcePath)</p><p>Target Folder: $(appRemoteSourceBackupLatest)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*0J5JJnPQExU3c6j22BwGFw.png" /></figure><p>These radio buttons are checked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*E3wJvk5BhowxMefvtmXWsA.png" /></figure><p>Define “appRemoteSourceBackupLatest” as release variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*054TyrXfbMx8bAgqv8LqNQ.png" /></figure><p>Click Pipeline in menu to return to the pipeline overview. Now we will add deployment stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*DSJKdACK7buLaerBo6_oJg.png" /></figure><h4><strong>Deployment Stage and Tasks</strong></h4><p>Add a new stage with empty job. Rename it to “Deployment Stage”. This time artifact download will be needed, make sure all artifacts are selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*-P2N2x-t0532EFrpk5lV9Q.png" /></figure><ul><li><strong>Replace Variables from Library Task:</strong></li></ul><p>Add file transform task rename it to Replace Variables from Library Task:</p><p>This task is performing variable substitution. It can also perform xml transformation. Xml transformation is not used in this project. This task can also be utilized by carrying the transform settings in *.csproj to here. Variables in *.config files are replaced by the variables in library with matching keys/names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Rh8i-Xgsv1o9BYPJqoqqsQ.png" /></figure><p>Pipeline variables are specific to that pipeline. Variable groups are created in the library and used by linking variable groups to pipelines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*9hA6J4E4e-190Me963pr5Q.png" /></figure><p>When adding new variable to variable groups, stage can be specified or release can be picked for general pipeline usage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*RVGLuEQmXse3hGKeT_kj9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*Izln6vjclH3K4upcJhMdAQ.png" /></figure><p>In this project configuration variables are moved to “Pipeline -&gt; Library -&gt; Variable group”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*HS81EYKWmRRdKx5a8qXXKg.png" /></figure><ul><li><strong>IIS Website Stop Task:</strong></li></ul><p>Add IIS Utilities task</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*O4qQDSyS6rNg_vsCoXcbSQ.png" /></figure><p>From pipeline variables define:</p><p>“serverComputerName” with Deploy machine computer name as value. Also “iisWebsiteName” and “iisAppPoolName” should be declared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*uOl6uNapVspZgI4iAtLOsA.png" /></figure><p>Select scopes as deployment stage</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/279/1*ZhsO24vIZegKkUl9mCu9UA.png" /></figure><ul><li><strong>IIS Application Pool Stop Task:</strong></li></ul><p>Same steps, only change task name and Action</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*wCfq7k_xakY3ILEiJRjMcw.png" /></figure><ul><li><strong>Delete Everything Except Content Task:</strong></li></ul><p>For keeping the Content folder “**” and “!Content/**” are added to Contents field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*F2u0hPPnpEgAhW12Sr0hcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/1*TKzUzTXDKW5jw9SONdQpag.png" /></figure><ul><li><strong>Extract Artifact to App Path:</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*XjYUXArvY5cYLtbjUJL8Mg.png" /></figure><p>Destination folder: $(appRemoteSourcePath)</p><ul><li><strong>IIS Application Pool Start and IIS Website Start:</strong></li></ul><p>Clone IIS Website Stop and IIS App pool Stop and replace actions to start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*iY4PtknQOynu8swocxy1yA.png" /></figure><ul><li><strong>Is App Alive Test:</strong></li></ul><p>Add a Rest Call task and add a webservice endpoint which should be pinged for liveness test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*uGgd4-Q5_RYOMgbLPkwesg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*bC3enAtsFPxJXC9BbKQCLw.png" /></figure><p><strong>Rollback Jobs:</strong></p><p>IIS Website Stop, IIS Application Pool Stop, Delete everything except Content, IIS Website Start, Is App Alive Test are all same tasks. The only different task is: “Copy From Latest Backup”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*0fe1PQGbGwj-oyUbAUAWVQ.png" /></figure><h3><strong>Conclusion</strong></h3><p>To sum up, Azure Pipelines offer rich features to design and automate integration and deployment processes. We have given end to end examples for you to utilize Azure pipelines in your projects. You can use this article while building your CI/CD pipelines on Azure as a guide.</p><p>Have automated days…</p><p><em>Special thanks to </em><a href="https://medium.com/u/7a3d9aa46923">İncilay Dikbıyık</a>, <a href="https://medium.com/u/ff45619d3c9c">Evren Pehlivan</a> <em>and </em><a href="https://medium.com/u/e1a15795b5d6"><em>Fatih Akgöz</em></a><em> for their contributions in the preparation of this article.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d80180a2cd0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/multinetinventiv/creating-build-and-release-pipeline-in-azure-devops-6d80180a2cd0">Creating Build and Release Pipeline in Azure DevOps</a> was originally published in <a href="https://medium.com/multinetinventiv">inventiv</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>