Computer
World Poker Tour Bets on AI Dubbing of Tournaments for Latin America
Read more of this story at Slashdot.
Xbox Cloud Gaming Now Has Mouse and Keyboard Support In Select Games
Read more of this story at Slashdot.
US Sanctions Spree Continues With 15 More For Russian Entities
Read more of this story at Slashdot.
Canva Acquires Affinity To Fill the Adobe-Sized Holes In Its Design Suite
Read more of this story at Slashdot.
Adam Neumann Makes a $500 Million Bid For WeWork
Read more of this story at Slashdot.
Apple Announces WWDC 2024 Event For June 10
Read more of this story at Slashdot.
Florida Braces For Lawsuits Over Law Banning Kids From Social Media
Read more of this story at Slashdot.
Vinyl Records Outsell CDs For the Second Year Running
Read more of this story at Slashdot.
Star Trek: Prodigy Season 2 Releases Early In France
Read more of this story at Slashdot.
Facebook Accused of Using Your Phone To Wiretap Snapchat
Read more of this story at Slashdot.
A Native Version of Chrome Arrives for Arm-based Windows PC
Read more of this story at Slashdot.
Dell Reduces Workforce as Part of Broader Cost Cuts
Read more of this story at Slashdot.
Portugal Orders Altman's Worldcoin To Halt Data Collection
Read more of this story at Slashdot.
Cloudflare Says It's Automated Empathy To Avoid Fixing Flaky Hardware Too Often
Read more of this story at Slashdot.
Telegram's Peer-to-Peer Login System is a Risky Way To Save $5 a Month
Read more of this story at Slashdot.
AI Will Suck Up 500% More Power in UK in 10 Years, Grid CEO Says
Read more of this story at Slashdot.
Reddit May Need To Ramp Up Spending On Content Moderation, Analysts Say
Read more of this story at Slashdot.
Microsoft Has a New Windows and Surface Chief
Read more of this story at Slashdot.
BBC Will Stop Using AI For 'Doctor Who' Promotion After Receiving Complaints
Read more of this story at Slashdot.
CodeSOD: Exceptional String Comparisons
As a general rule, I will actually prefer code that is verbose and clear over code that is concise but makes me think. I really don't like to think if I don't have to.
Of course, there's the class of WTF code that is verbose, unclear and also really bad, which Thomas sends us today:
Private Shared Function Mailid_compare(ByVal queryEmail As String, ByVal FnsEmail As String) As Boolean Try Dim str1 As String = queryEmail Dim str2 As String = FnsEmail If String.Compare(str1, str2) = 0 Then Return True Else Return False End If Catch ex As Exception End Try End FunctionThis VB .Net function could easily be replaced with String.Compare(queryEmail, FnsEmail) = 0. Of course, that'd be a little unclear, and since we only care about equality, we could just use String.Equals(queryEmail, FnsEmail)- which is honestly clearer than having a method called Mailid_compare, which doesn't actually tell me anything useful about what it does.
Speaking of not doing anything useful, there are a few other pieces of bloat in this function.
First, we plop our input parameters into the variables str1 and str2, which does a great job of making what's happening here less clear. Then we have the traditional "use an if statement to return either true or false".
But the real special magic in this one is the Try/Catch. This is a pretty bog standard useless exception handler. No operation in this function throws an exception- String.Compare will even happily accept null references. Even if somehow an exception was thrown, we wouldn't do anything about it. As a bonus, we'd return a null in that case, throwing downstream code into a bad state.
What's notable in this case, is that every function was implemented this way. Every function had a Try/Catch that frequently did nothing, or rarely (usually when they copy/pasted from StackOverflow) printed out the error message, but otherwise just let the program continue.
And that's the real WTF: a codebase polluted with so many do-nothing exception handlers that exceptions become absolutely worthless. Errors in the program let it continue, and the users experience bizarre, inconsistent states as the application fails silently.
Or, to put it another way: this is the .NET equivalent of classic VB's On Error Resume Next, which is exactly the kind of terrible idea it sounds like.
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!