exercism / csharp

Exercism exercises in C#.
https://exercism.org/tracks/csharp
MIT License
333 stars 339 forks source link

New exercise for Asynchronous programming in C# #1894

Open mdrakiburrahman opened 2 years ago

mdrakiburrahman commented 2 years ago

It would be great to have an exercise on Async programming as it is used in many real world dotnet applications.

The Golang track had one called "Prallel Letter Frequency"that introduce Goroutines, which I found quite useful.

ErikSchierboom commented 2 years ago

We have the same exercise (https://github.com/exercism/csharp/tree/main/exercises/practice/parallel-letter-frequency), but it looks like the implementation is actually wrong and uses synchronous code. Would you be interested in converting the exercise to allow for asynchronous (rather: parallel) programming?

mdrakiburrahman commented 2 years ago

@ErikSchierboom - sure! I've never contributed a scenario to Exercism - but if you can point me the necessary reqs (Unit testing etc) and assign the issue to me, I'm happy to contribute.

ErikSchierboom commented 2 years ago

@mdrakiburrahman You don't even have to create a new scenario, just to update the existing one to accommodate for people using parallel execution. So what I think needs to be done is to change the Calculate method to return a Task<Dictionary<char, int>> instead of Dictionary<char, int>. This means updating three files:

Finally, you should also add yourself to the exercise's contributors list in https://github.com/exercism/csharp/blob/main/exercises/practice/parallel-letter-frequency/.meta/config.json#L5

skurt commented 3 days ago

Hi, I stumbled upon this after watching and reading about a zillion hours of async/await training materials and still not being able to wrap my head around it. It looks like a good way to practice.

However - I seem to be missing the goal of the exercise - what to do and what the output should be? I ran the project ParallelLetterFrequency and it's ok. But I assume that downlading the project, making one default and running it isn't the point of async/await practise program.

So...what am I missing? Thank you