<?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: evolving_dev</title>
    <description>The latest articles on Forem by evolving_dev (@evolving_dev).</description>
    <link>https://forem.com/evolving_dev</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%2F1114407%2F49ef8176-fb73-4b19-a8f4-b94abc9a9405.png</url>
      <title>Forem: evolving_dev</title>
      <link>https://forem.com/evolving_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/evolving_dev"/>
    <language>en</language>
    <item>
      <title>The Baseline Approach: A Game-Changer for Legacy Code</title>
      <dc:creator>evolving_dev</dc:creator>
      <pubDate>Wed, 29 Nov 2023 16:35:45 +0000</pubDate>
      <link>https://forem.com/evolving_dev/the-baseline-approach-a-game-changer-for-legacy-code-3i36</link>
      <guid>https://forem.com/evolving_dev/the-baseline-approach-a-game-changer-for-legacy-code-3i36</guid>
      <description>&lt;p&gt;In the world of software development, starting a new project from scratch is often exhilarating. It presents an opportunity to do everything right from the outset. However, it's a common experience that today's greenfield projects quickly evolve into tomorrow's legacy codebases. The challenge then becomes how to modernize these legacy systems without the luxury of starting anew, constrained by time and budget.&lt;/p&gt;

&lt;p&gt;This challenge transcends programming languages, affecting developers in every ecosystem. The key to sustainable modernization lies in the adoption of 'baselines' – a strategy effective across various programming environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Baseline?
&lt;/h2&gt;

&lt;p&gt;A baseline serves as a fixed reference point for the current state of a codebase. It acknowledges the existing code as it is, even if it's not ideal. This pragmatic approach allows developers to manage legacy code without being overwhelmed by it. The baseline sets the stage for incremental improvements, enabling teams to introduce and enforce new coding standards and practices for all future code, whether it involves new files or modifications to existing ones. This method ensures gradual modernization without the need to overhaul everything simultaneously.&lt;/p&gt;

&lt;h2&gt;
  
  
  Baselines in Practice: PHP and Beyond
&lt;/h2&gt;

&lt;p&gt;The concept of baselines is well-integrated into the PHP ecosystem. For example, it's a feature in &lt;a href="https://phpstan.org/" rel="noopener noreferrer"&gt;PHPStan&lt;/a&gt; and &lt;a href="https://psalm.dev/" rel="noopener noreferrer"&gt;Psalm&lt;/a&gt;, two popular static code analyzers for PHP. This allows you to enforce much stricter PHPStan/Psalm levels or individual rules on new code while also creating a full catalog of code smell in your codebase which you then can fix overtime. Another great benefit of baselines is that they make updates of such static code analyzers much easier, as you can upgrade immediately and solve the newly popping up errors over time.&lt;/p&gt;

&lt;p&gt;Besides static code analysis, I recently also explored that there exists a &lt;a href="https://github.com/iodigital-com/php-code-sniffer-baseliner" rel="noopener noreferrer"&gt;baseline library&lt;/a&gt; for &lt;a href="https://github.com/squizlabs/PHP_CodeSniffer" rel="noopener noreferrer"&gt;PHP_CodeSniffer&lt;/a&gt; one of many PHP Code style formatters. On first sight this does not make too much sense as code style should just be applied to the whole code base, if legacy or not. And that's technically true, but those days there also exists code style rules to enforce certain ways of doing stuff in PHP that are not only code style but could possibly also produce breaking changes by fixing it. Think about unsafe comparison operators or strict type declarations. You might want to enforce as much strictness as possible for new code to make your life much easier in the long run, but you don't have the time to upgrade your complete code basis to such rules. Especially because possibly introduced bugs are really difficult to spot.&lt;/p&gt;

&lt;p&gt;However, the concept of baselines isn’t confined to PHP. It can be just as effective in other programming languages, whether it's JavaScript, Python, Java, or Ruby. There is a good chance that a baseline implementation is already available for the tools you use daily.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your Thoughts and Experiences
&lt;/h2&gt;

