exercism / exercism/csharp-representer

Discuss selective application of representer

Open
#17 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Whilst many representer rewrites need to be applied to all exercises there are cases where a rewrite should be disabled for a particular exercise. For example, the `readonly` modifier should not be removed from code in the `constants` exercise where the concept is introduced.

The requirement to disable a rewrite for the exercise in which the related concept is introduced is fairly clear cut. However, the related issue of whether a rewrite should be disabled where its inclusion would prevent good/bad practice being reported to the student needs some discussion.

Which of the following is Excercism's position:

A. "Once a concept (which may be associated with some good practice or other) has been introduced then a rewrite that would suppress the good practice should be disabled and bad practice reported to the student"

or

B. "Reports to the student should be concerned only with the concepts that the exercise is designed to demonstrate"

Good practice relates to the writing of robust, maintainable and performant code.

These are the current C# rewrites:

| Rewrite | Concept | Excercise | Good Practice Importance |
| ------------------------|-------------------|---------------------|----------------------------|
| Add Braces | None | None | None |
| Expression extensions | ?? | ?? | ?? |
| Invert Neg Conditions | None | None | None |
| exponnt form to ucase | None | None | None |
| normalize identifiers | basics | basics | High |
| normalize whitespace | None | None | None |
| remove comments | None | None | None |
| optional parentheses | None | None | None |
| remove readonly | readonly | constants | High |
| remove usings | accessibility | namespaces | None |
| simplify bool equals | booleans | booleans | Medium |
| String->string | strings | strings | Low |
| Fully Qualified Name | basics | basics | Very Low |

Although _Identifiers_ are a major element in good practice and rewriting will eface them, the practicalities of representations rule out dealing with them as we would wish in the concept exercises.

Of the current rewrites, removing `readonly` has a fairly high impact on good practice and simplifying boolean expressions (`if (x == true) -> if (x)`) is medium to high. casing string less important and reducing fully qualified names is low (maybe because it would probably take care of itself - I think we are entitled to rely on that).

Three questions:

1. Should we disable rewrites for exercises where there is a dependency on a concept with high or medium importance?

2. Should we increase the number of exercises where concepts which have a high or medium good practice importance are taken as a dependency?

3. What kind of rewrites will be added to the representer in the future?

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are mentioned. Start by reviewing the current C# rewrite table and the three policy questions; this issue is done when the project has an agreed position on selective rewrites, concept dependencies, and future representer changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.