Search This Blog

Learning The Clean Architecture and Applying it While Doing BDD

No comments
The Clean Architecture



Uncle Bob Martin's Clean Architecture is one that I am aspiring to model my applications and Services by currently.


I realized that after thinking about it, when I was pairing with a couple 8th light guys in the past at a previous company, that they were implementing some of the Clean Architecture in our Web Service code.  At the time, I was not aware of the Clean Architecture Model (Onion).  I was defintely aware of creating layers and did create layers such as Repository, Business Objects, and all that.


But I realized that how I was doing that prior, wasn't quite clean.


So I am suggesting that if you really wanna build your architecture in a very simple and decoupled manor, I'm advocating The Clean Architecture model.  It very much mirrors the Hexagonal Architecture Model.


So if you would like to venture off learning more about it, then I suggest going about it in a certain fashion, and to go through these resources in a specific order below.  This order really helped me understand Applying the Clean Architecture (patterns, layers, etc.) along with incorporating that while you TDD the actual implementation.


Here's the order I suggest (my prescription).  There is specific content in here that piggies on one another.


Make these worth your while:

  • Set aside true quiet time away from kids or whatever..in your man cave if you have one
  • Watch each video in full.  Yes unfortunately this takes time and dedication.  Take a Saturday to do it, do it at night for 2-3 hours;...whatever you have to do to find time to watch each of these in full.  If you wanna learn, you gotta sacrifice.  But these resources are truly great ones below, you won't be sorry
  • Concentrate.  Listen to everything said very carefully, and definitely take notes..I always go back to my notes, I don't wanna re-watch it 100 times because I forgot everything
  • It'll take you weeks to get through all these but seriously watch them all, again the order here is important

First, Understand Clean Architecture



Then Understand Hexagonal Architecture 

  • The watch Decoupling from ASP.NET - Hexagonal Architectures in .NET - nevermind that this is titled .NET, Ian keeps things applicable and terms are not really geared toward .NET so this is a good watch for anyone .NET or not
    • A deep dive into truly understanding Hexagonal.  And Ian explains it like no other

Then Understand Keeping Things Simple

  • Then watch Rails Conf 2012 Keynote: Simplicity Matters by Rich Hickey
  • Then watch Keynote: 8 Lines of Code - which talks about how you really keep code simple, and the fact that you do not need to always use frameworks which can actually make things more complicated or totally unnecessary if you design your code in very small modulars.  (BTW, This is also is a big reason why I left .NET.  Microsoft pushes shitty frameworks, horrible xml driven frameworks, and more garbage down your throat when you just need simple, clean, decoupled code which means you end up not needing all those heavy frameworks Microsoft tries to push down your throat)
  • Then read Corey Haines's book 4 Rules of Simple Design 

Finally Get into the BDD 

This will apply some of what you learned above to actual code.

After you've watched and read the previous section, now is the time to understand proper BDD and applying the concepts above.



    Optional but a good Resource for later when you have time after all the above: Start Doing Real World TDD Now!.  This blog is by Eric Smith.  He's a developer I had the privilege to pair program a bit from 8th light, and he runs their training program at 8th Light, their Apprentice program.  

    I probably learned more in 5 months with Eric and another 8th Light Consultant that would have taken me 2 years to learn.  Honestly while the list above is awesome, the best way to learn BDD IMO is to pair with seasoned TDD'ists.  Get 8th Light to come into your company for a few months, year, whatever.  The benefits are exponential for your team and your company as I have experienced myself with these guys.

    Yes this is a lot to read up on and watch but I guarantee it'll help bridge the gap much sooner.

    Hoping this helps others as it has helped me bridge the gap with Clean Architecture, Hexagonal, Ports, Adapters, and how to approach this and separate this while doing test driven.

    No comments :

    Post a Comment