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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

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

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 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 power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

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

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»CodeSOD: Objectified

    CodeSOD: Objectified

    November 18, 2024

    Simon recently found himself working alongside a “very senior” developer- who had a whopping 5 years of experience. This developer was also aggrieved that in recent years, Object Oriented programming had developed a bad reputation. “Functional this, functional that, people really just don’t understand how clean and clear objects make your code.”

    For example, here are a few Java objects which they wrote to power a web scraping tool:

    class UrlHolder {
    
        private String url;
    
        public UrlHolder(String url) {
            this.url = url;
        }
    }
    
    class UrlDownloader {
    
        private UrlHolder url;
        public String downloadPage;
    
        public UrlDownLoader(String url) {
            this.url = new UrlHolder(Url);
        }
    }
    
    class UrlLinkExtractor {
    
       private UrlDownloader url;
    
       public UrlLinkExtractor(UrlDownloader url) {
            this.url = url;
       }
    
       public String[] extract() {
           String page = Url.downloadPage;
           ...
       }
    }
    

    UrlHolder is just a wrapper around string, but also makes that string private and provides no accessors. Anything shoved into an instance of that may as well be thrown into oblivion.

    UrlDownloader wraps a UrlHolder, again, as a private member with no accessors. It also has a random public string called downloadPage.

    UrlLinkExtractor wraps a UrlDownloader, and at least UrlLinkExtractor has a function- which presumably downloads the page. It uses UrlDownloader#downloadPage– the public string property. It doesn’t use the UrlHolder, because of course it couldn’t. The entire goal of this code is to pass a string to the extract function.

    I guess I don’t understand object oriented programming. I thought I did, but after reading this code, I don’t.

    [Advertisement]
    Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleThis thermal camera is my new favorite smartphone accessory (and it’s $50 off)
    Next Article Deep Tech Momentum launches pan-European deeptech marketplace

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-40906 – MongoDB BSON Serialization BSON::XS Multiple Vulnerabilities

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Managing AI agents as employees is the challenge of 2025, says Goldman Sachs CIO

    News & Updates

    A new era of creativity

    Web Development

    Newsletter 32:⚡️Upgrades To Streaming Speech-to-Text

    Artificial Intelligence

    Hackers Exploiting Jenkins Script Console for Cryptocurrency Mining Attacks

    Development

    Highlights

    Artificial Intelligence

    Nanonets announces strategic partnership with Credex Technology

    November 11, 2024

    Nanonets announces a strategic partnership with Credex Technology, a renowned digital transformation consultancy headquartered in…

    Developing for the Meta Quest 3 with Unreal Engine 5 [FREE]

    November 17, 2024

    How to Use Keycloak for Identity and Access Management

    January 23, 2025

    Save $260 on Amazon’s 75-inch Omni Series Fire TV this Memorial Day

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

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