-
Notifications
You must be signed in to change notification settings - Fork 4
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
Normalize API surface to use abstractions vs concrete implementations #93
Comments
@LarsSkovslund / @rickykaare / @davidkallesen / @perkops / @cjakobsen / et. al. please share your input on the suggested changes above. Here are a few questions/thoughts:
|
I support the suggested changes, it will improve usability of the generated code and add more flexibility in the generator. Why change the default value to Array.Empty()? I noticed that in Atc.Rest.Results.ResultFactory we use string[], changing this to IEnumerable could be another improvement. For the non-breaking part I suggest to just move ahead. For the breaking part we need to define the release process for this, including how this is communicated and versioned. |
@cjakobsen because |
That is correct but if we want to optimize for that as well then we should be even more crisp and use |
Interesting, wasn't aware of that. Looking at the code involved, I am not sure it is more "crisp" though: Array.Empty() is just an Enumerable.Empty() points to a EmptyPartition() that does seem to be a bit more complex. What are your reasons to prefer |
The generated code should follow the general API design pattern related to MA0016.
There many places in the generated code which could use abstractions instead of the concrete types. This will make it easier for us to change implementation details in the future without introducing a breaking change.
This issue should serve as a parent feature for updating all the parts of the code that can generate a collection type.
IEnumerable<T>
as input instead ofList<T>
.Non-breaking change.
IReadOnlyList<T>
for array properties instead ofList<T>
. The default value assigned to these should beArray.Empty<T>
. E.g.:public IReadOnlyList<string> Items { get; set; } = Array.Empty<string>()
Breaking change.
IReadOnlyList<T>
for array properties instead ofList<T>
. The default value assigned to these should beArray.Empty<T>
. E.g.:public IReadOnlyList<string> Items { get; set; } = Array.Empty<string>()
Breaking change.
Related: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0016.md
The text was updated successfully, but these errors were encountered: