Type Summary
public class Authorization
{
// Constructors
public Authorization(string token);
public Authorization(string token, bool finished);
CF public Authorization(string token, bool finished,
string connectionGroupId);
// Properties
public bool Complete { get; }
CF public string ConnectionGroupId { get; }
public string Message { get; }
public string[] ProtectionRealm { get; set; }
}
|
DT
Avoid creating methods with Boolean parameters. Boolean parameters make calls harder to read and harder to write. Quick! What's the difference between Authorization("foo", true) and Authorization("foo", false)? There's no telling what those true/false parameters do on the inside. Adding an enum type AuthorizationCompletion with Pending and Finished members would allow those constructor calls to read Authorization("foo", AuthorizationCompletion.Pending) and Authorization("foo", AuthorizationCompletion.Finished). At the same time, it might make sense for the Complete property's type to be the same enum type as the constructor parameters, for consistency. |
|