Why You Should Think About SOFTWARE ARCHITECTURE in Python 💡

69,633
0
Published 2021-04-16
In this video, I talk about software architecture, what it is, and how it relates to writing code and software design. As an example, I show you how to implement a Model-View-Controller (MVC) architecture in Python and discuss a few other software architectures as well.

💡Here's my FREE 7-step guide to help you consistently design great software: arjancodes.com/designguide.

A few interesting links to articles and books:
- About Django's architecture: djangobook.com/mdj2-django-structure/
- Overview of software architecture patterns: towardsdatascience.com/10-common-software-architec…
- Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides: amzn.to/3jllgyH
- Principles of Package Design: Creating Reusable Software Components by Matthias Noback: amzn.to/2NETK3l
- Clean Code: A Handbook of Agile Software Craftsmanship by Robert Martin: amzn.to/3qVZgNs
- The original Design Principles and Design Patterns article by Robert Martin: fi.ort.edu.uy/innovaportal/file/2032/1/design_prin…

🎓 Courses:
The Software Designer Mindset: www.arjancodes.com/mindset
The Software Designer Mindset Team Packages: www.arjancodes.com/sas
The Software Architect Mindset: Pre-register now! www.arjancodes.com/architect
Next Level Python: Become a Python Expert: www.arjancodes.com/next-level-python
The 30-Day Design Challenge: www.arjancodes.com/30ddc

🛒 GEAR & RECOMMENDED BOOKS: kit.co/arjancodes.

You can find the code I worked on in this episode in my GitHub repository: github.com/arjancodes/betterpython

All parts in this series:
Part 1: Cohesion and coupling -    • Cohesion and Coupling: Write BETTER P...  
Part 2: Dependency inversion -    • Dependency Inversion: Write BETTER PY...  
Part 3: The strategy pattern -    • The Strategy Pattern: Write BETTER PY...  
Part 4: The observer pattern -    • Observer Pattern Tutorial: I NEVER Kn...  
Part 5: Unit testing and code coverage -    • 100% CODE COVERAGE - Think You're Don...  
Part 6: Template method and bridge -    • Two UNDERRATED Design Patterns 💡 Writ...  
Part 7a: Exception handling -    • Exception Handling Tips in Python ⚠ W...  
Part 7b: Monadic error handling -    • Monadic Error Handling in Python ⚠ Wr...  
Part 8: Software architecture -    • Why You Should Think About SOFTWARE A...  
Part 9: SOLID principles -    • Uncle Bob’s SOLID Principles Made Eas...  
Part 10: Object creation patterns -    • QUESTIONABLE Object Creation Patterns...  

🔖 Chapters:
0:00 Intro
0:45 What is software architecture?
1:38 Example: Django
2:21 Model-View-Controller (MVC)
2:57 MVC: code example
4:26 Creating the Model
4:43 Creating the View
6:57 Creating the Controller
9:23 Patching up everything
10:03 Improvement #1: creating an abstract View class
11:40 Improvement #2: adding a functional strategy design pattern
13:58 Analysis of the new code
14:49 Other software architectures
15:58 Final thoughts

👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!

🏆 Join my Discord server: discord.arjan.codes/
👥Twitter: twitter.com/arjancodes
👥LinkedIn: www.linkedin.com/company/arjancodes
👥Facebook: www.facebook.com/arjancodes

#arjancodes #softwaredesign #softwarearchitecture

Photo by Kimon Maritz on Unsplash: unsplash.com/@kimonmaritz

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content

All Comments (21)
  • @PawelOlas
    this is one of the best examples to introduce people to model-view-controller I have ever seen online. Love your videos.
  • @ArjanCodes
    If you're wondering: the quote on the letterboard is from Goethe. I'm still trying to figure out how it applies to software architecture, which seems to be closer to frozen yoghurt than frozen music.
  • Awesome video! I started Python around 6 months ago and have just recently started building larger projects. I realized immediately that software architecture was an entirely different skillset from the algorithm-centric coding problems most people think of when they think of learning to code. I think I actually find architecture the hardest part of SW dev. Love content like this that helps to understand it!
  • @brianhacker7346
    Model View Controller is the architecture pattern that I first learned years ago and I still use most in my work. Watching you explain it though, I did learn how to easily integrate the strategy pattern and the value in doing that. I just wanted to point out that you created the Model, but didn't have it do anything. I do recognize that this was a simple example. But, in this case, your controller class knows too much about the model's implementation and even dominates it. This was most apparent when you cleared the list of IDs, the controller did 'self.model.uuid = [] ', where you may have left it to the model to do this by issuing 'self.model.clearList' and let the model decide how best to clear the list. Still, this was a great walk through to demonstrate the value of good architecture.
  • @anelm.5127
    Please do more software architecture videos. Your design pattern videos are amazing but the architecture bread and butter is what I need in my life 😄
  • @MrWadood007
    Great video! I admire detailed description boxes a lot, this looks like a sign of a channel which will blow up soon.
  • @coldhardwick
    I know the youtube algorithm loves <20min videos, but I think you could easily push 30-45 minutes. Your content is top-notch.
  • I stumbled upon your channel while randomly going through different content and since then i cannot stop watching your videos. Great quality videos with a really nice way of teaching which keeps the video engaging till the very end.
  • @1oglop1
    This was a really great video! Finally showing the architecture in practice!
  • I would love to see a video on Hexagonal Architecture or Clean Architecture. I try to follow it while writing backend services, but your videos always make me realize something knew :)
  • @HasaniSaeed
    Your playlist is one of the best videos about software design . Thanks
  • @FurquimRafa
    Best example I could find about a MVC using python for desktop application. Thanks!
  • @MrWrklez
    I've been looking for this kind of content for a while. Just subscribed!
  • @user-hf5be1zu7s
    this video was amazing for me, like your videos in general. just thank you!
  • @djl3009
    Thank you! I enjoyed both the video and playing around with the code. I recently came across your channel and have been enjoying it immensely! For a future video on this architectural pattern, how about adding another alternate version that uses the Observer pattern for Model->View updates. If I remember correctly that is what Martin Fowler refers to as "Observer Synchronisation" in an MVC architecture. In your example you've implemented what he calls "Flow Synchronisation" where the Controller directly updates both the View and the Model directly as part of the input processing flow. With Observer Synchronisation the Controller updates the Model, and the Model notifies one or more Views via an implementation of the Observer pattern.
  • @AnIceCrasher
    Another great video making me aware of more to take into consideration 😅 And it is very awesome, that you explain it with a code example and then also use a design pattern to show the diffrence.