Layered Design in Go

(jerf.org)

55 points | by misonic 7 hours ago

6 comments

  • nickcw 54 minutes ago
    In my opinion, not allowing circular dependencies is a great design choice for building large programs. It forces you to separate your concerns properly.

    If you get a circular dependency something is wrong with your design and the article does a good job on how to fix them.

    I sometimes use function pointers which other packages override to fix circular dependencies which I don't think was mentioned in the article.

    My only wish is that the go compiler gave more helpful output when you make a circular dependency. Currently it gives a list of all the packages involved in the loop which can be quite long, though generally it is the last thing you changed which caused the problem.

  • breadchris 3 hours ago
    great blog post! also this website has a lot of incredible posts, if you like learning about functional programming, you should check out

    https://jerf.org/iri/blogbooks/functional-programming-lesson...

  • kubb 2 hours ago
    Cool description of how jerf thinks about packages and how he deals with circular dependencies!
  • rapidlua 2 hours ago
    > Packages may not circularly reference each other.

    Actually possible with go:linkname.

  • pjmlp 2 hours ago
    Looks like I am reading a book about Yourdon structured method.
  • __s 5 hours ago
    Kind of reminds me of the concept of spheres in randomizers