I chose an API as I thought this would be the best way to offer this. Formatting phone numbers is incredibly difficult and is something that changes over time, so the code needs to be updated. What would some of the benefits be of doing this as a Library vs API?
I don't know if your service will be around later on.
I don't know if you will change the licensing terms.
I don't know if your server might be off for maintenance.
Those are basic things, but what it comes down to is that I don't have control over your offering. Why would I add so many dependencies, when I can do it locally, and KNOW it'll work.
On top of that, there's practical questions-
Why add latency for a round-trip request, when I could do it locally quicker?
What if I need to tweak your formatting? If it's a local lib, I can open the source code and add new types myself.
Sure, I might need to change code if a new type of telephone number is invented (??) but people release new versions of libraries, too.
It's cool to learn how to write an API, but I can't think of many sane people who would use yours in production.
Thats very true about whether I'll be around later on. It's one of the things that I guess must be built over time.
Regarding your points about a local lib, I'm not sure you're aware of how complex it is to format phone numbers. Numbers change depending on whether you're dialing within country, out of country. Sometimes there is a prefix that needs to be dialed when dialing from one city to another, within the same city, the same prefix would not need to be dialed.
Thats just for dialing numbers. Every country also has their own standard way of formatting numbers and other countries are a lot less standardized than the US, so for example, a phone number can have anywhere from 5 to 11 digits in Germany.
Basically, its a lot more work than just whipping up something locally. Thanks for the input though, its much appreciated.
7 comments
[ 3.6 ms ] story [ 21.9 ms ] threadFormatting telephone numbers is useful, but I don't see why people would want to call an external service to do it.
I don't know if your service will be around later on. I don't know if you will change the licensing terms. I don't know if your server might be off for maintenance.
Those are basic things, but what it comes down to is that I don't have control over your offering. Why would I add so many dependencies, when I can do it locally, and KNOW it'll work.
On top of that, there's practical questions-
Why add latency for a round-trip request, when I could do it locally quicker? What if I need to tweak your formatting? If it's a local lib, I can open the source code and add new types myself.
Sure, I might need to change code if a new type of telephone number is invented (??) but people release new versions of libraries, too.
It's cool to learn how to write an API, but I can't think of many sane people who would use yours in production.
Regarding your points about a local lib, I'm not sure you're aware of how complex it is to format phone numbers. Numbers change depending on whether you're dialing within country, out of country. Sometimes there is a prefix that needs to be dialed when dialing from one city to another, within the same city, the same prefix would not need to be dialed.
Thats just for dialing numbers. Every country also has their own standard way of formatting numbers and other countries are a lot less standardized than the US, so for example, a phone number can have anywhere from 5 to 11 digits in Germany.
Basically, its a lot more work than just whipping up something locally. Thanks for the input though, its much appreciated.