Computer
India Orders Meta To Curb WhatsApp Data Sharing
Read more of this story at Slashdot.
Weekends Were a Mistake, Says Infosys Co-founder Narayana Murthy
Read more of this story at Slashdot.
China Population Set for 51 Million Drop as Pro-Birth Moves Fail
Read more of this story at Slashdot.
Belgian Region Trials Web Founder's Data Privacy System
Read more of this story at Slashdot.
World of Warcraft Turns 20
Read more of this story at Slashdot.
Apple Appears Set To Discontinue Lightning-to-Headphone Adapter
Read more of this story at Slashdot.
Trump Picks Carr To Head FCC With Pledge To Fight 'Censorship Cartel'
Read more of this story at Slashdot.
AI Investments Are Booming, but Venture-Firm Profits Are at a Historic Low
Read more of this story at Slashdot.
The Rust Foundation Wants to Improve Rust and C++ Interoperability
Read more of this story at Slashdot.
ChatGPT-4 Beat Doctors at Diagnosing Illness, Study Finds
Read more of this story at Slashdot.
CodeSOD: Objectified
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.On 15th Anniversary, Go Programming Languages Rises in Popularity
Read more of this story at Slashdot.
New Dune Prequel 'Dune: Prophecy' Premieres on HBO and Max
Read more of this story at Slashdot.
Linux Kernel 6.12 Has Been Released
Read more of this story at Slashdot.
Google, Microsoft Are Spending Massively on AI, Quarterly Earnings Show
Read more of this story at Slashdot.
What Happened When a Washington County Tried a 32-Hour Workweek?
Read more of this story at Slashdot.
Privately-Funded EU Company Raises $160M for SpaceX Dragon-Like Reusable Space Capsule
Read more of this story at Slashdot.
Could an Upcoming Apple Smart-Home Tablet Lead to Mobile Robots - and Maybe Even a TV Set?
Read more of this story at Slashdot.
Amazon Makes It Harder for Disabled Employees to Work From Home
Read more of this story at Slashdot.
Google AI Gemini Threatens College Student: 'Human... Please Die'
Read more of this story at Slashdot.