this post was submitted on 17 Jun 2025
173 points (97.8% liked)

Programmer Humor

36575 readers
252 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
top 29 comments
sorted by: hot top controversial new old
[–] phantomwise@lemmy.ml 5 points 1 day ago

Not gonna lie, that vertical alignment is making my brain purr like a kitten

[–] AmazingAwesomator@lemmy.world 28 points 3 days ago (8 children)

the fact that these are strings instead of an object that is broken up by country code, area code, and number makes me irrationally angry.

[–] JackbyDev@programming.dev 10 points 1 day ago

You absolute buffoon. How do you figure this code isn't testing how to parse a string into such an object??

[–] skullgiver@popplesburger.hilciferous.nl 11 points 2 days ago* (last edited 2 days ago)

Country codes are variable. Even the "I'm about to dial another country prefix" (usually + resolves to 00 but that depends on country and carrier) is variable. Phone number lengths are variable. Phone numbers are often written in non-Arabic numerals. Phone numbers can have specific digits in the middle of the number to reroute the call to another carrier.

You can try to parse phone numbers if you're writing a specific phone number parsing library, but you'll need to keep up with the ITU documents, the numbering plans of all countries and satellite providers, and provide support for older standards going back to the 60s. You'll need to deal with edge cases that your language probably doesn't even have names for. And most importantly, you'll have to guess what country the phone number is from based on context clues such as the user's language or location or locale because phone numbers can be and are reused across borders.

Phone numbers are worse than time zones. Don't parse them yourself unless you're building an international phone interconnect.

[–] HiddenLayer555@lemmy.ml 3 points 1 day ago

Better than an integer at least.

[–] Clent@lemmy.dbzer0.com 1 points 1 day ago

"The number" is itself two parts hence the dash. The first section being the prefix and the last part being the line number.

[–] gandalf_der_12te@discuss.tchncs.de 23 points 2 days ago (1 children)

i think you think that telephone numbers are well-structured. they are not. they are messy. they do not fit a certain schematic.

I recommend also the following topic: "people have names". https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

Names do not in general fit into the schematic "first name, last name"

[–] CanadaPlus@lemmy.sdf.org 3 points 2 days ago* (last edited 2 days ago) (2 children)

Is there not a "falsehoods programmers think about phone numbers" yet?

Edit: And once again, I'm still confused about some of these. Do we need to expand unicode for names? It's supposed to be universal. WTF is up with 40?

[–] gandalf_der_12te@discuss.tchncs.de 2 points 2 days ago* (last edited 2 days ago) (1 children)

WTF is up with 40?

People have names.

I suppose that a counterexample to this might be Tibetan children, who get named at puberty, IIRC. Before that, they have no names. They are just referred to as "child" or "somebody's child".

People’s names are all mapped in Unicode code points.

I suppose a counterexample to that might be cultures which do not use script in general. Then, obviously, there's no Unicode characters for these non-existant glyphs.

[–] CanadaPlus@lemmy.sdf.org 1 points 2 days ago

Ah, so it dovetails with the whole "children get a name reasonably fast" thing. I was interpreting that as "ever, in a natural lifespan". My bad, haha.

I suppose a counterexample to that might be cultures which do not use script in general. Then, obviously, there’s no Unicode characters for these non-existant glyphs.

True, but there's little risk of a name being entered into a form without some kind of transcription.

[–] wizardbeard@lemmy.dbzer0.com 27 points 3 days ago* (last edited 3 days ago)

Could be tests for a parser to convert it from string to object.

Not like your end users are going to type each piece into a separate field.

[–] MyNameIsRichard@lemmy.ml 5 points 3 days ago (1 children)

Found the Java programmer...

[–] AmazingAwesomator@lemmy.world 7 points 3 days ago

microsoft java :p

[–] ddplf@szmer.info 3 points 3 days ago

You seem to enjoy overengineering your code, don't you?

[–] SubArcticTundra@lemmy.ml 7 points 2 days ago* (last edited 2 days ago) (1 children)

I think it's commendable to vertically align code. (Just not with tabs.) It makes it look neater.

[–] JackbyDev@programming.dev 2 points 1 day ago (1 children)

We underutilize tabs. https://nick-gravgaard.com/elastic-tabstops/

(Don't mistake this as me saying everyone should start using tabs immediately. This would take a drastic overhaul of all textual displays and we're likely to never see such a thing, but it's still a cool concept.)

[–] SubArcticTundra@lemmy.ml 1 points 1 day ago* (last edited 1 day ago) (2 children)

Good to see tabs' fundamental flaw was solved. I think I'll be switching to this.

[–] JackbyDev@programming.dev 1 points 1 day ago (1 children)

You can't unless the tools you're using to display tabs do it like this. None do, apart from the proof of concept programs on the site.

But it is a cool idea.

[–] SubArcticTundra@lemmy.ml 1 points 1 day ago

I think i saw a vscode plugin on the page

[–] MellowSnow@lemmy.world 1 points 1 day ago

It's not "solved." Not trying to dive into yet another tabs vs. spaces argument. But this is just another example of how tabs can be pretty neat when they're interpreted in a specific way. But it's up to your editor, plugin, etc. to do so. Take the same text and throw it into an editor that doesn't use this same interpretation, and it immediately falls apart.

[–] jet@hackertalks.com 6 points 3 days ago

Without monospacing....

[–] colournoun@beehaw.org 4 points 3 days ago (1 children)

Junior devs don’t know Jenny.

[–] CanadaPlus@lemmy.sdf.org 2 points 2 days ago (1 children)

It's true. Who's Jenny, for the zoomers in the chat?

[–] colournoun@beehaw.org 3 points 2 days ago (1 children)

It was a very popular song in the 80s. Jenny’s phone number was 867-5309.

https://en.m.wikipedia.org/wiki/867-5309/Jenny

If you’re ever at a store and need a frequent shopper card, this number with your local area code is usually registered.

[–] CanadaPlus@lemmy.sdf.org 1 points 1 day ago (1 children)

Interesting how Wikipedia handles slashes in the title.

Good to know! Although I have to wonder if that's true for programs more recently set up as well. That was >40 years ago.

[–] Crashumbc@lemmy.world 1 points 1 day ago

I suspect most reasonably populated areas it works.

[–] nautilus@lemmy.dbzer0.com 2 points 2 days ago

Could have stopped the meme at the top text to be honest

[–] sepi@piefed.social 2 points 3 days ago

Tell me you are 40-50 without telling me