Information Technology Dark Side

Struggles of a Self-Taught Coder

Information Technology Dark Side header image 2

Dear Uncle Bob: Please, please show me the code

May 15th, 2012 · 9 Comments

Focusing on the Use Case Appeals to Me
I really liked your recent post about use-case-centric architectures. It’s not the first time I’ve witnessed you rant about your frustration with database-centric architectures, but for lots of reasons this time it resonated with me more than in the past. In my view, this was the best explanation of your viewpoint yet and I appreciated the lack of theatrics and irrelevancies that are common in rants. It was a well-reasoned rant. Or is that an oxymoron?

Also, like the previous times I’ve been exposed to your mantra, I found myself wanting to try it. I want to build an application that is focused on the use case. I want to go to a source code folder, pop it open, and know immediately what the app is all about. Really. I think that would be AWESOME.

My Use Cases have My Process Wrapped Around Their Finger*
Use cases drive my development process. They are where we start and they are the core bits of our workflow. We don’t start development by defining a data model – we start off by asking “What do you want to do?”. Over and over and over. It’s the most fun you can possibly have on an untethered ferris wheel, like rolling down a hill inside a tractor tire.

This is perhaps THE reason why the idea of architecture and code revolving around a use case is very intriguing to me. It seems to work pretty well on the process side, wouldn’t it be cool if it also worked on the coding side?

Heck yes it would.

*As long as you are willing to include user stories as a form of use case this is true anyway.

This is Where the Party Ends
I won’t lie. As much a I want my architecture to revolve around my use case, I really can’t imagine up how to do it, and I’m no dummy. When you complain about the way rails apps are structured in a way that communicates only that they are a rails app, that the architecture doesn’t say anything about what the software REALLY is, I can’t help but wonder what it SHOULD look like. And I have no answers.

Seeing is Believing
Clean Code showed me how code can be. It’s an epic work, in large part because it SHOWS you how to write clean code. Seeing code go from crap to clean helps readers understand the principles behind clean code. It’s the best way to teach, and frankly, based on my limited exposure to the things you’ve written, it’s your best work.

The Gauntlet
You’ve been harping on about data-centric architectures sucking and how use-case-centric architectures are the hypothetical shizzle for a while now. I started paying attention to it about a year ago, but I’m pretty sure your lost-architecture thesis predates even that. I don’t have a problem with the idea, I just have a problem figuring out how to use the idea.

So, how about you show me? Show everyone, for that matter. Build a use-case-centric application so that next time SCNA rolls around you can follow up your picture of a rails app and its root directory structure with an example that doesn’t suck. Make it work on the web, and throw in an api for mobile for good measure. As you’ve mentioned in the past, these are trivial issues anyway and shouldn’t dictate architectures. But we still need apps that use these mediums, and we don’t have solutions that make the use case king.

So, there. That’s the gauntlet. I’m throwing it down. Please, please, please, put up.

Thanks,

Dave Christiansen

If you enjoyed this post, make sure you subscribe to my RSS feed!
Stumble it!

Tags: Uncategorized

9 responses so far ↓

  • 1 David Christiansen // May 15, 2012 at 7:57 pm

    Off-blog Responses
    This is where I’m going to post any responses from Uncle Bob, along with my own commentary.

    From Twitter:

    See the payroll example in my book “Agile Software Development: Principles, Patterns, and Practices”. Also see FitNesse Source.

    Here’s what I tweeted back:

    FitNesse has a good reputation as a great tool, but it flunks your own first-glance test. It’s much worse than a rails app.

    What am I talking about here? The first-glance test is what I call an idea that I am intrigued by that came from Uncle Bob’s “Architecture, the lost decade” live-rant presentation. First he showed us some blueprints and talked about how it was obvious with just a glance at the blueprints what the thing they described was: a church, in this case. Then he busted out a screenshot of a rails app project and asked if we could tell what the application was. Well, of course we couldn’t. All we could see of the project was a folder hierarchy with folders like model, view, controllers, etc, like this:

    The point he made was that these folders are the “architecture” of the software, and that they really should tell us more about the purpose of the software, just as the blueprints of a building communicate that it is a church.

    So it’s interesting that Uncle Bob responds to my request for an example with FitNesse. Here’s a screenshot of the FitNesse source code, from the most representative view of the “architecture” that I could find.

    I don’t think there can be any discussion about this being an example of the type of architecture Bob describes in his post. It’s not. Not even close. Sure, it doesn’t use a DB, and it may not be data-centric, but it certainly can’t be called use-case-centric, at least not in terms of the first-glance test Bob touted. In all actuality, wading through the source code of FitNesse is a nice reminder of how relatively clean and straight-forward the source code organization of a rails app is compared to other stoofs.

    I’m going to check out the payroll example and see if it’s meaty enough of an example to help me understand how to build a use-case-centric application.

  • 2 Jim Gay // May 15, 2012 at 9:48 pm

    I was completely fascinated by the concepts developed by Trygve Reenskaug and Jim Coplien in DCI and I’ve been actively working on and researching how to write code that reflects use cases .
    I have no doubt that Bob Martin can follow through with examples however.

  • 3 Uncle Bob // May 16, 2012 at 12:30 am

    My response: http://cleancoder.posterous.com/aldos-response

  • 4 David Christiansen // May 16, 2012 at 6:33 am

    Bob posted an extremely helpful response to my challenge here: http://cleancoder.posterous.com/aldos-response.

    I think this gets me over the hump. Look for a post that attempts to validate this later today.

  • 5 Lars Pan // Jul 21, 2013 at 7:04 am

    I’ve also been looking for a code example of a Clean Architecture, and I was very happy to find that Uncle Bob has given a response. :)

    Sadly, the link is dead. Any chance of the code example miraculously appearing somewhere else?

  • 6 Alex // Jul 23, 2014 at 3:06 pm

    Do you have an archive of that response ? Posterous Spaces is no longer available…

    Thanks :)

  • 7 David Christiansen // Jul 23, 2014 at 6:02 pm

    Ugh. I wish I did…

  • 8 David Christiansen // Jul 28, 2014 at 8:28 pm

    I found an archive of this using the google wayback machine here: http://wayback.archive.org/web/20120701101857/http://cleancoder.posterous.com/aldos-response

  • 9 Andreas // Mar 27, 2015 at 7:05 am

    May this be a goood example ?

    https://github.com/mcharmas/shoppinglist-clean-architecture-example

Leave a Comment