Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

[C#] Implement new Concept Exercise: parameters #1128

Closed
ErikSchierboom opened this issue Apr 7, 2020 · 8 comments
Closed

[C#] Implement new Concept Exercise: parameters #1128

ErikSchierboom opened this issue Apr 7, 2020 · 8 comments
Assignees
Labels

Comments

@ErikSchierboom
Copy link
Member

ErikSchierboom commented Apr 7, 2020

This issue describes how to implement the parameters 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 the Concept of Parameters in C#.

Learning objectives

  • Know the difference between value and reference type parameters.
  • Know how to pass value types by reference using the ref, out and in modifiers.

Out of scope

  • Overload resolution.
  • ref returns.
  • ref locals.

Concepts

This Concepts Exercise's Concepts are:

  • parameters: know the difference between value and reference type parameters; know how to pass value types by reference using the ref, out and in modifiers.

Prequisites

This Concept Exercise's prerequisites Concepts are:

  • memory-allocation: know what value and reference types are and how they relate to memory usage, the heap and the stack.

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.

@ErikSchierboom ErikSchierboom added status/help-wanted Extra attention is needed type/new-exercise Add a new exercise track/csharp labels Apr 7, 2020
@ErikSchierboom ErikSchierboom changed the title [C#] Implement new Concept Exercise: reference-value-types [WIP] [C#] Implement new Concept Exercise: reference-value-types Apr 8, 2020
@ErikSchierboom ErikSchierboom removed the status/help-wanted Extra attention is needed label Apr 8, 2020
@ErikSchierboom ErikSchierboom added the status/help-wanted Extra attention is needed label Apr 8, 2020
@ErikSchierboom ErikSchierboom changed the title [WIP] [C#] Implement new Concept Exercise: reference-value-types [C#] Implement new Concept Exercise: parameters Apr 8, 2020
@mikedamay
Copy link
Contributor

Include use of discards

@mikedamay
Copy link
Contributor

I am thinking of enhancing the remote controlled cars exercise.

  • out parameters for fuel usage and tire wear
  • varargs for sponsor names
  • in parameter to move to structs where it makes more sense.
  • ref parameter awaits inspiration.

@mikedamay mikedamay self-assigned this Jun 17, 2020
@ErikSchierboom
Copy link
Member Author

I am thinking of enhancing the remote controlled cars exercise.

out parameters for fuel usage and tire wear

How do you envision this. Having a GetStatus method or something like that?

varargs for sponsor names

I like this!

in parameter to move to structs where it makes more sense.

Good use case. So this would be doing something with a struct but not modifying it.

ref parameter awaits inspiration.

Maybe have a method that gets passed a struct but does modify it? To contrast it with the previous in parameter case?

@mikedamay
Copy link
Contributor

a GetStatus method or something like that?

Yep.

Maybe have a method that gets passed a struct but does modify it? To contrast it with the previous in parameter case?

I did not really want to take structs as a dependency. ref makes sense with scalars. in pretty much needs structs to make sense and we can't enforce it with tests.

@ErikSchierboom
Copy link
Member Author

I did not really want to take structs as a dependency. ref makes sense with scalars. in pretty much needs structs to make sense and we can't enforce it with tests.

I wouldn't mind only having the in modifier in the after.md file only. From my experience, I've not seen it being used often. You?

@mikedamay
Copy link
Contributor

From my experience, I've not seen it being used often. You?

Never. As you say after.md is a good place for in. Maybe mentioned here and then elaborated in the after.md for structs.

So, unless you have any further thoughts, I will go ahead with out, varargs and ref which will probably clunk a bit. I may as well include default values (although they are introduced in the methods exercise and I suppose named parameters.

@ErikSchierboom
Copy link
Member Author

Named parameters are actually introduced in the basics exercise: https://github.com/exercism/v3/blob/master/languages/csharp/exercises/concept/basics/.docs/introduction.md But I'd say including them here too definitely makes sense.

@mikedamay mikedamay removed the status/help-wanted Extra attention is needed label Jun 19, 2020
@mikedamay
Copy link
Contributor

Closed by PR #1699

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants