This is a post in the metronome-cacophony series.
Other posts in this series:

Metronome's Cacophony (13/14) - concurrency in Go - Video and Final Word

Asynchronous approach (ctd)

Channels (ctd)

Bonus contents ;)

Intro

Sorry for awful sound experience in this part (cutouts, crackling and volume deviations).
Subsequent parts went better and suffer mainly from my poor diction and stutter.

Counting Service

Timing Service

Volume Measuring Service

Beat Performing Service

Diagram

Communication and synchronisation in solution build with services.

Legend:

  • box represents a process dealing with a task (services, volume meter or beat performer)
  • cylinder on its side stands for a channel
  • filled arrowheads denote synchronous operation
  • empty arrowheads are asynchronous operations
  • dashed arrow is a return message

Final conclusion

Looking at Go, I can't help the feeling that its creators planned for concurrency while designing this language. Goroutines, channels or select statement does not feel like an afterthought but integral part of the language.
The code is compact and fairly easy to follow. It definitely is way less verbose and more readable than any other language I've used in the past.

I'm not pretending that solving concurrent problems is easy, quite the opposite. Having a good toolkit and solid understanding of it will get you halfway through the hurdle though.

Final word

I wish Go was enjoying much more intense adoption as it feels like a right choice for so many solutions. Especially if you are thinking of containerisation and/or microservice architecture it stands a good chance to compete with other languages.

I hope that the Metronome's Cacophony series helped you learn a thing or two about concurrency in general, Go's concurrency primitives as well as some techniques you can use for solving problems concurrently. If the lecture of it helped you implement a solution, please get in touch as it would be very rewarding for me to know. Otherwise I may have wasted a lot of time putting this series together. If you have any suggestions or you spot an error, also please get in touch.

Contact options are visible in the about section of my site.

Thank you!


This is a post in the metronome-cacophony series.
Other posts in this series: