Any time you have 3 or more nouns in a name, it is probably poorly structured part. I.e. create a new package, simplify etc.
First of all, thank you for taking your time to make such a concrete proposal for improvement.The reason why main.go sits in root is because I haven't found a way of deploying (wercker/Heroku) without main in the root directory. I will have another shot at it.I would argue that DDD is not limited to a specific layout or architecture, although the current Hexagonal Archtecture for DDD is indeed common in many OOP languages. Finding a idiomatic architecture/design that still conveys the ideas of DDD is actually one of the biggest reasons why I'm doing this. I would say your code structure suggestion is very interesting for this very reason. I'm curious though, what you mean by hiding the details of the architecture?*EventService is actually what I'm currently working on. I'm experimenting with different ways of letting domain events be more of first-class citizens then they currently are. If you have any ideas on how communicating between packages using events, I would be very interested in hearing them.
What you are describing is a big reason why I decided to learn Go in the first place. I can't say I fully understand the simplicity of Go yet, but I now know enough to say that what I have done is simple not the Go way.
My goal at the moment, and the very reason I posted the project here, is to figure out if it's possible at all to refactor away the 'patternism' as you call it, or if I should scrap everything and start afresh with the knowledge I've gained along the way.
I would just like to point out that DDD really is not restricted to a certain paradigm. People have been successful in creating powerful domain models in functional languages where the OOP patterns don't apply. This of course begs the question, is Go really the programming language you'd want to use when modelling business logic. I believe it very much is, but it's still important to be critical about this as well.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/0hJuub86zpo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi. I'm sorry for the late answer, I didn't check in until now. Your perception is correct; Go is a light, quick and simple language. Some gophers like to call it a "get sh!t done"-language because building structured code is almost effortless.Most if not all concepts found in DDD and similar methodologies, guides, patterns and philosophies (SOLID; separation of concerns, the open-closed principle and so forth) are all based in the thoughts of people who spent years and years doing Java and other inheritance-oriented object-models like C++. It's hard to structure such applications well while at the same time keeping enough wiggle-room around to change things later. In that sense this wisdom is priceless and has saved many programmers countless hours of work.
But Go is not like Java or C++, Go is much smaller (C++ has 85 keywords, Java has 50, Go has 25). Also, there is no inheritance and embedding is something that is only rarely used. Add to that the novel approach to implicit interface implementation and you have a language where every package hosts its own dependencies and contracts and has clearly defined boundaries.The only conventions/patterns/rules we consider as "good practice" in the Go community is using the basic interfaces that the standard library provides (like io.Reader, io.Writer) whenever possible, instead of inventing new ones that do the same. Some additional common idioms are described in "effective go" (https://golang.org/doc/effective_go.html).After you've written some Go code you'll realize (or get the impression that) "patternism" as I like to call it has gotten out of hand; people doing design-patterns are more concerned with the form of their programs than actually shipping functional code. Hence stuff like the often mocked "ProviderBuilderFactoryFactory". That's why I called that function the antithesis of Go.
First and foremost problem with patterns is that people equate them with "good practice". A pattern is there to solve a concrete problem in a context. When you ignore the context and the problem it was meant to solve you get this "patternism". And many of the patterns assume the presence of an class oriented language. Also good Go does contain patterns (e.g. adding an interface/struct as a dependency is a pattern - dependency injection. )
I know this is an old thread, but I found it while searching for microservice project structure. I am just about to start modeling one for a new product we have. To keep it simple for now, I planned on one go project with a folder for each service/ar. I would then have other top level folders for any cross cutting, or other stuff that is not directly related to an aggregate root. I was thinking about using this ddd project as something to look at as a guide. I have also been looking into go-kit to use as well. We will be running each service as an aws lambda function.
Any thoughts, comments, suggestions on a decent way to model a microservices api project? It will be used for all anon/auth access into our core system.