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

Refactor handling of default parameters in method overloads #105

Open
JeremyCaney opened this issue Mar 21, 2022 · 0 comments
Open

Refactor handling of default parameters in method overloads #105

JeremyCaney opened this issue Mar 21, 2022 · 0 comments
Assignees
Labels
Priority: 1 Severity 2: Major Status 2: Scheduled Planned for an upcoming release. Type: Improvement Improves the functionality or interface of an existing feature.
Milestone

Comments

@JeremyCaney
Copy link
Member

JeremyCaney commented Mar 21, 2022

In “Framework Design Patterns”, under 5.1 “General Member Design Guidelines”, the following recommendations should be followed:

  • DO make only the longest overload virtual (if extensibility is required). Shorter overloads should simply call through to a longer overload.
  • CONSIDER using default parameters on the longest overload of a method.
  • DO provide a simple overload, with no default parameters, for any method with two or more defaulted parameters.

This is inconsistent with how OnTopic is written, which typically relies on one method with default parameters, even in interface and virtual methods. To mitigate this, we should implement explicit, non-virtual overloads for methods with default parameters.

For interfaces, these can be implemented as default implementations so that they don’t break existing implementations, nor require support for future implementations.

@JeremyCaney JeremyCaney added Severity 2: Major Priority: 1 Type: Improvement Improves the functionality or interface of an existing feature. Status 2: Scheduled Planned for an upcoming release. labels Mar 21, 2022
@JeremyCaney JeremyCaney added this to the OnTopic 5.2.0 milestone Mar 21, 2022
@JeremyCaney JeremyCaney self-assigned this Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 1 Severity 2: Major Status 2: Scheduled Planned for an upcoming release. Type: Improvement Improves the functionality or interface of an existing feature.
Projects
None yet
Development

No branches or pull requests

1 participant