exercism / v3

The work-in-progress project for developing v3 tracks
https://v3.exercism.io
Other
170 stars 163 forks source link

[C#] Implement new Concept Exercise: expression-bodied-members #1145

Closed ErikSchierboom closed 4 years ago

ErikSchierboom commented 4 years ago

This issue describes how to implement the expression-bodied-members concept exercise for the C# track.

Getting started

Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:

Please also watch the following video:

Goal

The goal of this exercise is to teach the student more advanced aspects of the Concept of Expression-bodied Members in C#.

Learning objectives

Out of scope

Concepts

This Concepts Exercise's Concepts are:

Prequisites

This Concept Exercise's prerequisites Concepts are:

Any data types used in this exercise (e.g. strings) should also be added as prerequisites.

Resources to refer to

Hints

After

Representer

This exercise does not require any specific representation logic to be added to the representer.

Analyzer

This exercise does not require any specific analyzer logic to be added to the analyzer.

Implementing

To implement this exercise, please follow these instructions.

Help

If you have any questions while implementing the exercise, please post the questions as comments in this issue.

mikedamay commented 4 years ago

@ErikSchierboom This a first go at a refactoring exercise. You will recognize it.

Please have a look at ExpressionBodiedMembers.cs - the starting point, Example.cs - the refactored code, and insructions.md.

ErikSchierboom commented 4 years ago

I do recognize it: space-age. What comments are you looking for? On this actual exercise or on the idea of the refactoring exercise?

mikedamay commented 4 years ago

Do you think this will work as an exercise?

ErikSchierboom commented 4 years ago

I'm not sure. There are some things I'm not sure about. My biggest concern is that this is an extremely trivial exercise, especially if one uses an IDE that does refactoring. Maybe paring it with another concept could help with that (not sure which concept that is). Maybe something expression related, like the ternary operator or switch expressions.

Regarding the actual expression-bodied members contents:

mikedamay commented 4 years ago

I'll take that as a no.

I think ternary would go well. I will add a property to something else and a failing use case.

Not so keen on constructors. Side-effects don's seem to be in the spirit of expression-bodied-anything. But, that could be just me.

mikedamay commented 4 years ago

Thanks for the input

ErikSchierboom commented 4 years ago

Not so keen on constructors. Side-effects don's seem to be in the spirit of expression-bodied-anything. But, that could be just me.

I understand this reasoning. I personally like using expression-bodies whenever I can, including void methods. But maybe that's also just me :) As long as we're mentioning that you can use them in a constructor, I'm fine with not having them in the example.

P.S. Were you intending to use the space-age exercise? The idea for the Concept Exercises is for them to be newly designed, so that would rule out using a practice exercise (unless it is for inspiration).

mikedamay commented 4 years ago

closed by PR #1880 Expression-bodied-memebers