-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding initial writeup of wrapper-layer.md #28
Conversation
docs/wrapper-layer.md
Outdated
|
||
When a programmer writes code using Intl, the code they write should demonstrate their *intent*. They should use what I'm calling the *ergonomic API* of OmnICU. | ||
|
||
A *logical API*, on the other hand, is one that is closely tied to specific to functional units, like currencies or measurement units. A logical API function should require a specific hunk of data and perform a specific task. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to specific functional units?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. added.
docs/wrapper-layer.md
Outdated
|
||
When a programmer writes code using Intl, the code they write should demonstrate their *intent*. They should use what I'm calling the *ergonomic API* of OmnICU. | ||
|
||
A *logical API*, on the other hand, is one that is closely tied to specific to functional units, like currencies or measurement units. A logical API function should require a specific hunk of data and perform a specific task. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what we call business logic or low level API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm calling it "logical", but you could also call it "low level", etc. Not sure if "business" invokes the correct meaning.
docs/wrapper-layer.md
Outdated
|
||
Although ergonomic APIs correspond with what users of i18n intend to do, from an implementation standpoint, they are often quite heavy-weight, pulling in many dependencies that may not be required for all call sites. Intl.NumberFormat is an example: it supports currency formatting, which requires a lot of code and data, but when formatting a number that's not a currency, you shouldn't need to carry all that extra code and data. | ||
|
||
The goal of the *wrapper layer* is to provide an ergonomic API for clients, but map it to the logical API under the hood. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So to clarify:
- Wrapper layer implements ergonomic API
- Is resolving user request (options, locale,...) into potential data fetch, and is passing data to logical API under the hood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Clarified in the paragraph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made these comments 1+ weeks ago, but I don't think I clicked the button in the Github UI to submit them...
Ping for review/approval |
Whoops, I should change |
Also see #26
Closes #2