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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 9, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 9, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 9, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 9, 2025

      Your password manager is under attack, and this new threat makes it worse: How to defend yourself

      May 9, 2025

      EcoFlow’s new backyard solar energy system starts at $599 – no installation crews or permits needed

      May 9, 2025

      Why Sonos’ cheapest smart speaker is one of my favorites – even a year after its release

      May 9, 2025

      7 productivity gadgets I can’t live without (and why they make such a big difference)

      May 9, 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

      Tap into Your PHP Potential with Free Projects at PHPGurukul

      May 9, 2025
      Recent

      Tap into Your PHP Potential with Free Projects at PHPGurukul

      May 9, 2025

      Preparing for AI? Here’s How PIM Gets Your Data in Shape

      May 9, 2025

      A Closer Look at the AI Assistant of Oracle Analytics

      May 9, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      kew v3.2.0 improves internet radio support and more

      May 9, 2025
      Recent

      kew v3.2.0 improves internet radio support and more

      May 9, 2025

      GNOME Replace Totem Video Player with Showtime

      May 9, 2025

      Placemark is a web-based tool for geospatial data

      May 9, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Nobody’s BFF

    CodeSOD: Nobody’s BFF

    March 31, 2025

    Legacy systems are hard to change, and even harder to eliminate. You can’t simply do nothing though; as technology and user expectations change, you need to find ways to modernize and adapt the legacy system.

    That’s what happened to Alicia‘s team. They had a gigantic, spaghetti-coded, monolithic application that was well past drinking age and had a front-end to match. Someone decided that they couldn’t touch the complex business logic, but what they could do was replace the frontend code by creating an adapter service; the front end would call into this adapter, and the adapter would execute the appropriate methods in the backend.

    Some clever coder named this “Backend for Frontend” or “BFF”.

    It was not anyone’s BFF. For starters, this system didn’t actually allow you to just connect a UI to the backend. No, that’d be too easy. This system was actually a UI generator.

    The way this works is that you feed it a schema file, written in JSON. This file specifies what input elements you want, some hints for layout, what validation you want the UI to perform, and even what CSS classes you want. Then you compile this as part of a gigantic .NET application, and deploy it, and then you can see your new UI.

    No one likes using it. No one is happy that it exists. Everyone wishes that they could just write frontends like normal people, and not use this awkward schema language.

    All that is to say, when Alicia’s co-worker stood up shortly before lunch, said, “I’m taking off the rest of the day, BFF has broken me,” it wasn’t particularly shocking to hear- or even the first time that’d happened.

    Alicia, not heeding the warning inherent in that statement, immediately tracked down that dev’s last work, and tried to understand what had been so painful.

        "minValue": 1900,
        "maxValue": 99,
    

    This, of course, had to be a bug. Didn’t it? How could the maxValue be lower than the minValue?

    Let’s look at the surrounding context.

    {
        "type": "eventValueBetweenValuesValidator",
        "eventType": "CalendarYear",
        "minValue": 1900,
        "maxValue": 99,
        "isCalendarBasedMaxValue": true,
        "message": "CalendarYear must be between {% raw %}{{minValue}}{% endraw %} and {% raw %}{{maxValue}}{% endraw %}."
    }
    

    I think this should make it perfectly clear what’s happening. Oh, it doesn’t? Look at the isCalendarBasedMaxValue field. It’s true. There, that should explain everything. No, it doesn’t? You’re just more confused?

    The isCalendarBasedMaxValue says that the maxValue field should not be treated as a literal value, but instead, is the number of years in the future relative to the current year which are considered valid. This schema definition says “accept all years between 1900 and 2124 (at the time of this writing).” Next year, that top value goes up to 2125. Then 2126. And so on.

    As features go, it’s not a terrible feature. But the implementation of the feature is incredibly counter-intuitive. At the end of the day, this is just bad naming: (ab)using min/max to do something that isn’t really a min/max validation is the big issue here.

    Alicia writes:

    I couldn’t come up with something more counterintuitive if I tried.

    Oh, don’t sell yourself short, Alicia. I’m sure you could write something far, far worse if you tried. The key thing here is that clearly, nobody tried– they just sorta let things happen and definitely didn’t think too hard about it.

    [Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.

    Source: Read More 

    Hostinger
    Facebook Twitter Reddit Email Copy Link
    Previous Article7 Best Free and Open Source Restic Front-Ends
    Next Article ddrescueview examines ddrescue’s mapfiles

    Related Posts

    News & Updates

    Your password manager is under attack, and this new threat makes it worse: How to defend yourself

    May 9, 2025
    News & Updates

    EcoFlow’s new backyard solar energy system starts at $599 – no installation crews or permits needed

    May 9, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    What is Ollama? Everything Important You Should Know

    Development

    Elara’s Bog

    Artificial Intelligence

    Aleph Alpha Researchers Release Pharia-1-LLM-7B: Two Distinct Variants- Pharia-1-LLM-7B-Control and Pharia-1-LLM-7B-Control-Aligned

    Development

    CVE-2025-2470 – Nextend Social Login WordPress Plugin Privilege Escalation Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    Development

    Count all elements with the specific resource ID on the scrollable view

    August 5, 2024

    Here is the question. How can I count all the elements with the resource ID body_bubble on a scrollable view ?
    When I use the driver.findElements (By.id (“body_bubble”)).size() method, it gets only the elements that are currently in view (visible on the screen).

    How can I find all the elements? I know that I can use something like new UiScrollable(new UiSelector()).scrollIntoView, but I can’t wrap my head around it.

    Please help me out.

    Top 5 Tech Trends at CES 2025

    January 10, 2025

    What do the State of CSS and HTML surveys tell us?

    December 20, 2024

    How to Write Unit Tests and E2E Tests for NestJS Applications

    April 16, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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