Plainionist Tales of a software craftsman's journey

Implementing Clean Architecture - Case Study: Sending e-mails

During my day job we recently did a code review of a small feature of an application which aims to follow the principles of Clean Architecture. At a first glance separation of concerns as well as basic principles of Clean Architecture were followed. But a closer look revealed that some dependencies did not follow the Dependency Rule, specifically there were dependencies from adapters layer to the frameworks layer.

During our design discussions which followed this observation I realized that this example would perfectly serve for a case study on how to design a feature in Clean Architecture in detail.

So here we go …

More ...

Don't comment it! Refactor it!

Do you think Clean Code should be very well documented? Do you think code comments should help the reader to understand what the code is doing? Or do you rather prefer DRY principle with respect to code comments?

Here is another video for you …

More ...

This is how you should start with Clean Code ...

As a software craftsman Clean Code is one of my key interests so I started a YouTube channel to provide practical coding tutorials on how to apply Clean Code principles.

In my first video I demonstrate that Clean Code does not only start when you write a new component or add a new feature to some existing code base. Instead you can start applying Clean Code principles and especially the Boy Scout Rule already while reading code.

More to come! Stay tuned!

More ...

Book Review: Domain Modeling Made Functional

Unless you are not completely new to our profession I am pretty sure you already heard about “Domain Driven Design” (DDD). But maybe you think that DDD requires quite some effort which is only worth it in big software projects and that it has to be done in the beginning of a project to be effective?

This is not necessarily true …

Here is a book which nicely demonstrates that DDD and Functional Programming (F#) are two great tools to tackle software complexity in any software project, even in a small pet project:

Book: Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven Design and F#

Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven Design and F#

More ...

Book Review: The Software Craftsman: Professionalism, Pragmatism, Pride

Yes, of course. Who has time? Who has time? But then if we never take time, how can we have time? – Merovingian, Matrix Reloaded, 2003

If you think you don’t have time, even not to learn and practice, here is the one book you need to take time for:

Book: The Software Craftsman: Professionalism, Pragmatism, Pride

The Software Craftsman: Professionalism, Pragmatism, Pride

More ...

Implementing Clean Architecture - Frameworks vs. Libraries

In Clean Architecture the usage of frameworks is restricted to the outermost circle. But what is a framework? Is every third party library a framework? How to implement gateways without using third party libraries?

It has been a while since my last post on “Implementing Clean Architecture” but I wasn’t lazy ;-) In fact I was - apart from my day job - working on getting Athena closer to the Clean Architecture. But there was one thing which puzzled me for a while when implementing repositories:

In Clean Architecture

  • all details are restricted to the frameworks layer. The database is a detail.
  • all data conversion from the format most convenient for what ever persistence framework to the format most convenient for entities and use cases, happens in the interface adapters layer.

How do I implement a repository in the interface adapter circle which accesses the TFS database using the Microsoft TFS framework APIs? Isn’t that a violation to the Dependency Rule? In fact, isn’t any usage of a third party API outside the frameworks circle a violation to the Dependency Rule?

In this post I am trying to answer this question.

More ...

Book Review: Accelerate

Book: Accelerate: The Science of Lean Software and DevOps: Building and Scaling High Performing Technology Organizations

Accelerate: The Science of Lean Software and DevOps: Building and Scaling High Performing Technology Organizations

Do you work in one of the cool “Lean Startups” with “DevOp culture”? No? Me neither ;-)

As a software craftsman you know that DevOp practices like Continuous Delivery, modular architectures, trunk based development, test automation, working in small batches and Continuous learning do make a HUGE DIFFERENCE when it comes to software delivery performance!

If only you could convince management …

More ...

Book Review: Manage Your Day-to-Day

Book: Manage Your Day-to-Day: Build Your Routine, Find Your Focus, and Sharpen Your Creative Mind

Manage Your Day-to-Day: Build Your Routine, Find Your Focus, and Sharpen Your Creative Mind

