express icon indicating copy to clipboard operation
express copied to clipboard

Clean architecture example

Open alfonsograziano opened this issue 1 year ago • 12 comments

Copy of the PR for the master version. The goal is to add an example on how to use Express with the Clean Architecture approach

alfonsograziano avatar Jul 03 '22 05:07 alfonsograziano

I'm getting an "Unexpected identifier" error up to Node v 6.17. Installing that version of node locally I'm not able to make tests run. Could someone help me? Or maybe we can publish the ES5 version that works fine and add a comment that tells users to use ES6 classes instead

alfonsograziano avatar Jul 03 '22 10:07 alfonsograziano

Hi @dougwilson could you merge the pr? Or do you have other advice to improve the example? :)

alfonsograziano avatar Jul 10 '22 20:07 alfonsograziano

Thanks for your work! I can't help but notice this example seems very similar to our mvc example, splitting the apps into sets of object operations by file and such. What are the differences this example does from the mvc one?

dougwilson avatar Jul 10 '22 21:07 dougwilson

Thanks for your work! I can't help but notice this example seems very similar to our mvc example, splitting the apps into sets of object operations by file and such. What are the differences this example does from the mvc one?

Good question! When I was studying the clean architecture I made myself the same question. The answer is subtile. We can say that the Clean Architecture is a set of principles that you have to follow when you create the architecture. You can build really complex architectures like this (but I wanted to keep the example simple).

MVC (for some aspects) could be seen as a subset of Clean Architecture but the use of MVC doesn't guarantee the respect of all the Clean Architecture rules.

You can find more in this topic.

alfonsograziano avatar Jul 11 '22 04:07 alfonsograziano

Hi @import-brain, sorry for the ping but I don't know how to progress with this PR. Do you think it could be merged or are required other approvals?

alfonsograziano avatar Jul 14 '22 19:07 alfonsograziano

Hi @import-brain, sorry for the ping but I don't know how to progress with this PR. Do you think it could be merged or are required other approvals?

No worries :)! I do not have PR merge permissions on this repo. @dougwilson, what do you think?

import-brain avatar Jul 14 '22 19:07 import-brain

Sorry about that, thanks for the ping! So I guess reading your response there, I'm just really confused. Does "Clean Architecture" mean something? Is there a link to where that is defined? I thought that was just a term you were using to describe your example and didn't mean anything further :)

dougwilson avatar Jul 14 '22 19:07 dougwilson

Sorry about that, thanks for the ping! So I guess reading your response there, I'm just really confused. Does "Clean Architecture" mean something? Is there a link to where that is defined? I thought that was just a term you were using to describe your example and didn't mean anything further :)

Hi, sure! Clean Architecture is the name of the book by Robert C. Martin (the same author of the book Clean Code) and describes a set of rules and best practices to create scalable architectures. You can find the book on Amazon and by searching onine you can find other releated resources :)

alfonsograziano avatar Jul 15 '22 05:07 alfonsograziano

Sorry about that, thanks for the ping! So I guess reading your response there, I'm just really confused. Does "Clean Architecture" mean something? Is there a link to where that is defined? I thought that was just a term you were using to describe your example and didn't mean anything further :)

Hi @dougwilson i think the main difference between this example and the mvc is the usage of that pattern, this example in my opinion is a pure backend microservice which expose some REST api (a crud in this case). The mvc example looks like server side rendering, it expose some url in GET and return an html template to render. Also if we watch in deep, in this pull request we can see an Object Oriented way (obviusly with common js compatibility 😃) but that is the idea behind it.

bozzelliandrea avatar Jul 15 '22 20:07 bozzelliandrea

HI @dougwilson! Sorry for the ping XD. I would really appreciate a feedback on the PR if you have time. I have followed your advice. Now I think everything is correct :)

alfonsograziano avatar Jul 24 '22 20:07 alfonsograziano

Hi @dougwilson :) I see that the RR is still pending. Would you consider merging it? :)

alfonsograziano avatar Oct 06 '22 19:10 alfonsograziano

Hi @dougwilson, do you think is worth merging it? If not, I can just close the PR to keep the repo as clean as possible :)

alfonsograziano avatar Apr 16 '23 12:04 alfonsograziano