Hi folks, any ideas for better naming my result.kt...
# codingconventions
g
Hi folks, any ideas for better naming my result.kt sealed class? Im not really fond of Result.kt. Although tbh, it indeed returns the result
j
Is this for a generic framework/function? In general you're better off using actual names from the domain
g
In my case no its not for a generic function. It returns some tokens in case of success otherwise something else for failure. I trying to write code for solid-oidc (lets say some random spec). Should i name my sealed class something like SoilidOidc ? Is it ok? Or should i be more clear on what is this?
j
That would be going in the right direction, but it's hard to help without more details about what the sealed class represents in case of failure
g
Copy code
public sealed class SolidOidc {
    
    public class Success(public val tokens: String) : SolidOidc()

    public sealed class Error(public val something: String) : SolidOidc() {

        public class IOError(public val error: String) : Error(error)
        
        public class NetworkError(public val error: String): Error(error)
        
        public sealed class AuthenticationError(public val error: String): Error(error) {
            // TODO different scenarios based on auth
        }
    }
}
Something like this i guess
In case of failure it will no longer return tokens but the appropriate message, in some scenarios it will even hold a throwable
j
Then maybe something like
TokenResult
hints at the fact that it contains tokens or an error.
SolidOidc
would be a bit too generic here, since it doesn't say what it contains, it's the name of the whole protocol
g
Ok, really thanks for the pointers!