Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Top 15 Enterprise Use Cases That Justify Hiring Node.js Developers in 2025

      July 31, 2025

      The Core Model: Start FROM The Answer, Not WITH The Solution

      July 31, 2025

      AI-Generated Code Poses Major Security Risks in Nearly Half of All Development Tasks, Veracode Research Reveals   

      July 31, 2025

      Understanding the code modernization conundrum

      July 31, 2025

      Not just YouTube: Google is using AI to guess your age based on your activity – everywhere

      July 31, 2025

      Malicious extensions can use ChatGPT to steal your personal data – here’s how

      July 31, 2025

      What Zuckerberg’s ‘personal superintelligence’ sales pitch leaves out

      July 31, 2025

      This handy NordVPN tool flags scam calls on Android – even before you answer

      July 31, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Route Optimization through Laravel’s Shallow Resource Architecture

      July 31, 2025
      Recent

      Route Optimization through Laravel’s Shallow Resource Architecture

      July 31, 2025

      This Week in Laravel: Laracon News, Free Laravel Idea, and Claude Code Course

      July 31, 2025

      Everything We Know About Pest 4

      July 31, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      FOSS Weekly #25.31: Kernel 6.16, OpenMandriva Review, Conky Customization, System Monitoring and More

      July 31, 2025
      Recent

      FOSS Weekly #25.31: Kernel 6.16, OpenMandriva Review, Conky Customization, System Monitoring and More

      July 31, 2025

      Windows 11’s MSN Widgets board now opens in default browser, such as Chrome (EU only)

      July 31, 2025

      Microsoft’s new “move to Windows 11” campaign implies buying OneDrive paid plan

      July 31, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Find the First Function to Cut

    CodeSOD: Find the First Function to Cut

    April 30, 2025

    Sebastian is now maintaining a huge framework which, in his words, “could easily be reduced in size by 50%”, especially because many of the methods in it are reinvented wheels that are already provided by .NET and specifically LINQ.

    For example, if you want the first item in a collection, LINQ lets you call First() or FirstOrDefault() on any collection. The latter option makes handling empty collections easier. But someone decided to reinvent that wheel, and like so many reinvented wheels, it’s worse.

    public static LoggingRule FindFirst (this IEnumerable<LoggingRule> rules, Func<LoggingRule, bool> predicate)
    {
            foreach (LoggingRule rule in rules) {
                    return rule;
            }
            return null;
    }
    

    This function takes a list of logging rules and a function to filter the logging rules, starts a for loop to iterate over the list, and then simply returns the first element in the list, thus exiting the for loop. If the loop doesn’t contain any elements, we return null.

    From the signature, I’d expect this function to do filtering, but it clearly doesn’t. It just returns the first element, period. And again, there’s already a built-in function for that. I don’t know why this is exists, but I especially dislike that it’s so misleading.

    There’s only one positive to say about this: if you did want to reduce the size of the framework by 50%, it’s easy to see where I’d start.

    [Advertisement]
    BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleHalwan Linux is an Arch-based distro for developers
    Next Article 6 Best Free and Open Source Econometric Software

    Related Posts

    News & Updates

    Not just YouTube: Google is using AI to guess your age based on your activity – everywhere

    July 31, 2025
    News & Updates

    Malicious extensions can use ChatGPT to steal your personal data – here’s how

    July 31, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    CVE-2025-1417 – Proget MDM Information Disclosure Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Best Free and Open Source Alternatives to Autodesk Motion FX

    Linux

    Signal App Clone TeleMessage Vulnerability May Leak Passwords; Hackers Exploiting It

    Security

    Brisa 0.2.12 – Near 0.3 🔜

    Development

    Highlights

    Google launches OSS Rebuild tool to improve trust in open source packages

    July 23, 2025

    Google is hoping to improve public trust in open source projects with the launch of…

    Building Autonomous AI Agents: Unlocking Scalable Growth for Modern Businesses🤖

    July 16, 2025

    CVE-2025-2905 – WSO2 API Manager XXE File Disclosure and Denial of Service Vulnerability

    May 5, 2025

    CVE-2025-37834 – Linux Kernel: Dirty Swapcache Page Reclamation Vulnerability

    May 8, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.