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

Result is both a namespace and a type #93

Open
MisinformedDNA opened this issue Jun 20, 2022 · 5 comments
Open

Result is both a namespace and a type #93

MisinformedDNA opened this issue Jun 20, 2022 · 5 comments

Comments

@MisinformedDNA
Copy link

As of #89, Result is both a namespace and a type. This is bad practice. Conceptually, the type name is ideal, but the namespace already exists.

Thoughts?

@ardalis
Copy link
Owner

ardalis commented Aug 2, 2022

Agreed and it's a problem. Obviously would be a breaking change. I think the type name should remain which means the namespace and possibly the package would need to change. Thoughts?

Ardalis.Result (obsolete/redundant)
Ardalis.ResultAbstraction
Ardalis (nothing else - would get confusing with all the other Ardalis.* packages, etc.)
Ardalis.Types
Ardalis.ReturnTypes
Ardalis.Abstractions

other ideas?

@MisinformedDNA
Copy link
Author

MisinformedDNA commented Aug 2, 2022

I like Ardalis as the namespace and Ardalis.Result as the package name since it doesn't actually need it's own namespace. That's also true for most/all of your other libraries, they don't need their own namespaces. If you don't want them in the base namespace, Ardalis.Extensions is a good option as well.

Giving a namespace to something as narrow as Result classes is hard since it's not a logical grouping of anything but itself.

But if you want to a separate namespace for just Result classes:

Ardalis.ResultAbstraction
Ardalis.ResultHelper
Ardalis.Results
Ardalis.OperationResult
Ardalis.SmartResults
Ardalis.ReturnResult

@ardalis
Copy link
Owner

ardalis commented Aug 2, 2022

Ardalis.Results came up in Discord and is one I'm leaning toward. Still considering if we should also do something to help differentiate from the new IResult type in minimal APIs in ASP.NET Core 6+, as well.

@KyleMcMaster
Copy link
Collaborator

KyleMcMaster commented Aug 3, 2022

Here are some examples from two other popular result libraries.

This uses the root namespace CSharpFunctionalExtensions which would translate to simply Ardalis
https://github.com/vkhorikov/CSharpFunctionalExtensions/blob/master/CSharpFunctionalExtensions/Result/Result.cs

This uses LanguageExt.Common
https://github.com/louthy/language-ext/blob/main/LanguageExt.Core/Common/Result/Result.cs

Neither seem to be ideal for this situation so my vote would be to use the plural form Ardalis.Results.

@MisinformedDNA
Copy link
Author

The namespace of the derived classes of IResult is Microsoft.AspNetCore.Http.HttpResults, which isn't too far off from Results.

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

No branches or pull requests

3 participants