Skip to content
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

Merged
merged 4 commits into from
Apr 30, 2020

Conversation

sffc
Copy link
Member

@sffc sffc commented Apr 8, 2020

Also see #26

Closes #2


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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to specific functional units?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. added.


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.
Copy link
Contributor

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?

Copy link
Member Author

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.


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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to clarify:

  1. Wrapper layer implements ergonomic API
  2. Is resolving user request (options, locale,...) into potential data fetch, and is passing data to logical API under the hood.

Copy link
Member Author

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.

docs/wrapper-layer.md Outdated Show resolved Hide resolved
@sffc sffc mentioned this pull request Apr 15, 2020
@sffc sffc linked an issue Apr 17, 2020 that may be closed by this pull request
@sffc sffc mentioned this pull request Apr 18, 2020
@sffc sffc requested a review from nciric April 18, 2020 00:17
Copy link
Contributor

@echeran echeran left a 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...

docs/wrapper-layer.md Outdated Show resolved Hide resolved
docs/wrapper-layer.md Outdated Show resolved Hide resolved
@sffc sffc requested review from hagbard and echeran April 22, 2020 01:54
@sffc
Copy link
Member Author

sffc commented Apr 30, 2020

Ping for review/approval

@sffc
Copy link
Member Author

sffc commented Apr 30, 2020

Whoops, I should change *ICU for X* to ICU4X. I'll do that in another PR right after this one.

@sffc sffc merged commit 918872d into unicode-org:master Apr 30, 2020
@sffc sffc deleted the wrapper-layer branch April 30, 2020 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Async or sync APIs IDL approach
4 participants