Computer
CodeSOD: Disable This
One of the first things anyone learns about object oriented programming is the power of inheritance and overriding functions. Isn't it great that you can extend or modify the implementation of a function in your derived classes? Don't you wish you could just do that for every function? Aash's co-worker certainly does.
@Override public boolean isEnabled() { if (!super.isEnabled()) { return false; } return true; }I think this is a beautiful little smear of bad code, because it's useless on multiple levels. First, we are calling a boolean function only to bury it in a conditional which does the exact same thing: return super.isEnabled() would do the job. But if our developer thought to do that, they'd instantly see that there's no point to adding an override- we're just doing what the super class does. The if is just enough to hide that from you if you're careless and not very bright.
And, before you ask, no, there never was any real functionality in this override, at least not that ever got checked into source control. It isn't a vestigial leftover of once useful code. It's just useless from birth.
[Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!Excess Memes and 'Reply All' Emails Are Bad For Climate, Researcher Warns
Read more of this story at Slashdot.
Reservoir of Liquid Water Found Deep In Martian Rocks
Read more of this story at Slashdot.
Locking Up Items To Deter Shoplifting Is Pushing Shoppers Online
Read more of this story at Slashdot.
Google Wallet Widely Rolling Out 'Everything Else' Pass Creator In the US
Read more of this story at Slashdot.
Federal Appeals Court Finds Geofence Warrants Are 'Categorically' Unconstitutional
Read more of this story at Slashdot.
FBI Investigating After Trump Campaign Says It Was Hacked
Read more of this story at Slashdot.
Replika CEO Says It's OK If We Marry AI Chatbots
Read more of this story at Slashdot.
Stratasys Sues Bambu Lab Over Patents Used Widely By Consumer 3D Printers
Read more of this story at Slashdot.
UK Treasury Sparks Row Over Use of AI To Handle Taxpayer Complaints
Read more of this story at Slashdot.
Canceling Subscriptions Should Be As Easy As Signing Up, Newly Proposed federal Rule Says
Read more of this story at Slashdot.
US Colleges Slash Majors in Effort To Cut Costs
Read more of this story at Slashdot.
Apple Approves iDOS 3 Following Emulator Rule Change
Read more of this story at Slashdot.
The Era of Freeloading is Officially Over
Read more of this story at Slashdot.
Google's Osterloh Looks To Get Jump on Apple With Earlier Launch
Read more of this story at Slashdot.
AMD Gains Ground in Data Center, Laptop CPU Markets
Read more of this story at Slashdot.
Is the US Finally Getting 'All Aboard' With Electric Trains?
Read more of this story at Slashdot.
Apple Threatens To Remove Patreon From App Store Over Billing Dispute
Read more of this story at Slashdot.
Microsoft To Retire Paint 3D
Read more of this story at Slashdot.
Gas Pipeline Players in Talks To Fuel AI Datacenter Demand
Read more of this story at Slashdot.