- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
At this point just vibe code ts - can't even get worse...
Admin
another reason kotlin is better than java. optional parameters are just
fun foo(arg0: String, arg1: Int = 0)
not 3 lines of boilerplate for every optional so theres no reason to avoid themEdit Admin
Wait, they're worried about having to modify the parameter list because of database changes, but not about having to modify the code processing the parameters? You moron, you have to modify code anyway, why not have compile-time checked parameters? :FACEPALM:
Admin
"No, all of our arguments are required. We'll just default the ones that the caller doesn't supply."
I can't quite get my head around this: required arguments, but the user doesn't need to supply them? And then just take a default value?
Edit Admin
It's universal code, no matter what the universe wants, this code can handle it! Right up until it crashes the universe.
Edit Admin
This is C#, not Java. And it also has optional parameters.
Edit Admin
I've personally witnessed this happen like eleventy-billion times. The worst was a contractor that created a general-purpose method to be used by any code that calls a stored procedure. The method inspected the proc and dynamically created local parameters for any parameter define on the procedure, then did something very similar to today's WTF.
It was just as bad as today's submission, with one bonus. We couldn't ever add any parameters to a stored procedure without simultaneously rolling out code updates. Sure, SQL Server supports default parameter values for parameters not supplied by the client, but the genius that wrote this code inspected the proc at run time, so all parameters were always supplied, even those added to the procedure later.
Another variant of this is "Let's put the code in a stored procedure so we can change it without the hassle of change-control approval!!". Wait, what?
Edit Admin
Hmmmm....
I do that a fair bit on the two web applications I'm maintaining, but not to avoid the code-review process --- that still happens. I do it to simply run an ALTER PROCEDURE script and avoid deploying the application. Am I guilty of non-optimal practices?
Edit Admin
Makes me flash back to the glory days of C (especially real mode!) where you passed a pointer to a blob of memory and assumed the receiver knew what it meant.