Closed ErikSchierboom closed 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.
I do recognize it: space-age
. What comments are you looking for? On this actual exercise or on the idea of the refactoring exercise?
Do you think this will work as an exercise?
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:
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.
Thanks for the input
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).
closed by PR #1880 Expression-bodied-memebers
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:
expression-bodied-members
: know the difference between statements and expressions; know how to define expression bodied members.Prequisites
This Concept Exercise's prerequisites Concepts are:
classes
: know how to define methods on classes.constructors
: know how to define constructors.properties
: know how to define properties.indexers
: know how to define indexers.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.