<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Volodymyr</title>
    <description>The latest articles on Forem by Volodymyr (@vlad_sha).</description>
    <link>https://forem.com/vlad_sha</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1231781%2F34b2872d-214f-48c0-a4cc-1ac13a111ec1.jpeg</url>
      <title>Forem: Volodymyr</title>
      <link>https://forem.com/vlad_sha</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vlad_sha"/>
    <language>en</language>
    <item>
      <title>It's time to talk about DRY</title>
      <dc:creator>Volodymyr</dc:creator>
      <pubDate>Sun, 17 Dec 2023 19:01:32 +0000</pubDate>
      <link>https://forem.com/vlad_sha/its-time-to-talk-about-dry-2h69</link>
      <guid>https://forem.com/vlad_sha/its-time-to-talk-about-dry-2h69</guid>
      <description>&lt;p&gt;This is a pattern that is one of the main practices in programming and system design. Its essence lies in minimizing the repetition of information and code, which helps to increase readability, maintainability, and scalability of software.&lt;/p&gt;

&lt;p&gt;The main aspects of this principle:&lt;/p&gt;

&lt;p&gt;Don't repeat code: When you write programs, avoid having the same lines of code repeated in different parts of the program. This means you should not copy or write the same code over and over again. Instead, create this code once and use it wherever needed.&lt;/p&gt;

&lt;p&gt;Group code: To make your code more organized and easier to manage, consider grouping similar operations and functions in one part of the code. For example, if you have several places where you need to do the same things, create a function that performs these actions and use it as many times as needed.&lt;/p&gt;

&lt;p&gt;Use functions and libraries: If other programmers have created useful pieces of code or libraries, you can use them in your programs. Instead of reinventing the wheel, you can use ready-made solutions that already exist. This will save you time and make your work more efficient.&lt;/p&gt;

&lt;p&gt;Reducing complexity: By adhering to the DRY principle, you create less code that needs maintenance and bug fixing. This makes your program less complex and less prone to errors.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Test-driven Development or TDD</title>
      <dc:creator>Volodymyr</dc:creator>
      <pubDate>Sat, 16 Dec 2023 14:24:53 +0000</pubDate>
      <link>https://forem.com/vlad_sha/test-driven-development-or-tdd-4ke8</link>
      <guid>https://forem.com/vlad_sha/test-driven-development-or-tdd-4ke8</guid>
      <description>&lt;p&gt;Let's talk about testing.&lt;/p&gt;

&lt;p&gt;At which stage is it best to write tests?&lt;/p&gt;

&lt;p&gt;Generally, there are three approaches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tests are written after the code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tests are written alongside the code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tests are written before the code&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In some situations, there aren't many options. For example, in system testing, tests mimic user behavior and perform actions in a browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Such tests are written after the code.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For lower-level tests, integration tests, and unit tests, one of the above options is usually available. The "write tests after the code" approach is one of the least user-friendly methods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The process of writing code itself implies constant running of the code and checking that it works. For the simplest tasks, like educational ones, this running happens quite quickly.&lt;/p&gt;

&lt;p&gt;It's easy to execute and easy to verify the correctness of the results.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;capitalize('hello'); // Hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In real code, preparing data to test the code's functionality can take a lot of time, minutes, or even tens of minutes.&lt;/p&gt;

&lt;p&gt;On the other hand, the result of the code being tested can be something complex, like a large number of records in a database or the output of a particular complex structure.&lt;/p&gt;

&lt;p&gt;Then each code run for testing becomes an entire adventure.&lt;/p&gt;

&lt;p&gt;It's difficult to prepare the data. It's difficult to check the work's result.&lt;/p&gt;

&lt;p&gt;For example: Loading goods from 1C into a database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;loadGoodsFrom1c();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where the "write tests before code" option comes into play. For many beginner developers, this phrase confuses. How can you write tests before the code is written? It turns out, you can and it's even pleasant.&lt;/p&gt;

