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

      CodeSOD: A Unique Way to Primary Key

      July 22, 2025

      BrowserStack launches Figma plugin for detecting accessibility issues in design phase

      July 22, 2025

      Parasoft brings agentic AI to service virtualization in latest release

      July 22, 2025

      Node.js vs. Python for Backend: 7 Reasons C-Level Leaders Choose Node.js Talent

      July 21, 2025

      The best CRM software with email marketing in 2025: Expert tested and reviewed

      July 22, 2025

      This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

      July 22, 2025

      I’m a wearables editor and here are the 7 Pixel Watch 4 rumors I’m most curious about

      July 22, 2025

      8 ways I quickly leveled up my Linux skills – and you can too

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

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025
      Recent

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025

      Zero Trust & Cybersecurity Mesh: Your Org’s Survival Guide

      July 22, 2025

      Execute Ping Commands and Get Back Structured Data in PHP

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

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025
      Recent

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025

      “I don’t think I changed his mind” — NVIDIA CEO comments on H20 AI GPU sales resuming in China following a meeting with President Trump

      July 22, 2025

      Galaxy Z Fold 7 review: Six years later — Samsung finally cracks the foldable code

      July 22, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Dating in Another Language

    CodeSOD: Dating in Another Language

    April 23, 2025

    It takes a lot of time and effort to build a code base that exceeds 100kloc. Rome wasn’t built in a day; it just burned down in one.

    Liza was working in a Python shop. They had a mildly successful product that ran on Linux. The sales team wanted better sales software to help them out, and instead of buying something off the shelf, they hired a C# developer to make something entirely custom.

    Within a few months, that developer had produced a codebase of 320kloc I say “produced” and not “wrote” because who knows how much of it was copy/pasted, stolen from Stack Overflow, or otherwise not the developer’s own work.

    You have to wonder, how do you get such a large codebase so quickly?

    private String getDatum()
    {
        DateTime datum = new DateTime();
        datum = DateTime.Now;
        return datum.ToShortDateString();
    }
    
    public int getTag()
    {
        int tag;
        DateTime datum = new DateTime();
        datum = DateTime.Today;
        tag = datum.Day;
        return tag;
    }
    
    private int getMonat()
    {
        int monat;
        DateTime datum = new DateTime();
        datum = DateTime.Today;
        monat = datum.Month;
        return monat;
    }
    
    private int getJahr()
    {
        int monat;
        DateTime datum = new DateTime();
        datum = DateTime.Today;
        monat = datum.Year;
        return monat;
    }
    
    private int getStunde()
    {
        int monat;
        DateTime datum = new DateTime();
        datum = DateTime.Now;
        monat = datum.Hour;
        return monat;
    }
    
    private int getMinute()
    {
        int monat;
        DateTime datum = new DateTime();
        datum = DateTime.Now;
        monat = datum.Minute;
        return monat;
    }
    

    Instead of our traditional “bad date handling code” which eschews the built-in libraries, this just wraps the built in libraries with a less useful set of wrappers. Each of these could be replaced with some version of DateTime.Now.Minute.

    You’ll notice that most of the methods are private, but one is public. That seems strange, doesn’t it? Well this set of methods was pulled from one random class which implements them in the codebase, but many classes have these methods copy/pasted in. At some point, the developer realized that duplicating that much code was a bad idea, and started marking them as public, so that you could just call them as needed. Note, said developer never learned to use the keyword static, so you end up calling the method on whatever random instance of whatever random class you happen to have handy. The idea of putting it into a common base class, or dedicated date-time utility class never occurred to the developer, but I guess that’s because they were already part of a dedicated date-time utility class.

    [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 ArticleNethSecurity is a Linux firewall based on OpenWrt, a distribution
    Next Article CVE-2025-1056 – Axis Camera Station Pro File Path Traversal Vulnerability

    Related Posts

    News & Updates

    The best CRM software with email marketing in 2025: Expert tested and reviewed

    July 22, 2025
    News & Updates

    This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

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

    Microsoft releases Athena AI blueprint to boost developers’ productivity

    Operating Systems

    10 Secure Development Practices Every Developer Should Follow

    Web Development

    CVE-2024-32323 – Cnhcit Haichang OA SQL Injection

    Common Vulnerabilities and Exposures (CVEs)

    Load Balancing with Azure Application Gateway and Azure Load Balancer – When to Use Each One

    Development

    Highlights

    (CVE-2025-33053) New 0-Day in WebDAV Exposes Servers to Remote Code Execution  —  Here’s What You…

    June 14, 2025

    (CVE-2025-33053) New 0-Day in WebDAV Exposes Servers to Remote Code Execution  —  Here’s What You…

    What is CVE‑2025‑33053?CVE‑2025‑33053 is a zero-day remote code execution (RCE) vulnerability in Web Distributed Authoring and Versioning (WebDAV) within Windows. It stems from an external control of …
    Read more

    Published Date:
    Jun 14, 2025 (2 hours, 25 minutes ago)

    Vulnerabilities has been mentioned in this article.

    1 billion reasons to protect your identity online

    April 10, 2025

    Q&A: The skills developers need in an era of AI development

    April 17, 2025

    30% Faster Travel? Dubai’s AI Plan Is Blowing Minds

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

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