This is one of these books which try to help you achieving more of what is important to you.

It is definitively not the first book I have read about “being more productive” and “focus”, but “Manage Your Day-toDay” gave me a few new insights and reminded my of some things I had learn some time back already but got forgotten in the chaos of daily business.

In fact I think every software craftsman should read regularly - at least once a year - about “focus” and “productivity”. It is all too easy to get lost in these many and “important” things which pop up every day on our desks and in our email in-box.

Could you also spent your whole day sending and responding to email just to wonder what you have done the whole day in the evening?

More ...

Implementing Clean Architecture - Are Asp.Net controllers "Clean"?

How do Asp.Net Controllers fit into the context of Clean Architecture? Do they belong to the interface adapter layer?

In the previous post I have discussed controllers and presenters. I have shown you how I have implemented my controllers and presenters in the Athena project.

I was quite happy with my design so far but there was one thing which puzzled me …

In Asp.Net MVC a controller derives from System.Web.Mvc.Controller which creates a dependency from my controller to the Asp.Net framework. Taking the Dependency Rule strict that either means my design is invalid or my controller actually belongs to the “frameworks” circle.

In order to learn what others think about this design I have posted my question at StackOverflow and had a discussion with @herbertograca.

In this post I will share what I have learned and how I solved the puzzle …

More ...

Blogging with Jekyll - My IBE

After having blogged with Jekyll for some while now I have found some convenient setup which makes me feel quite effective. Today I want to share my setup with you. Maybe some aspects inspire you, maybe you want to leave a comment about your own setup to inspire me?

More ...

Implementing Clean Architecture - Of controllers and presenters

From Clean Architectures circles lets take out the 'interface adapters' one and deep dive into controllers and presenters.

Last time we discussed about use cases and interactors and stopped with the question: “Which role is than actually left to the controller and presenter?”

In this post I will take this question up and dive deeper into the world of controllers and presenters in the context of the Clean Architecture.

Read on!

More ...

Clean Architecture and Design

While preparing my next post on Implementing Clean Architecture I watched again Uncle Bobs famous talk on Clean Architecture and Design.

I know it is more than three years old but if you are interested in Clean Architecture you should take your time and watch it. Uncle Bob explains nicely - and a little bit funny as usual ;-) - what the Clean Architecture is about, how the puzzle is built up and why it has to be like this.

And as a summary for this video and as an outlook to my next post here is the key message:

The user interacts with the view. The view passes a request (defined in the interface adapter layer) to the controller which converts it into a request model defined in the use case layer. The interactor takes the request model though a input port and produces a response model which gets passed through an output port to the presenter. The presenter converts the response model into a response object defined in the interface adapters layer to the view. The view renders the response for the user

More ...

An Introduction To Clean Architecture

Today I found a nice article on the NDepend Blog: An Introduction To Clean Architecture.

The post gives a nice introduction by first motivating clean architecture by looking at the short comings of the traditional layered approach. It then gives some history about the Clean Architecture. Finally the post briefly introduces the Clean Architecture itself - the circles and the dependency rule.

It was a nice read - looking forward to read the follow-ups.

More ...

Implementing Clean Architecture - What is a use case?

From Clean Architectures circles lets take out the 'use cases' one and deep dive into it.

Now that my architecture is screaming the business capabilities of my system let’s look at those with more detail.

In the Clean Architecture all the application specific business rules go into the use cases circle.

But what is a use case? How big should it be? How does it interact with its environment?

Read on!

More ...

Implementing Clean Architecture - Make it scream

How do I make my architecture “scream”?

According to Uncle Bob an architecture “screams” when it clearly expresses its core business purpose. The top level folder structure, the project/DLL names and the namespaces should express business aspects rather than frameworks or other details.

Athena is a web application implemented in ASP.NET MVC. But is this important? I could switch to Ruby on Rails or Node.js - it wouldn’t make any difference for the business. Why do we let such details impact our project structure so often?

More ...