Clean Architecture by Example in 5 Minutes
Vložit
- čas přidán 15. 06. 2024
- Applying the Clean Architecture is actually a lot simpler than you might think.
Join me at the black board and I show you how to design a feature step-by-step following the rules of the Clean Architecture.
One of the best youtube video on Clean Architecture, especially the explanation on dependency inversion principle which is the key technique of achieving inward dependency.
Thanks for making this video, please make more similar videos.
Thanks for this amazing tutorial. Do you have in plans to do an video about your VsCode configuration that you are currently using for .Net?
Thx! No plans for such a video yet but I just now published a community post, showing the VsCode extensions I have installed ;-)
Very informative. Any chance on sharing an example on how this would translate into code (from start to finish)? Thank you !
@shadowbit. Have a look here czcams.com/video/6hIg86y9HuE/video.html and here czcams.com/video/pfhDO_hZixw/video.html and here github.com/plainionist/AboutCleanCode 😉
@@AboutCleanCode Will definitely have a look at your suggestions.
Conceptually I think you did an awesome job in this video at describing how each component ought to be linked and/or connected in order to abide to the principles of the clean architecture, however, considering that I'm not a developer by trade, some aspects are a bit confusing and having a 1-to-1 mapping with a tangible example would make things much clearer; (especially when it's in Java or C++). I will give it a go nonetheless based on your described setup.
Thank you for the video! Im really curious to know what software you use for these animated diagrams! Would you share?
@DarrellTunnell I wrote my own small web app base on maxGraph JavaScript library 😉
Wow! Would you consider making a video about that project? I like working with diagrams as code and use things like mermaidjs or plantuml. They are very good for static diagrams but they don't have any support for animation. At the same time my PowerPoint skills are not great and I find it a huge time sink. So really I want a way to work programmatically but in a terse way, to create animated diagrams like yours! I'd be curious to learn from your experience before I attempt something myself :-)
@@DarrellTunnell At the moment the project is still in prototyping phase but I plan to release it as open source in some point of time. Until then I would recommend MaxGraph JS, it also has great examples to start with github.com/maxGraph/maxGraph/tree/development/packages/html/stories
Any recommended repo that applies to this?
@igeoorge3g the source code of most of my videos you can find here: github.com/plainionist/AboutCleanCode for this particular video I have no such repository. the case was derived from one of my projects at work which I cannot share online.
what if I have an embedded system. A mortar that should fire,tilt,pan. There is target and environment. The mortar has motors which are stepper motors they can change in the future. Are the motors part of the domain or I/O ?? (I have a motor abs class which has a calculateRequiredStepsFromAngle(angle) and there is an implementation based on the current motor) I want it this to become clean arch.
@botondvasvari5758 generally speaking, in Clean Architecture the I/O layer contains the code which interacts with the "outer world". In case of an embedded system this would be all code directly depending on the hardware and/or Operating System and/or device drivers. Any logic we can abstract from these technical details, any decision making i would put into the "entities" (domain model) or "use case" (application logic) layer. If you have a "motor" object which represents the real physical motor and which contains data and computation logic, then this class should be part of the domain or use case layer. But this class must not have any dependency to technical details. For that you would have a dedicated class e.g. MotorDevice which would then be located in I/O layer.
I think domain is an implementation detail. Usually we need different repres of the same object when we send it back as a response and different repres when we save into a dstastore, so DTOs. I always see too simple samples.
This example is very simple, agreed, but I have chosen it intentionally to focus on the basic ideas. I think it could be easily scaled to multiple responses, presenters and data stores. Or do you miss a particular aspect?
I like the video, can you make similar one about Onion?
Thx! I add it to my todo list ;-)
Looking forward to see it! One question : why did you stick to Clean Arch and not an Onion Arch? Any particular reason?@@AboutCleanCode
@marcin2828t I do stick with CA because I like the domain and the app logic being the center of the architecture with all technical details pushed to the most outer corners. I think this improves changeability and maintainability of the software a lot because business logic and technology can evolve independently.
As to my understanding Onion Architecture is quite similar to CA but so far I didn't had a deeper look at it or even used it in any project - maybe I should change this ;-)
Thank you for your answer. I'm the onion-man, and from what I can tell both architectures are not so different in the concept at all. I think that main difference is that layers and building blocks are named and sometimes placed differently. Soon I will be starting a new project for company I work for and I want to try something new. CA is one of the options. On the other end sits concept of Domain Model from DDD which I may incorporate into old good Onion without taking anything else that comes with DDD. There is a chance that I will make a terrible wrong decision and turn into Victor Frankenstein ;) @@AboutCleanCode
Personally, I think DDD and CA fit quite well together - same is probably true for Onion Arch and DDD