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

Code quality: consolidate xmlns #1673

Open
Jay-o-Way opened this issue Dec 2, 2024 · 5 comments
Open

Code quality: consolidate xmlns #1673

Jay-o-Way opened this issue Dec 2, 2024 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@Jay-o-Way
Copy link
Contributor

Jay-o-Way commented Dec 2, 2024

Just looking at the namespaces, see using:WinUIGallery.ControlPages for example. Well, I think this screenshot says it all...

Image

For reference: see PR microsoft/PowerToys#30728

@Jay-o-Way
Copy link
Contributor Author

Jay-o-Way commented Dec 3, 2024

Questions and bits

  • What's the difference between WinUIGallery.xxx and WinUIGallery.DesktopWap.xxx ?
  • Can't use "controls" for Microsoft.UI.Xaml.Controls, WinUIGallery.Controls, WinUIGallery.DesktopWap.Controls ánd CommunityToolkit.WinUI.Controls
  • Is muxc Microsoft.UI.Xaml.Controls in XAML files needed or not? See ControlExample and MapControlPage.
  • For what is IsApiContractPresent needed?

List

Let's decide on the proper namespaces here - (under construction) 🚧

xmlns: using: comment
? WinUIGallery
common WinUIGallery.Common ✔️
data WinUIGallery.Data ✔️
? WinUIGallery.Controls
? WinUIGallery.DesktopWap.Controls
? WinUIGallery.ControlPages
? WinUIGallery.SamplePages
toolkit CommunityToolkit.WinUI ✔️
animations CommunityToolkit.WinUI.Animations only in ControlExample ✔️
? CommunityToolkit.WinUI.Controls
converters CommunityToolkit.WinUI.Converters no WinUIGallery converters ✔️
animatedvisuals Microsoft.UI.Xaml.Controls.AnimatedVisuals only used on 2 pages
IsApiContractPresent delete ✔️

@marcelwgn
Copy link
Contributor

marcelwgn commented Dec 5, 2024

Thank you for creating this issue and starting the discussion! I think consolidating the xmlns namespaces sounds good though I wouldnt say "local" is a fixed name. From my experience, local usually often just refers to the namespace of the control. For other namespaces, I would generally follow the theme of taking the first letter of the individual parts so Microsoft.UI.Xaml.Media would be muxm.

Re API Contract: I think this was just missed when moving to WinUI 3 and cleaning up the UWP remnants.

@marcelwgn marcelwgn added the help wanted Extra attention is needed label Dec 5, 2024
@Jay-o-Way
Copy link
Contributor Author

Thanks. The combination local + WinUIGallery is actually very common in the repo, that's why I took the liberty to fill it in, as the first example. But if you want it to be something else, let me know. You can edit the above comment if you want.

I think it's a matter of preference to use abbreviations or words for the namespaces. Short words might be easier to decipher.

So, that means the API contract thing can be removed, am I right?

@marcelwgn
Copy link
Contributor

Thanks. The combination local + WinUIGallery is actually very common in the repo, that's why I took the liberty to fill it in, as the first example. But if you want it to be something else, let me know. You can edit the above comment if you want.

I think it's a matter of preference to use abbreviations or words for the namespaces. Short words might be easier to decipher.

Absolutely, I think I would hold off on making any changes until a few more folks chimed in on this matter. Generally speaking, I would say that the rules to determine the namespace should be as simple as possible and shouldnt require looking them up in a table or something.

So, that means the API contract thing can be removed, am I right?

Yes, we should be able to remove that now.

@Jay-o-Way
Copy link
Contributor Author

Jay-o-Way commented Dec 10, 2024

Idea: we could rename WinUIGallery.Controls to xmlns:internal="WinUIGallery.InternalControls"? Given the many other things that use the word "controls" - it's what this app is all about 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants