Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very interesting article about Clean Architecture. #2

Open
kolkov opened this issue Feb 18, 2020 · 5 comments
Open

Very interesting article about Clean Architecture. #2

kolkov opened this issue Feb 18, 2020 · 5 comments
Assignees

Comments

@kolkov
Copy link

kolkov commented Feb 18, 2020

Hi, Qiang! I found nice article about Clean Architecture in Golang. Did you read it?
I like that the presenter extracted from Use Case layer. In our starter it hardcoded in service. And good solution, that this example fully independent from routing library.
And good, that controllers are stay clean.

Thanks!

https://medium.com/manato/clean-architecture-with-go-bce409427d31

@qiangxue
Copy link
Owner

Thanks for the pointer. I just read the article and the code in the repo. I don't fully agree with some of its designs.

  • The package/directory layout: the code is scattered in multiple places. It's very difficult for someone to figure out what code needs to be updated/added when implementing a new feature or usecase.
  • The layout doesn't "scream" - it doesn't tell you what this project is for by just looking at the structure.
  • The decoupling of controller and presenter is fine, but not always necessary. This is achieved in my project in the api layer. That is, the api layer is responsible for data transformation between input/output and those expected by the service layer. If the transformation is very complex, it is certainly a good practice to create a separate layer/class to handle them. Otherwise, creating extra layer/class just for the purpose of perfectness of the code is bad because it increases code complexity.

I do agree with what the author says in the "The only rules you need to know" section.

While designing and implementing this project, I researched nearly every repo that claims implementing the clean architecture. I found most of them try to implement the architecture in a very dogmatic way, and the end result is that they become extremely complex and thus receive little interest from practical adoption.

@kolkov
Copy link
Author

kolkov commented Feb 18, 2020

Yes I agree, your groupping structure is best for me. But some features from that project are useful for my opinion.

@qiangxue
Copy link
Owner

Good to hear that. Could you share what are useful and how you will use it?

@kolkov
Copy link
Author

kolkov commented Feb 18, 2020

Yes! Now I do refactoring all my actual projects to this new starter. I split it into microservices. When I will get some statistic I will send your my feedback.)

@sunjayaali
Copy link

https://github.com/go-kit/kit/tree/master/examples/shipping

also good reference. I like how they compose an existing service into something called instrumenting service for metrics or something.

Good job everyone :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants