Computer
Open Sourcing DOS 4
Read more of this story at Slashdot.
US Teacher Charged With Using AI To Frame Principal With Hate Speech Clip
Read more of this story at Slashdot.
Garry's Mod Is Taking Down Decades of Nintendo-Related Add-Ons
Read more of this story at Slashdot.
US 'Know Your Customer' Proposal Will Put an End To Anonymous Cloud Users
Read more of this story at Slashdot.
Ubuntu 24.04 LTS 'Noble Numbat' Officially Released
Read more of this story at Slashdot.
Twilio Founder Buys Satire Site 'The Onion'
Read more of this story at Slashdot.
Stripe To Start Taking Crypto Payments, Starting With USDC Stablecoin
Read more of this story at Slashdot.
FCC Votes To Restore Net Neutrality Rules
Read more of this story at Slashdot.
ByteDance Prefers TikTok Shutdown in US if Legal Options Fail, Report Says
Read more of this story at Slashdot.
New Rule Compels US Coal-Fired Power Plants To Capture Emissions - or Shut Down
Read more of this story at Slashdot.
iPhone Activation Market Share Hits New Low as Android Dominates
Read more of this story at Slashdot.
Net Neutrality is About To Make a Comeback
Read more of this story at Slashdot.
Ford Just Reported a Massive Loss on Every Electric Vehicle It Sold
Read more of this story at Slashdot.
Spotify Says Apple Has Rejected Its App Update With Price Information for EU Users
Read more of this story at Slashdot.
AI Could Kill Off Most Call Centres, Says TCS Head
Read more of this story at Slashdot.
US Fertility Rate Falls To Lowest In a Century
Read more of this story at Slashdot.
Vast DNA Tree of Life For Plants Revealed By Global Science Team
Read more of this story at Slashdot.
Airlines Required To Refund Passengers For Canceled, Delayed Flights
Read more of this story at Slashdot.
CodeSOD: Unaccountable Counting
Ulvhamne sends us some bad code that, well, I think at this point we should really coin a name for this particular anti-pattern.
@Override public int getNumOfItemsInDataContainer(int parDataId) { int numberOfItems = 0; for (Integer x : myTransactionDataContainerMap.keySet()) { numberOfItems ++; } return numberOfItems; }This C# function wants to get the number of items contained in a dictionary. To do that, it iterates across the set of keys, and increments a counter. This is instead of using the size field that's part of the dictionary container.
This one adds a lovely bonus of taking a parameter parDataId, and doing nothing with it.
Marking the parameter as par is an example of so-called "Apps Hungarian", where the prefix is meant to represent the "logical" datatype or purpose of the variable- semantic information, instead of type information. While marginally better than iDataId, I still hate it. Also, if your methods have so many local variables in scope that you need to distinguish them from the parameters somehow, lest you get confused, that's an even bigger code smell.
All the Hungarian nonsense aside, this is an example of the very common anti-pattern of manually counting the items in a container when the container already can report that information.
So what do we call that? "Container Countification"? "Fingers and Toes"? "Sesame Street Counting"?
[Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!Almost Every Chinese Keyboard App Has a Security Flaw That Reveals What Users Type
Read more of this story at Slashdot.