Тёмный

Hexagonal Architecture: What You Need To Know - Simple Explanation 

Alex Hyett
Подписаться 39 тыс.
Просмотров 69 тыс.
50% 1

It is important when writing applications to pick the right architecture. Most software developers are familiar with the 3-Tier architecture model already, but few understand Hexagonal Architecture, which I cover in this video. Hexagonal Architecture, which was first coined by Alistair Cockburn in 2005 is a flexible architecture that is great for large applications.
☕️ I don’t accept paid sponsorships and I have turned off mid-video ads. You’re welcome! If you would like to support my channel see: ko-fi.com/alexhyett
📨 Join my free weekly newsletter for advice, technology and more: newsletter.alexhyett.com
🗺️ Backend Developer Roadmap: www.alexhyett.com/backend-dev...
📝 Related blog post: www.alexhyett.com/hexagonal-a...
🎓 RECOMMENDED COURSES (Use code FRIENDS10 for 10% off)
The Complete Web Developer Course - academy.zerotomastery.io/a/af...
The Complete Junior to Senior Web Developer Roadmap - academy.zerotomastery.io/a/af...
Complete SQL + Databases Bootcamp - academy.zerotomastery.io/a/af...
📚 RECOMMENDED BOOKS
Clean Code - geni.us/5AEwj2
Clean Architecture - geni.us/yBrTX
Domain Driven Design - geni.us/WiR0Q0x
Design Patterns - geni.us/5ncUt
Developer Hegemony - geni.us/lAXy
Pragmatic Programmer - geni.us/GfNj9
Data Structures and Algorithms Made Easy - geni.us/sqg6kJ
Refactoring - geni.us/ufAP0mE
The Productive Programmer - geni.us/IT9WiN
Pragmatic Thinking and Learning - geni.us/x81A
Test Driven Development - geni.us/HFV52
Microservices - geni.us/8vMA
💻 MY FAVOURITE GEAR
⌨️ Keyboard - Keychron K1 v4 - www.keychron.com/products/key...
🖱 Mouse - Logitech MX Master 2S - geni.us/qId7w
🎙 Microphone - Blue Yeti X - geni.us/0vZluGN
🎥 Camera - Logitech Brio 4K - geni.us/dcOcDQy
🚀 MY FAVOURITE TOOLS
PIA VPN - piavpn.com/AlexHyett (83% off + 4 extra months free!)
Visual Studio Code - code.visualstudio.com/
Obsidian - obsidian.md/
Notion - affiliate.notion.so/alexhyett
⏳ TIMESTAMPS
00:00 Introduction
00:11 3 Tier Architecture
00:46 Dependency Injection
01:04 Ports and Adapters Architecture
01:27 The Hexagon
01:34 The Port
02:31 The Adapter
03:05 Input Port and Adapter
03:28 Driving Side and Driven Side
03:39 Why is it called Hexagonal Architecture?
04:30 Domain Driven Design
04:58 STOP, Before you use Hexagonal Architecture
05:03 Pros and Cons of Hexagonal Architecture
05:08 Testability
05:28 Maintainability
05:55 Flexibility
06:20 Complexity in Code
06:36 Running Locally
06:58 Performance
07:24 Should you use Hexagonal Architecture?
You can check out more of my favourite tools on my website:
www.alexhyett.com/tech/
🔗 MY KEY LINKS
🌍 Blog - www.alexhyett.com/
🐘 Mastodon - social.alexhyett.com/@alex
🧑‍💻WHO AM I
I'm Alex, a Software Developer and RU-vid working in the UK. I make videos about software development to help developers with the skills they need to be senior developers. As well as this RU-vid Channel, I also write articles on my website (alexhyett.com) as well as write a regular newsletter that contains some thoughts to help aspiring developers.
‼️ DISCLAIMERS
Some of the links in this description are affiliate links, for which I get a small commission, at no extra cost to you 🙂. I appreciate you supporting my channel so I can continue providing you with free software development content!
#coding #programming #developer

Наука

Опубликовано:

 

