January 2020
Intermediate to advanced
640 pages
16h 56m
English
You have probably heard of the don't repeat yourself (DRY) principle before. The main idea behind DRY is to avoid code repetition by aiming to write reusable code that can be included where required. But is DRY always a good idea?
Go packages serve as a nice abstraction for organizing code into modular, reusable units. But, generally speaking, a good practice for writing Go programs is to try to keep your import dependency graph shallow and wide; this sounds counter-intuitive considering it's probably the exact opposite of what the DRY principle advocates: include instead of repeat.
When the dependency graph becomes deeper, circular dependencies become more likely, this time due to transitive ...