Obviously the pseudo code leaves to the imagination, but what benefits does this give you? Are you checking that it is 10-digits? Are you allowing for + symbols for the international codes?
Can't pass a PhoneNumber to a function expecting an EmailAddress, for one, or mix up the order of arguments in a function that may otherwise just take two or more strings
void callNumber(string phoneNumber);
void associatePhoneNumber(string phoneNumber, Person person);
Person lookupPerson(string phoneNumber);
Provider getProvider(string phoneNumber);
I pass in "555;324+289G". Are you putting validation logic into all of those functions? You could have a validation function you write once and call in all of those functions, but why? Why not just parse the phone number into an already validated type and pass that around?
PhoneNumber PhoneNumber(string phoneNumber);
void callNumber(PhoneNumber phoneNumber);
void associatePhoneNumber(PhoneNumber phoneNumber, Person person);
Person lookupPerson(PhoneNumber phoneNumber);
Provider getProvider(PhoneNumber phoneNumber);
Put all of the validation logic into the type conversion function. Now you only need to validate once from string to PhoneNumber, and you can safely assume it's valid everywhere else.
That's going to be up to the business building the logic. Ideally those assumptions are clearly encoded in an easily readable manner but at the very least they should be captured somewhere code adjacent (even if it's just a comment and the block of logic to enforce those restraints).
And parentheses. And spaces (that may, or may not, be trimmed). And all kind of unicode equivalent characters, that might have to be canonicalized. Why not treat it as a byte buffer anyway.
If you are not checking that the phone number is 10 digits (or whatever the rules are for the phone number for your use case), it is absolutely pointless. But why would you not?
I would argue it's the other way around. If I take a string I believe to be a phone number and wrap it in a `PhoneNumber` type, and then later I try to pass it in as the wrong argument to a function like say I get order of name & phone number reversed, it'll complain. Whereas if both name & phone number are strings, it won't complain.
That's what I see as the primary value to this sort of typing. Enforcing the invariants is a separate matter.
Are you sure? Have you actually timed this, or are you just using your subjective impression of time.
In Human factors engineering we have known for decades that some things that seem faster are really slower when you time it. We are taught early to never trust what someone says about time, always find an objective way to measure it.
It is why I (right-handed) was tфught by my first boss on first job in 2000s to use left hand for the mouse: secondary hand for secondary task (I'm not designer, artist or pro-gamer, so keyboard is primary tool).
Now I have a big problem with this: there is no good left-handed mouses on the market anymore, and symmetric mouses has right-handed buttons (and no thumb buttons like forward-backward or left-handed side). Buttons can be swapped in OS, but it messed up remote access like VNC or RDP to systems without swapped buttons... So, buttons must be swapped physically. No luck.
Most of the useful keyboard shortcuts are chordable from the left hand. Left mouse is inconvenient for that. I'm lefty and stuck using left mouse periodically due to injuries and I don't love it but it's tolerable. For the mouse situation I just stick to symmetric 3-button mice and never swap buttons so I can change hands or have a coworker use the mouse uninterrupted.
I also mouse left-handed, but it never occurred to me to swap the buttons from the right-handed configuration. It's always been a practical thing. The only mice I'm likely to have within reach at any point are probably right-handed, so I just had to learn that way. Left click with middle finger, right click with index.
I would kill for a true ambi five-button mouse to replace my old Microsoft Intellimouse, but I've run into the same problem, they just don't seem to exist anymore. All five button mice on the market either have both buttons 4 and 5 on the left side for righties, or have a grotesquely unbalanced design in some other way.
> I would kill for a true ambi five-button mouse to replace my old Microsoft Intellimouse, but I've run into the same problem, they just don't seem to exist anymore.
I was going to say Steelseries Sensei but it looks like those have been discontinued.
Looks like Steelserise Sensei Ten is ambi, symmetrical, with two additional buttons on each side. But not on a cheap side. If you can find one. It is still present on site, but I cannot find places which sell it.
It has one problem: buttons not swapped physically! Yes, leftmost button is primary one (first), and rightmost is secondary (third).
I have this one and use it, with software swapping, but each time I login to remote computer via RDP I need to un-swap in settings again and then back :-(
It is striking, that Logitech forgot how to make proper left-handed mouse. Their older models (discontinued for long time) were perfectly Ok!
Also, it very small for my hand. But better than nothing.
Fwiw this is how cars work when you change to a country that drives on the other side of the road. It seems like mirroring the car would make sense. But really everything is shifted to the opposite side as a translation without reflection. It's easier to manufacture, but as many of you will know and is apparent to all rental agencies, adapting doesn't take long for the average driver, even on manual transmission.
My trouble is I really do want an ambi mouse, not a lefty mouse, since I like to switch back and forth (and always game right-handed.) Maybe I should just get one of each..
Well, I usually use the mouse to select text. And then I usually use the mouse to put the cursor precisely where I need to paste. So even in a Ctrl-C, Ctrl-V workflow, I'm using the mouse as much.
If you're using something like vim or emacs then yeah I would agree with you but for something like docker commands, there's just no easy way to copy a specific container ID without using the mouse (if there is let me know lol).
My logic is if your hand is already on the mouse, it's going to be faster to paste with a mouse than your keyboard.
> for something like docker commands, there's just no easy way to copy a specific container ID without using the mouse
Some terminals have a mode where you can move the cursor around the history, and allow searching / copying / pasting. Alacritty and tmux come to mind, others may also implement something similar.
Not sure what you mean by cryptographic strength - they are both Unique ID generators, not meant for anything related to cryptography.
UUIDv7 has 62 bits of random data, ULID uses 80 bits, so if anything ULID is "stronger" (meaning less chances of generating the same id within the same millisecond)
I stumbled over your string art turtle some time ago
and like one of the commenters on [1], I was wondering about your tool to create points from a image
Thanks! If you wanna do more, i wrote a bit about it on x/twitter, recently 3d printed an object to actually test such string art. if you have specific questions, happy to answer ofc!
https://x.com/mknol/status/1993708617586077928
Different countries have different laws regarding what falls under freedom of speech. The CDN providers say they take a net-neutrality stance. If a court order from a specific country tells them to block certain sites, I'm pretty sure they will comply, but only for clients coming from within that country.
An obvious problem with this analogy is that the percentage of Cloudflare's traffic which could be Nazis even if they were hosting all the Nazis in the world would still start with a 0 followed by a decimal point.
There is no threat of any particular service being overrun with any particular ideology. That isn't how this works. If the same host is hosting the websites of both Israeli and Muslim groups, neither of them would even be aware of the other being on the same servers unless somebody told them.
Moreover, Cloudflare is the CDN being blocked by foreign ISPs because their laws require ISPs to do blocking on the basis of IP address even though Cloudflare's IP addresses are shared by huge numbers of other customers. It's effectively an attempt to punish international companies for having customers who do something which is illegal in one country even if it's legal in their own country, e.g. some content is in the public domain in one country but not another. It's an attempt to apply one country's laws to another country.
Which is a trade barrier because it prevents a company from serving the customers in both jurisdictions, creating a preference for domestic companies that don't operate in the jurisdictions with less restrictive laws.