Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I'm not proud to admit it but sounds like something I would do 😆. Like hey the way it should work isn't working for me but I can't think of way, I can however think of this other hacky way that will work let's just give it a try and see if it really will work... aaaand it's in production now woops 🤷
Related Rants
-
Number011First Helpdesk call of the day: "My PC has been stuck on the same thing for an hour now. Its completely crash... -
-eth2HR Project update meeting. Duration: 1h Content: 1) recap of previous meeting 2) overview of what we will dis... -
Santaclauze23!geek girlfriend Me and my partner are in the car driving. We drive by a young girl who is on her scooter. I ...

Crazy code.
You know when you come across some code, where you think: “I kinda see what you were going for, but it’s still hella dumb though...” right?
Currently doing some work on an F# backend, and the dev clearly knew enough of the language, but their code makes me question a lot.
The problem is simple: use a third party tool to generate images of each page in a pdf.
Said tool supports:
1. Querying the number of pages
2. Getting all pages as separate images in a single invocation
Can you guess how the dev solved it?
They’ve recursively incremented a page number, called the external tool to grab the image of that page.
“But how does it know when it’s run out of pages?” I hear you ask.
Simple. Catch the inevitable exception, and check against a hardcoded string literal to see whether it says “must be before the end of the document”.
I shit you not.
I nearly had an actual seizure when I was debugging some semi-related code and ended up in this wonderland of fuckery.
The recursion and pattern matching was flawless though, yet the tool’s website clearly states the supported functionality.
The whole thing feels like they tried to do it the right way, but couldn’t be bothered / couldn’t get it right, so they ended up creating this insane bit of madness.
rant
other developers
killmenow
crazy
fsharp
f#