&lt;p&gt;Suppose we want to write a function that can repeat a given string a specified number of times:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;repeat('$', 3); // $$$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We know what it takes as input, we know what its output should be.&lt;/p&gt;

&lt;p&gt;Can we write tests now?&lt;/p&gt;

&lt;p&gt;Of course!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;test('repeat', () =&amp;gt; expect(repeat('$', 3)).toBe('$$$') )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How long does it take for an experienced developer to write such a test? I think about 15 seconds, which is exactly how long it took me to write the code above. But now, to check the functionality of this code, all you need to do is type the command jest in the console.&lt;/p&gt;

&lt;p&gt;Testing before writing code has another powerful advantage. It forces the programmer to first think about the design of their solution, and how it will be used, rather than how beautifully they can implement it internally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Well-designed interfaces are the key to success.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the development world, the approach where tests are written before the code is called Test-Driven Development (TDD).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TDD&lt;/strong&gt;&lt;br&gt;
Nowadays, everyone continues to talk about this method. In it, tests are written for all parts of the code with maximum detail. This type of TDD, while emphasizing the importance of design, focuses on specific functions and classes of the application, instead of the whole picture.&lt;/p&gt;

&lt;p&gt;But there is also another TDD, where tests on the internal parts are almost never written.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>6 reasons why a project needs documentation</title>
      <dc:creator>Volodymyr</dc:creator>
      <pubDate>Fri, 15 Dec 2023 10:58:15 +0000</pubDate>
      <link>https://forem.com/vlad_sha/6-reasons-why-a-project-needs-documentation-3obi</link>
      <guid>https://forem.com/vlad_sha/6-reasons-why-a-project-needs-documentation-3obi</guid>
      <description>&lt;p&gt;&lt;strong&gt;Explanation and Clarification&lt;/strong&gt;: Code comments help clarify complex code sections, ensuring a better understanding of the algorithms and logic used. This is especially important in the case of complex operations or non-obvious decisions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ease of Maintenance and Expansion&lt;/strong&gt;: Quality documentation and comments make the code more accessible to other developers, facilitating easier maintenance and expansion of the codebase. This reduces the time needed for new team members to learn the code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reducing the Likelihood of Errors&lt;/strong&gt;: A clear understanding of what each part of the code does can help avoid mistakes during modifications or adding new features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enhancing Collaboration Efficiency&lt;/strong&gt;: In large teams, where many developers work on the same project, well-documented code helps prevent misunderstandings and ensures more efficient collaboration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standardization and Consistency&lt;/strong&gt;: Documentation can include coding standards and practices that ensure consistency throughout the codebase, making it more readable and easier to understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enhancing Quality for End-User Experience&lt;/strong&gt;: Good documentation can include user instructions, FAQs, and troubleshooting recommendations, enhancing the overall user experience.&lt;/p&gt;

&lt;p&gt;In conclusion, documentation and code commenting assist in the maintenance and development of software and provide a better understanding and efficiency in teamwork.&lt;/p&gt;

</description>
      <category>learning</category>
      <category>performance</category>
      <category>backend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why Naming in Development is Important</title>
      <dc:creator>Volodymyr</dc:creator>
      <pubDate>Thu, 14 Dec 2023 10:52:01 +0000</pubDate>
      <link>https://forem.com/vlad_sha/why-naming-in-development-is-important-6ne</link>
      <guid>https://forem.com/vlad_sha/why-naming-in-development-is-important-6ne</guid>
      <description>&lt;h2&gt;
  
  
  Naming entities in web development is crucial for several reasons:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Code Readability and Understandability&lt;/strong&gt;: Clear and descriptive names for variables, functions, classes, etc., make it easier for others and yourself to understand the code. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bad naming
let x = 10;