&lt;p&gt;I'm keen to hear your thoughts on the baseline approach. How do you see it fitting into your development workflow, regardless of the programming language you use? Are there tools in your language of choice that currently use or could benefit from implementing baselines? Your insights and experiences with this approach across different languages could be invaluable to the broader developer community.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>refactoring</category>
      <category>php</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Strategic Considerations for Using Named Arguments in Code</title>
      <dc:creator>evolving_dev</dc:creator>
      <pubDate>Thu, 16 Nov 2023 06:56:40 +0000</pubDate>
      <link>https://forem.com/evolving_dev/strategic-considerations-for-using-named-arguments-in-code-1c94</link>
      <guid>https://forem.com/evolving_dev/strategic-considerations-for-using-named-arguments-in-code-1c94</guid>
      <description>&lt;h2&gt;
  
  
  The Case for Named Arguments in Modern Programming
&lt;/h2&gt;

&lt;p&gt;Named arguments in programming languages offer a compelling blend of readability and flexibility that can lead to more maintainable and intuitive codebases. They serve as an essential tool for developers, providing clear benefits in various scenarios, such as code reviews and refactoring, while also presenting unique considerations when it comes to managing public APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pros of Named Arguments
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Streamlining Default Values
&lt;/h3&gt;

&lt;p&gt;A significant advantage of named arguments is their ability to streamline the management of default values across a project. When functions have parameters with default states, named arguments allow you to only override the defaults where necessary. This avoids the tedious and error-prone practice of copying default values throughout the code, significantly reducing the risk of inconsistencies and making the process of changing a default value far simpler and safer. It also means that when you're reading the code, you can immediately see which arguments are being explicitly set and which are relying on the default behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  Easier Method Restructuring
&lt;/h3&gt;

&lt;p&gt;Refactoring is an integral part of software development, and named arguments make this process more straightforward. When you need to restructure a method, such as by changing the order of parameters or adding new ones, you can do so without worrying about updating every single call to that method. Named arguments free developers from the positional constraints of parameters, allowing for a more fluid evolution of code over time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enhancing Code Reviews
&lt;/h3&gt;

&lt;p&gt;In code review scenarios, particularly when using minimalistic interfaces that lack the advanced features of an IDE, named arguments provide clarity that can significantly expedite the review process. Reviewers can easily discern the purpose of each argument without needing to refer to the method signature, facilitating a quicker and more thorough understanding of the changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cons of Named Arguments
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Semantic Versioning Challenges
&lt;/h3&gt;

&lt;p&gt;However, named arguments are not without their downsides, especially when it comes to semantic versioning (&lt;a href="https://semver.org/" rel="noopener noreferrer"&gt;SemVer&lt;/a&gt;) in public APIs. With SemVer, any change to the public API that can cause a backward compatibility break necessitates a new major version. Named arguments, by their very nature, become part of the public API. Therefore, changing the name of an argument can constitute a breaking change, which means library authors must be cautious and deliberate about naming from the outset to avoid future complications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Potential to Mask Design Flaws
&lt;/h3&gt;

&lt;p&gt;Another consideration is the potential for named arguments to mask underlying design issues. A method with a high number of parameters may be a sign of poor design, such as a class with too many responsibilities or a violation of the single responsibility principle. Named arguments can make such methods more palatable, but they don't address the root problem. Developers should remain vigilant to ensure that the convenience of named arguments doesn't lead to complacency in design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Named arguments are a powerful feature that, when used correctly, can greatly enhance the quality and maintainability of code. They offer a way to avoid duplicating default values, simplify method restructuring, and improve the code review process. Yet, it's important to use them judiciously, with an eye towards the implications for semantic versioning and the overall design of the software.&lt;/p&gt;

&lt;h2&gt;
  
  
  Join the Conversation
&lt;/h2&gt;

&lt;p&gt;What has been your experience with named arguments? Do you find them more beneficial for avoiding duplication of default states, or do they present challenges in versioning and design in your projects? Share your thoughts, and let's discuss the best practices for using named arguments effectively.&lt;/p&gt;

</description>
      <category>codequality</category>
      <category>refactoring</category>
      <category>programming</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
