- "Function returning channel" is an important idiom.
- A complex problem can be broken down into easy-to-understand components.
- The pieces can be composed concurrently.
- The result is easy to understand, efficient, scalable, and correct.
- Maybe even parallel.
Concurrency is not Parallelism #55
- Concurrency is powerful.
- Concurrency is not parallelism.
- Concurrency enables parallelism.
- Concurrency makes parallelism (and scaling and everything else) easy.
Concurrency is not Parallelism #58
- They're fun to play with, but don't overuse these ideas.
- Goroutines and channels are big ideas. They're tools for program construction.
- But sometimes all you need is a reference counter.
- Go has "sync" and "sync/atomic" packages that provide mutexes, condition variables, etc. They provide tools for smaller problems.
- Often, these things will work together to solve a bigger problem.
Always use the right tool for the job.