19 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 114   
@drondiwe
@drondiwe Месяц назад
hate when I'm being asked like "have you heard of X architecture" and I never heard of it but it turns out that I was using it a lot and I just was asked about its fancy name
@oguzturkay
@oguzturkay 9 месяцев назад
I was trying to understand this concept for over 1 week. Things became clear when you quoted the founder saying calling a database is no different than calling/using an external service. I guess we could call it "Adapter Pattern everywhere". I think this subject is being told way more complicated than it actually is, but you kept it fairly simple. Nice explanation!
@alexhyettdev
@alexhyettdev 9 месяцев назад
Thank you! Yes Adapter Pattern everywhere sums it up nicely.
@prrs4809
@prrs4809 Месяц назад
Same here man, cheers for that quick expain!
@estevaoyt
@estevaoyt 3 месяца назад
Best explanation of hexagonal architecture! Thank you very much! Keep it up!
@danjelhysenaj4859
@danjelhysenaj4859 3 месяца назад
Hands down this is the simplest explanation that I have ever seen. Excellent Presentation Alex!
@alexhyettdev
@alexhyettdev 2 месяца назад
Thank you!!
@tim_abell
@tim_abell 11 месяцев назад
Thanks for including the downsides [00:06:17] - think you nailed it there, basically it's over-engineering unless you have a damn good reason to use it, and frankly I think the terminology introduces more confusion instead of reducing it. Great explanation of what it is and the alleged benefits are.
@alexhyettdev
@alexhyettdev 11 месяцев назад
Thanks Tim!
@fuadadio
@fuadadio Месяц назад
Thanks for the video. Your explanation is so clear and your animations are so helpful. The video is so clean. I can imagine the amount of work that goes into these videos. Thank you, Alex.
@BRNAMO
@BRNAMO 3 месяца назад
Thanks for the explanation! This video really helps me!
@Tolmachovtv
@Tolmachovtv 10 дней назад
Nice short and clear explanation. Thanks!
@vamankamath6329
@vamankamath6329 Месяц назад
Outstanding clarity.
@peterbyun441
@peterbyun441 Год назад
Thank you for your high-quality content. I love how you explain complex concepts with minimum jargon.
@alexhyettdev
@alexhyettdev Год назад
Thank you Peter!
@gabrielnzete8913
@gabrielnzete8913 Месяц назад
This is simply fantastic, many thanks sir
@storm14k
@storm14k 8 месяцев назад
Glad I found this! I'd run across the "no interfaces for repositories" crowd and we'd adopted it at my last gig but in all of my personal work I prefered them for this exact reason. And I especially try to make the interface only have read/write or store/retrieve methods as much as possible to avoid business context dripping down into the repo code. It starts with repo method names that reflect business terminology to me. And for the past 5 years or so I've been bouncing back and forth about the input side as well. Seeing it all in this one pattern has given me some things to consider. Thanks. You have a new subscriber.
@alexhyettdev
@alexhyettdev 8 месяцев назад
Thanks for commenting!
@jonathansilva3364
@jonathansilva3364 8 месяцев назад
Thank you for this simple explanation. I know there might be a lot more details to it, but you beautifully managed to remove the noise so the core concepts (ports and adapters) could shine. Thank you very much.
@alexhyettdev
@alexhyettdev 8 месяцев назад
You're very welcome! Thank you for commenting!
@GiPa98
@GiPa98 Месяц назад
Thank you for the video!
@PaulSebastianM
@PaulSebastianM Год назад
Great video. For me Clean Architecture and Hexagonal Architecture are just different ways to achieve the same thing: decoupling input and output and increasing feature cohesion. /subbed
@alexhyettdev
@alexhyettdev Год назад
Thank you! Yes they are both good options.
@sylvereleipertz955
@sylvereleipertz955 8 месяцев назад
That's 2 words for the same concept
@saralightbourne
@saralightbourne Год назад
from the perspective of an active learner, your channel is a treasure. thank you a lot, please don't stop doing what you're doing
@alexhyettdev
@alexhyettdev Год назад
You’re welcome! I am glad you like my videos.
@nnutkin
@nnutkin Год назад
This is indeed simple explanation. Thank you !
@alexhyettdev
@alexhyettdev Год назад
You’re welcome! I am glad it helped.
@khalidelgazzar
@khalidelgazzar 5 месяцев назад
Great video. Watched it a while ago and I keep coming back for a refresher.
@alexhyettdev
@alexhyettdev 5 месяцев назад
Glad you enjoyed it!
@desouzafelipe
@desouzafelipe Год назад
High quality explanation, thank you and good job!
@alexhyettdev
@alexhyettdev Год назад
Thank you, I am glad you enjoyed it!
@jhonjbautistab
@jhonjbautistab 9 месяцев назад
Me encanto el video, mil garcias por la explicación
@alexhyettdev
@alexhyettdev 9 месяцев назад
De nada, me alegro de que lo hayas disfrutado.
@soheil_a
@soheil_a 9 месяцев назад
Great, simple and clear explanation, keep it up!👍
@alexhyettdev
@alexhyettdev 9 месяцев назад
Thanks, will do!
@olliDeg
@olliDeg 10 месяцев назад
Great video! I hope you keep going and get the recognition you deserve!
@alexhyettdev
@alexhyettdev 10 месяцев назад
Thank you! 🤞
@danclarkeuk
@danclarkeuk Год назад
Great video - one of the clearest explanations I've seen! Nice work! 👍
@alexhyettdev
@alexhyettdev Год назад
Thanks Dan! I am having fun creating the animations. I am enjoying your videos too!
@danclarkeuk
@danclarkeuk Год назад
Thanks too. I'm finding editing RU-vid videos way more fun than podcasts! 😂 But perhaps that's just because video editing is so new at the moment, so a lot to learn!
@dralps
@dralps Год назад
Great explanations, thank you! I also have the same understanding, recursive hexagons
@alexhyettdev
@alexhyettdev Год назад
👍 thank you. I am gad you liked it.
@user-vt9qo5kz7g
@user-vt9qo5kz7g 9 месяцев назад
Very clear for a newbie as me. Thank you so much
@alexhyettdev
@alexhyettdev 9 месяцев назад
You're very welcome!
@sreescorner
@sreescorner 11 месяцев назад
Thank you for the very clear explanation and intuitive presentation
@alexhyettdev
@alexhyettdev 11 месяцев назад
You’re welcome! I am glad it was easy to understand.
@ZuHoLee
@ZuHoLee Год назад
Awesome content! Keep going bro!
@alexhyettdev
@alexhyettdev Год назад
Thanks Hoang!
@user-lz3su5cr3s
@user-lz3su5cr3s 9 месяцев назад
Super! Thank you, was really helpful.
@alexhyettdev
@alexhyettdev 9 месяцев назад
You're welcome!
@danyald4880
@danyald4880 Год назад
Wonderful explanation !
@alexhyettdev
@alexhyettdev Год назад
Thank you!
@achillesnakmuay
@achillesnakmuay 6 месяцев назад
Hey Alex, Fantastic content, you explain these concepts in a clear and concise manner which is great. What is your opinion on using these patterns on the frontend? I have a large Vue app and I'm trying to decide between Hex or DDD architecture. Do you have any suggestions?
@lucasdebritoarruda7831
@lucasdebritoarruda7831 Год назад
Great video! Won a new subscriber!
@alexhyettdev
@alexhyettdev Год назад
Awesome! Thank you!
@user-nt9bo3ub6k
@user-nt9bo3ub6k 6 месяцев назад
Very Good explanation. Thank you
@alexhyettdev
@alexhyettdev 6 месяцев назад
Thank you!
@user-wl6bm8cx9z
@user-wl6bm8cx9z 7 месяцев назад
You are Nutshell explainer. I appreciate your skills. Kudos to your Technical Perspective!
@alexhyettdev
@alexhyettdev 7 месяцев назад
Thank you! I like that, maybe I should have nutshell explainer as my tagline!
@sebon11
@sebon11 Год назад
Great explanation dude, as always
@alexhyettdev
@alexhyettdev Год назад
Thank you!
@SpringframeworkGuru
@SpringframeworkGuru 8 месяцев назад
Hey Alex - Just found your channel and subscribed. Great content and really nice job on your production! Kudos from the founder of Spring Framework Guru!
@alexhyettdev
@alexhyettdev 8 месяцев назад
Awesome, thank you!
@farooqmss
@farooqmss 8 месяцев назад
simply beautiful.
@alexhyettdev
@alexhyettdev 8 месяцев назад
Thank you!
@Mister_tea_
@Mister_tea_ Год назад
Great content. Thank you. And nice plant behind you )
@alexhyettdev
@alexhyettdev Год назад
Thank you! A little secret 🤫, it's not real 🤣. I am terrible with plants. I have always wanted a bonsai tree, but I knew if I had a real one, it wouldn't last very long!
@Mister_tea_
@Mister_tea_ Год назад
@@alexhyettdev I see, it is a mock plant )
@MrGenbu
@MrGenbu 11 месяцев назад
That brilliant 👏👏
@alexhyettdev
@alexhyettdev 11 месяцев назад
Thank you 🙏
@nb-th7kr
@nb-th7kr Год назад
thanks for this :)
@alexhyettdev
@alexhyettdev Год назад
You’re welcome, I hope it was helpful!
@mehtubbhai9709
@mehtubbhai9709 5 месяцев назад
Hi Alex. Absolutely love the content you're putting out. Could you or anyone else point me to some sample code that is a good example of the ports and adapters pattern. Thanks in advance.
@fadygamilmahrousmasoud5863
@fadygamilmahrousmasoud5863 11 месяцев назад
very informative
@alexhyettdev
@alexhyettdev 11 месяцев назад
Thank you, I am glad it helped.
@Rope257
@Rope257 9 месяцев назад
I program mostly in OOP-languages and sometimes I feel like patterns like this just provide wrappers around I/O that functional languages use types for. Good explanation though much appreciated.
@alexhyettdev
@alexhyettdev 9 месяцев назад
Thank you. Yes I should probably do a video on functional vs OOP languages.
@chastor1961
@chastor1961 Год назад
super
@alexhyettdev
@alexhyettdev Год назад
Thank you!
@armandoleon9901
@armandoleon9901 6 месяцев назад
I have a question. Say if you’re hitting an external api service to do some action, like create a deploy and I have followed the port adapter pattern. Now, say in the future that we switch to another api service with a completely different schema for creating the deployment. Do we leave the interface intact as it is, since the adapter pattern lets us transformer the data? What if the transformation is too awkward, i.e the new api requires more information than the previous api?
@browski999
@browski999 3 месяца назад
Great explanation, but it'll be good to have sample code examples to reinforce this concept😊
@justfair4181
@justfair4181 9 месяцев назад
the best explanation found over here, youtube
@alexhyettdev
@alexhyettdev 9 месяцев назад
Thank you!!
@josephgreene630
@josephgreene630 Год назад
Can you do some basic data structure to real world usage examples?
@alexhyettdev
@alexhyettdev Год назад
Sure I will add that to my content list. Thanks for the suggestion.
@dimitrisimeros3634
@dimitrisimeros3634 Год назад
So is it prerequisite the domain driven design in order to have an hexagonal architecture? If I am in a monolithic application, is this correct to split it as presentation-logic-database model and then think of domain driven logic? How to think in old legacy monolithic applications?
@alexhyettdev
@alexhyettdev Год назад
DDD isn't a prerequisite, it is just helpful when it comes to splitting a system into different microservices. You want each hexagon to be self-contained, and be able to work in isolation. That is just easier to do if it contains a whole domain and doesn't have to rely on other systems too much. I would personally start with domains first rather than presentation-logic-database modal. For example, I have seen teams take things like auditing out of their monolithic application and create an auditing domain. This then gets reused by all other applications that need auditing capabilities. The team will often then expand this to provide UI and other capabilities. The domains usually come first.
@dralps
@dralps Год назад
I think, inside the monolith, you can create little hexagons, encapsulating smaller domain concepts So, the answer is yes
@pedrocarmezim6905
@pedrocarmezim6905 7 дней назад
This is a good explanation, but.. Isn’t this a micro-services architecture, where the applications all talk json( for example) and the adapter only transform json to mysql( for example) for the databases, or strings/bits etc for filesystem buffers? The adapter will always change when tou pick another service to work with the app. Cool name though. Thanks
@PaulSebastianM
@PaulSebastianM 10 месяцев назад
I just did a revisit of this video. 5 months later, lol. I would want to add something though. You talk about whether someone should use HA, especially when they have a complex or large application, but don't list any alternatives for when they don't. For example, for a simple microservice, a simple MVC or 3 Layer + VSA approach could suffice.
@alexhyettdev
@alexhyettdev 10 месяцев назад
Yes good point. I assumed if someone was looking into hexagonal architecture they would know about the alternatives. Always good not to assume anything though!
@maryamrosetvgermany9259
@maryamrosetvgermany9259 12 часов назад
the name is changed to adapters and ports pattern
@___gg421
@___gg421 Год назад
Wow just want to leave a comment show I was here early once you blow up
@alexhyettdev
@alexhyettdev Год назад
Thank you! 🤞🏻
@AmexL
@AmexL Год назад
Same, I’m in the sub-3k group.
@hexchad765
@hexchad765 2 месяца назад
Ports and adapters, all day
@Enigma758
@Enigma758 9 месяцев назад
How is this any different from separating interface from implementation? Is there anything new here that hasn't been already been preached for decades?
@alexhyettdev
@alexhyettdev 9 месяцев назад
That is essentially what it is but explicitly making sure that your core code only relies on interfaces it owns and external components interact with a different interface. The idea is to completely decouple your inputs and outputs.
@gosnooky
@gosnooky 8 месяцев назад
He actually pronounced "hexagonal" properly. Also, it's a hexagon because hexagons are the bestagons
@alexhyettdev
@alexhyettdev 8 месяцев назад
Lol, how do other people pronounce "hexagonal"?!
@hexchad765
@hexchad765 2 месяца назад
Seems obvious but that there is a word for it
@user-xj9hn3fg8n
@user-xj9hn3fg8n 4 месяца назад
Since when trivial interfaces start to be called as "hexagonal architecture"?
@abellix
@abellix 4 месяца назад
Thanks God someone else is saying that as well
@joshblf
@joshblf 10 месяцев назад
Adapters sound like Facades. Am I missing something here? 🤔
@alexhyettdev
@alexhyettdev 10 месяцев назад
That’s essentially what they are. The Ports are facades as well but are written by the application. It is facades talking to facades for maximum abstraction.
@user-vy5se9ko4b
@user-vy5se9ko4b 11 месяцев назад
Legenardy explanation, I think a lot of people do not really explain this software architecture clearly, but your explain is super clear and helpful.
@alexhyettdev
@alexhyettdev 11 месяцев назад
Thank you, I try my best. I am glad it was clear for you. I should do some more of these 🙂
@sylvereleipertz955
@sylvereleipertz955 8 месяцев назад
I don't get the second con. Clean architecture or not, it make not difference to run it locally. You can have monolithic application with clean architecture, you would start it exactly the same
@alexhyettdev
@alexhyettdev 8 месяцев назад
It is more for when you have multiple components running as separate microservices as mentioned in the video. Yes for 1 component using clean architecture there is no difference.
@FlaviusAspra
@FlaviusAspra 10 месяцев назад
I was so happy to see people want to talk about hexagonal architecture. But while you made some absolutely true statements about it, so did you also make a lot of wrong ones, who would drive people away from it for the wrong reasons.
@alexhyettdev
@alexhyettdev 10 месяцев назад
It’s important to show both sides, it isn’t always the right architecture for everyone. There are always ways to mitigate some of the negatives it just depends how you design it.
@FlaviusAspra
@FlaviusAspra 24 дня назад
​@alexhyettdev the "other side" should be the correct "other side", so that people make informed decisions, not uninformed ones.
Далее
Domain Driven Design: What You Need To Know
8:42
Просмотров 97 тыс.
ЛИПЕР ДЛЯ ТЕЛЕФОНА 🤯
00:59
Просмотров 621 тыс.
🎙ПОЮ твои ЛЮБИМЫЕ ПЕСНИ 🌇
3:11:38
SOLID Principles: Do You Really Understand Them?
7:04
Просмотров 128 тыс.
Windows 10: End of Support! What You Need to Do Now
9:09
Hexagonal Architecture (All You Need to Know)
9:51
Просмотров 4,4 тыс.
How Senior Programmers ACTUALLY Write Code
13:37
Просмотров 1,3 млн
Why You Shouldn't Nest Your Code
8:30
Просмотров 2,6 млн
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
Software Architecture Tips I WISH I Knew Sooner
18:04
Why is Clean Architecture so Popular?
11:52
Просмотров 48 тыс.