// Good naming
let userAge = 10;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Maintenance and Refactoring&lt;/strong&gt;: Well-organized code with meaningful names simplifies maintenance and refactoring. For instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Bad naming
function doSomething(data) { /* ... */ }

// Good naming
function calculateTotalPrice(order) { /* ... */ }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Teamwork&lt;/strong&gt;: Consistent naming is key for smooth collaboration in large projects. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Inconsistent
let user_data;
function getUser() { /* ... */ }

// Consistent (using camelCase)
let userData;
function getUser() { /* ... */ }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Project Scalability&lt;/strong&gt;: Logical and organized names simplify adding new features. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Non-descriptive
function handleData() { /* ... */ }

// Descriptive
function processUserInput() { /* ... */ }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  For effective naming in web development, follow these rules:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Descriptiveness&lt;/strong&gt;: Names should reflect the entity's purpose. For instance, use fetchUserData() instead of just getData().&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consistency&lt;/strong&gt;: Use a consistent naming style. In JavaScript, camelCase is commonly used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Brevity but Clarity&lt;/strong&gt;: Names should be short yet informative. Avoid long names that are hard to read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Avoiding General Names&lt;/strong&gt;: Avoid vague terms like data or info. Use specific names that indicate their purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Standard Conventions&lt;/strong&gt;: Follow the conventions of your programming language. JavaScript typically uses camelCase for variables and functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Avoiding Abbreviations and Acronyms&lt;/strong&gt;: Except for well-known abbreviations, avoid obscure acronyms to prevent confusion.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Popular Style Guides for Web Development</title>
      <dc:creator>Volodymyr</dc:creator>
      <pubDate>Wed, 13 Dec 2023 14:37:30 +0000</pubDate>
      <link>https://forem.com/vlad_sha/popular-style-guides-for-web-development-1nip</link>
      <guid>https://forem.com/vlad_sha/popular-style-guides-for-web-development-1nip</guid>
      <description>&lt;p&gt;Using a style guide for coding can make you a better developer, as it fosters the development of several key skills:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readability and Maintainability&lt;/strong&gt;: You will learn to write code that is easy to read and maintain by other developers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Attention to Detail&lt;/strong&gt;: Following a style guide requires attention to detail, which is an important quality in programming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Teamwork&lt;/strong&gt;: You will be able to work more effectively in a team, as your code will be aligned with the standards accepted in the team.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Professionalism&lt;/strong&gt;: A style guide reflects professional standards in coding, which improves the quality of your work and contributes to your professional growth.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;List of popular style guides for web development:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://google.github.io/styleguide/"&gt;&lt;strong&gt;Google Style Guides&lt;/strong&gt;&lt;/a&gt;: &lt;br&gt;
This resource includes style guides for various programming languages, including JavaScript, TypeScript, HTML/CSS. They are used for Google projects and can be useful for forming consistency in code. Google Style Guides.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/airbnb/javascript"&gt;&lt;strong&gt;Airbnb JavaScript Style Guide&lt;/strong&gt;&lt;/a&gt;: &lt;br&gt;
One of the most famous style guides for JavaScript. It contains detailed recommendations for writing readable and consistent JavaScript code. Airbnb JavaScript Style Guide.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://standardjs.com/"&gt;&lt;strong&gt;StandardJS&lt;/strong&gt;&lt;/a&gt;:&lt;br&gt;
This is a style guide for JavaScript, which also includes configuration for automatic code formatting. It offers established rules that simplify the code-writing process, requiring no settings. StandardJS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/"&gt;&lt;strong&gt;MDN Web Docs&lt;/strong&gt;&lt;/a&gt;:&lt;br&gt;
Although not a formal style guide, MDN Web Docs provides useful tips and best practices for HTML, CSS, and JavaScript. This is a great source for developers who want to adhere to best practices. MDN Web Docs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://basarat.gitbook.io/typescript/styleguide"&gt;&lt;strong&gt;TypeScript Style Guide and Coding Conventions&lt;/strong&gt;&lt;/a&gt;:&lt;br&gt;
As TypeScript is a superset of JavaScript, many JavaScript style guides can be applied to TypeScript. However, for specific features of TypeScript, this guide can be used. TypeScript Style Guide and Coding Conventions.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>A library or your own code</title>
      <dc:creator>Volodymyr</dc:creator>
      <pubDate>Tue, 12 Dec 2023 13:50:14 +0000</pubDate>
      <link>https://forem.com/vlad_sha/a-library-or-your-own-code-3760</link>
      <guid>https://forem.com/vlad_sha/a-library-or-your-own-code-3760</guid>
      <description>&lt;p&gt;Have you ever connected &lt;a href="https://lodash.com/"&gt;lodash&lt;/a&gt;, or any other library, using a single function from it? Wouldn't it be easier to write that function myself, especially if I solved this problem on vanilla JS?&lt;/p&gt;

&lt;p&gt;First of all, if you are looking for one, there is no definite answer to this question. In each case, you need to take into account many factors, starting with the nature of the code and ending with the launch conditions, i.e. where and how the program is launched. We will talk about this later.&lt;/p&gt;

&lt;p&gt;On the one hand, the size of the code is almost irrelevant. Plus or minus a megabyte, or even ten megabytes, doesn't solve anything at all. Modern software has enormous resources, the weight of which is much larger than the size of any library. Even so, a library with simple functionality takes up a lot of space.&lt;/p&gt;

&lt;p&gt;On the front end, everything is a bit more complicated, but now it all comes down to how the library is organized. If the export is properly configured, the final version (for example, built by a webpack) will contain only those functions that are used. And this is very little.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Dependencies:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some developers minimize the number of dependencies (third-party libraries) in their code. Small functions are no longer enough here, complex projects can have their solutions with many ready-made tools.&lt;/p&gt;

&lt;p&gt;There's not much to say here. Dependencies are good if they save developer time and allow you to spend more time on application logic than infrastructure tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the advantages?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not all libraries are equally useful. There are often several basic problems that are poorly implemented in the programming language itself. These include working with collections, working with dates and times. In addition, various more specific parts need to be extended. In these cases, the library must be added as a dependency even for a single function.&lt;/p&gt;

&lt;p&gt;As a rule, where one function is needed, another soon becomes necessary. Without realizing it, one person will write one function, another will write it elsewhere, and there is no certainty that they are aware of each other's already written solutions. &lt;/p&gt;

&lt;p&gt;This situation quickly turns from "too early" to "too late" when there are many functions in the code available in each library. &lt;/p&gt;

&lt;p&gt;Moreover, when programmers move to other projects, the same thing happens there. As a result, standard functions scattered across different projects, written by different people, contain bugs, lack documentation, and are usually poorly or not tested at all.&lt;/p&gt;

&lt;p&gt;Your code will not be as thoroughly tested and documented as in popular libraries. Try opening lodash and see how extensive the documentation is. This is another advantage of such libraries. Since the library is so widely used and standardized, most developers know how to work with it. &lt;/p&gt;

&lt;p&gt;This means the project code will be more understandable for everyone who works with it.&lt;/p&gt;

&lt;p&gt;There is another interesting but not obvious advantage of using such libraries.&lt;/p&gt;

&lt;p&gt;Libraries contain many functions that are difficult to understand on their own. By using these libraries, developers can increase their level of knowledge and learn how to solve most standard problems with a minimum amount of code and correct abstractions. &lt;/p&gt;

&lt;p&gt;Of course, these functions need to be reviewed periodically. Students regularly reinvent the wheel because they don't know about standard solutions. In addition, when we say that only one function is needed, it turns out that there are actually several, and the developer may simply not be aware of them.&lt;/p&gt;

&lt;p&gt;For other rare libraries, the situation is more complicated and it's not always clear whether to pull with the library. The key to making such a decision is realism, not completeness.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
