-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Breaking Change: Remove Unneeded Interfaces #9495
Comments
+1 for removing interfaces, it's especially confusing when creating libraries and deciding what to use (concrete class or interface). Also performance is a feature especially on wasm and mobile. |
One of the more tricky interfaces here might be Would people be comfortable with removing |
BTW, why aren't we using the WPF approach with |
Historical reasons really: back in 2015 when I didn't know anyone would ever use this project, I decided to implement it like that. Mostly because in WPF, I always forgot the step of setting a new default value for However if we want to change it to match WPF/UWP etc then now would be the time to do it. Bear in mind though that reading the default value of a styled property is a lot slower than reading a virtual CLR property, and we'd be potentially reading the property a lot more than WPF does due to our CSS-like styling system. |
I think just making it a virtual read-only property on |
We currently have many interfaces in Avalonia which mirror concrete classes, for example (list is not exhaustive):
IAvaloniaObject
->AvaloniaObject
IControl
->Control
IInteractive
->Interactive
ILayoutable
->Layoutable
IPanel
->Panel
IStyledElement
->StyledElement
ITemplatedControl
->TemplatedControl
IVisual
->Visual
These interfaces were added at the beginning of the project at a time where the prevailing fashion in unit testing was "create an interface for each concrete class in order to make it easier to mock".
This turned out to be a mistake because:
netstandard2.0
which includes platforms such as .NET framework where default interface implementations are not supported, meaning that we can't even add methods to these interfaces without breaking API compatibilityFor 11.0 we should remove these interfaces to improve performance. This will be a large breaking change, but we feel it's necessary, and the fix should be reasonably straightforward - remove a bunch of
I
characters.The text was updated successfully, but these errors were encountered: