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

      The Ultimate Guide to Node.js Development Pricing for Enterprises

      July 29, 2025

      Stack Overflow: Developers’ trust in AI outputs is worsening year over year

      July 29, 2025

      Web Components: Working With Shadow DOM

      July 28, 2025

      Google’s new Opal tool allows users to create mini AI apps with no coding required

      July 28, 2025

      5 preinstalled apps you should delete from your Samsung phone immediately

      July 30, 2025

      Ubuntu Linux lagging? Try my 10 go-to tricks to speed it up

      July 30, 2025

      How I survived a week with this $130 smartwatch instead of my Garmin and Galaxy Ultra

      July 30, 2025

      YouTube is using AI to verify your age now – and if it’s wrong, that’s on you to fix

      July 30, 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

      Time-Controlled Data Processing with Laravel LazyCollection Methods

      July 30, 2025
      Recent

      Time-Controlled Data Processing with Laravel LazyCollection Methods

      July 30, 2025

      Create Apple Wallet Passes in Laravel

      July 30, 2025

      The Laravel Idea Plugin is Now FREE for PhpStorm Users

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

      New data shows Xbox is utterly dominating PlayStation’s storefront — accounting for 60% of the Q2 top 10 game sales spots

      July 30, 2025
      Recent

      New data shows Xbox is utterly dominating PlayStation’s storefront — accounting for 60% of the Q2 top 10 game sales spots

      July 30, 2025

      Opera throws Microsoft to Brazil’s watchdogs for promoting Edge as your default browser — “Microsoft thwarts‬‭ browser‬‭ competition‬‭‬‭ at‬‭ every‬‭ turn”

      July 30, 2025

      Activision once again draws the ire of players for new Diablo Immortal marketing that appears to have been made with generative AI

      July 30, 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

    5 preinstalled apps you should delete from your Samsung phone immediately

    July 30, 2025
    News & Updates

    Ubuntu Linux lagging? Try my 10 go-to tricks to speed it up

    July 30, 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

    Ubuntu Fixes Desktop File Thumbnails Not Showing

    Linux

    Your Oura ring just got a major upgrade that fixes its biggest flaw – for free

    News & Updates

    CVE-2025-7061 – Intelbras InControl CSV Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Running Multiple Test Cases from a CSV File Using Playwright and TypeScript.

    Development

    Highlights

    Windows 11 25H2 Update: Minor Changes Expected in October 2025

    April 28, 2025

    Windows 11 25H2 Update: Minor Changes Expected in October 2025

    Microsoft now schedules major version updates for Windows 11 every October, with the upcoming release set for October 2025—namely, Windows 11 version 25H2. References to this version have already begu …
    Read more

    Published Date:
    Apr 28, 2025 (2 hours, 24 minutes ago)

    Vulnerabilities has been mentioned in this article.

    CVE-2025-32432

    CVE-2023-34063

    CVE-2025-49797 – Brother Privilege Escalation Vulnerability

    June 25, 2025

    CVE-2025-6866 – Simple Forum PathTraversal

    June 29, 2025

    KDE Plasma 6.3.5 Update Available to Kubuntu Users

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

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