this post was submitted on 14 Sep 2023
405 points (80.1% liked)

Programmer Humor

19452 readers
30 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Omgarm@lemmy.world 71 points 1 year ago (1 children)

Look at all these C# dev who don't know the witch hunts are starting in 2024.

[–] TheFerrango@lemmy.basedcount.com 17 points 1 year ago (2 children)

Time to become a Visual Basic .Net developer

[–] Wild_Mastic@lemmy.world 7 points 1 year ago (4 children)

Jokes on you, I am already one! (yes my company chosen dev language is really vbnet)

[–] TheFerrango@lemmy.basedcount.com 6 points 1 year ago (1 children)

All I’m saying is “AndAlso”

[–] Heavybell@lemmy.world 6 points 1 year ago* (last edited 1 year ago) (1 children)

My old boss loved VB.Net. I still remember a time when I helped him out by solving mysterious bug for him.

He used to have this class he copied about to do database stuff. Not the worst thing of itself, but it was oddly specific in some ways for reused code. E.g. It had a function that took an enum value and returned connection string. And of course what options were in the enum varied.

So I come in one day and two other devs are already peering over his shoulder trying to help. The program is crashing when it tries to connect to the database and they can see for some reason the connection string is a single letter. I ask to see the function that is getting the connection string and see he's removed the parameter, but the compiler didn't pick up on it because:

  • VB.net lets you call functions that have no parameters without parentheses
  • VB.net is type lax, so an enum can be treated as an integer without casting
  • VB.net uses parentheses for array indexation as well as method invokation
  • .Net strings can be indexed like an array of characters
  • VB has no character type so VB.net treat characters as 1-length strings

So instead of passing an enum to a function, it was calling the function with no parameter, then using the enum value to index the returned string into a single character, which was then treated as a string and passed to the SqlClient constructor.

[–] Wild_Mastic@lemmy.world 2 points 1 year ago

I saw something similar in ancient code I found while refactoring some stuff. It's between genius and maniac.

[–] lanbanger@kbin.social 5 points 1 year ago* (last edited 1 year ago)

I remember when I turned up to a new C# role, when all the interviews had been about C#, but the system was all VB.Net. Fckmylife.

[–] amio@kbin.social 5 points 1 year ago
[–] Rentlar@lemmy.ca 3 points 1 year ago

The next Slay the Spire to be developed on Microsoft Access