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

[Spec] Essentials Dependency #19

Closed
Tracked by #22
hartez opened this issue May 18, 2020 · 9 comments
Closed
Tracked by #22

[Spec] Essentials Dependency #19

hartez opened this issue May 18, 2020 · 9 comments
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info proposal/open t/enhancement ☀️ New feature or request

Comments

@hartez
Copy link
Contributor

hartez commented May 18, 2020

Description

Take a dependency on the Essentials library. This will eliminate some of the overlap between this SDK and Essentials.

Overlapping APIs

These are APIs which are currently provided by both Forms and Essentials. Any additional functionality which Forms has will be ported to Essentials, and the Essentials APIs will be used.

App Theme

Light and Dark theme info.

Color Converters

Methods for converting color data to and from cross-platform Color.

Device Display Metrics

Informations such as screen size, density, and rotation.

Device Info

This includes information such as the device's Platform and Idiom.

Preferences/Properties

A simple persistent key/value store.

UI Thread Invocation

The Essentials implementation of UI thread access relies on a static MainThead class which is incompatible with multi-window applications on some platforms. We will need to maintain the current Forms Dispatcher pattern or modify Essentials to follow that pattern.

Backward Compatibility

For folks relying on functionality currently provided by Forms which will be dropped in favor of the Essentials version, this will be a breaking change.

Difficulty : Low

This will mostly be a matter of removing the Forms code which is duplicated in Essentials.

@akamud
Copy link
Contributor

akamud commented Nov 17, 2020

I would like to understand and discuss the pros and cons of this.

I understand some features are overlapping, but I'm not a fan of the whole Essentials package becoming part of the SDK, specially because Essentials doesn't have interfaces by default, and would cause problems for unit-testing again (something that is being fixed in MAUI).

At the end of the day, what other benefits do we have in bringing Essentials in? People can always add Essentials when needed, is it worth considering removing the duplicated APIs from new versions of Essentials itself?

@hartez
Copy link
Contributor Author

hartez commented Nov 19, 2020

@akamud I realize that Essentials doesn't provide interfaces out of the box, but is there something about the API design which prevents you from creating your own interfaces for the parts of Essentials you're using?

@akamud
Copy link
Contributor

akamud commented Nov 23, 2020

Not really, indeed, I always install Essentials.Interfaces right after I install Essentials, I guess the discussion here is more about the philosophical stance that adding Essentials would cause... When people that are new to the platform see Essentials installed with no interfaces, they might be taken to a direction of writing coupled apps that are more difficult to test. (This is an assumption from my part, maybe you have some data that can bring more facts to this discussion?)

With that in my mind, I'm more interested in understanding what is the big gain from the SDK point of view, since everything is a "nuget-install" away. I might be underestimating the APIs overlapping problem here too, after all, I'm not a maintainer in any of those projects.

Do you see any other advantage with this approach other than fixing the overlapping problem?
Also, do you think removing the overlapping in the Essentials end has any negative impact?

@pictos
Copy link
Contributor

pictos commented Nov 23, 2020

Will the Xamarin.Essentials (XE) become System.Devices? (Maybe I missed something) If yes makes sense to remove this overlap right now, when Maui is in the early stages.
About XE and Interfaces, I think the right place to add this feature-request is on the XE repo, there is a good (at least for me) reason that XE doesn't have interfaces, but maybe this reason doesn't make sense when it becomes System.Devices.

@hartez
Copy link
Contributor Author

hartez commented Dec 18, 2020

The big gain in removing the overlap is that we'll only have to maintain one implementation for each thing which overlaps. Right now, the Forms team and the Essentials team (which themselves overlap a lot) are fixing bugs and improving code in multiple places to do the same things. It also reduces documentation maintenance.

Plus combining them reduces the confusion for developers who add Essentials to a Forms project and suddenly have multiple ways to get the screen size, convert colors, etc. Or folks who use the default templates, which already includes Essentials.

@akamud
Copy link
Contributor

akamud commented Dec 18, 2020

I think I get the whole picture now, thanks for taking the time discussing this :)

@PureWeen
Copy link
Member

PureWeen commented Feb 2, 2021

@Tommigun1980
Copy link

The big gain in removing the overlap is that we'll only have to maintain one implementation for each thing which overlaps. Right now, the Forms team and the Essentials team (which themselves overlap a lot) are fixing bugs and improving code in multiple places to do the same things. It also reduces documentation maintenance.

Plus combining them reduces the confusion for developers who add Essentials to a Forms project and suddenly have multiple ways to get the screen size, convert colors, etc. Or folks who use the default templates, which already includes Essentials.

Doesn’t this just mean that Essentials has overlapping features with Xamarin.Forms?
I mean what is the point in Essentials providing functionality that already exists in Forms, shouldn’t it be Essentials that is cleaned up?

And by extension, if Essentials removes the overlapping features, would it still make sense for Forms to add a dependency at that point?

rookiejava referenced this issue in rookiejava/maui Jun 23, 2021
lytico referenced this issue in lytico/maui Aug 19, 2021
@Eilon Eilon added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Sep 16, 2021
@mattleibow
Copy link
Member

Related to #1965

@Redth Redth closed this as completed Nov 2, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Feb 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info proposal/open t/enhancement ☀️ New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants