Computer
Photobucket Sued Over Plans To Sell User Photos, Biometric Identifiers To AI Companies
Read more of this story at Slashdot.
Russia Tests Cutting Off Access To Global Web, and VPNs Can't Get Around It
Read more of this story at Slashdot.
'The Dying Language of Accounting'
Read more of this story at Slashdot.
Google's New Jules AI Agent Will Help Developers Fix Buggy Code
Read more of this story at Slashdot.
WordPress Chief Quits Community Forum After Court Loss
Read more of this story at Slashdot.
New Magnetic Flow Has Potential To Revolutionise Electronic Devices
Read more of this story at Slashdot.
Google Unveils Project Mariner: AI Agents To Use the Web For You
Read more of this story at Slashdot.
'Modern War Cannot Be Won Without Software,' Palantir Executive Says
Read more of this story at Slashdot.
Researchers Uncover Chinese Spyware Used To Target Android Devices
Read more of this story at Slashdot.
UK Low-Carbon Renewable Power Set To Overtake Fossil Fuels For First Time
Read more of this story at Slashdot.
AI App Gold Rush Floods Apple Store With Low-Quality Offerings
Read more of this story at Slashdot.
Cruise Employees 'Blindsided' By GM's Plan To End Robotaxi Program
Read more of this story at Slashdot.
WordPress Parent Company Must Stop Blocking WP Engine, Judge Rules
Read more of this story at Slashdot.
CodeSOD: A Set of Mistakes
One of the long-tenured developers, Douglas at Patrick's company left, which meant Patrick was called upon to pick up that share of the work. The code left behind by Douglas the departing developer was, well… code.
For example, this block of Java:
private String[] getDomainId(Collection<ParticularCaseEntity> particularCase) { // Get all domainId Collection<String> ids = new ArrayList<String>(); for (ParticularCaseEntity case : particularCase) { ids.add(case.getDomainId()); } Set<String> domainIdsWithoutRepeat = new HashSet<String>(); domainIdsWithoutRepeat.addAll(ids); Collection<String> domainIds = new ArrayList<String>(); for (String domainId : domainIdsWithoutRepeat) { domainIds.add(domainId); } return domainIds.toArray(new String[0]); }The purpose of this code is to get a set of "domain IDs"- a set, specifically, because we want them without duplicates. And this code takes the long way around to do it.
First, it returns a String[]- but logically, what it should return is a set. Maybe it's meant to comply with an external interface, but it's a private method- so I actually think this developer just didn't understand collection types at all.
And I have more evidence for that, which is the rest of this code.
We iterate across our ParticularCaseEntitys, and add each one to an array list. Then we create a hash set, and add all of those to a hash set. Then we create another array list, and add each entry in the set to the array list. Then we convert that array list into an array so we can return it.
At most, we really only needed the HashSet. But this gives us a nice tour of all the wrong data structures to use for this problem, which is helpful.
Speaking of helpful, it didn't take long for Patrick's employer to realize that having Patrick doing his job, and also picking up the work that Douglas used to do was bad. So they opened a new position, at a higher pay grade, hoping to induce a more senior developer to step in. And wouldn't you know, after 6 months, they found a perfect candidate, who had just finished a short six month stint at one of their competitors: Douglas!
.comment { border: none; } [Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!Google Asks FTC To Kill Microsoft's Exclusive Cloud Deal with OpenAI
Read more of this story at Slashdot.
Amazon is Officially in the Online Car Sales Business
Read more of this story at Slashdot.
Investigation Launched Into Queensland Lab Breach, With Vials of Deadly Viruses Missing
Read more of this story at Slashdot.
Open Source Maintainers Are Drowning in Junk Bug Reports Written By AI
Read more of this story at Slashdot.
Livestock Antibiotic Use in Asia Dwarfs European Levels Amid Resistance Fears
Read more of this story at Slashdot.
GM Exits Robotaxi Market
Read more of this story at Slashdot.