Mobile App Case Study
7. Architecture
By Robert C. Martin and Justin Martin, 58m

Wondering what the Mobile App Case Study series is all about?
Watch this free 3-minute intro video and find out!


Straightening out the MESS

Where Justin and I retire to our Summer retreat, and refactor the application to conform to a nice, clean, architecture.

Our goal is to separate the games rules, the data, and the GUI into separate components that have a plugin structure. We want the GUI and the Data modules to plug-in to the Game rules.

This takes three tomatoes of dependency breaking and reforming; while keeping the tests passing.

And in the end, we've created the seed crystal around which this application can continue to safely grow.


The github repository for this series is: https://github.com/unclebob/MACS_GOMOKU

6. Resolution
By Robert C. Martin and Justin Martin, 1h 18m

Wondering what the Mobile App Case Study series is all about?
Watch this free 3-minute intro video and find out!


Were Done!

Yep. We got the whole thing working.

Well, almost. I mean -- good enough for this video series.


The episode began with a big up front design for detecting wins. And then we abandoned that and adopted an incremental approach that got us 2/3 of the way there. The rest is in sight.

We also played around with the dependencies a bit, debating what modules should depend on which other modules.

And then...

OH OH!

...we looked at the overall structure of the system. We drew the diagram on the board. And we discovered that after 6 hours of work, 18 tomatoes, we had built a dependency rat's nest.

We can't leave it like this!

And so, we have one more episode to do. We need to fix the architecture.


The github repository for this series is: https://github.com/unclebob/MACS_GOMOKU

5. Policy & Presentation
By Robert C. Martin and Justin Martin, 1h 16m

Wondering what the Mobile App Case Study series is all about?
Watch this free 3-minute intro video and find out!


The Architecture intrudes.

In this episode we start to see the architecture rearing up and asserting itself.

This begins with a discussion about the turn-taking policy. Where does that belong? And what direction should the dependencies point.

This leads to the adoption of the Model-View-Presenter pattern, to decouple the testable, from the untestable portions of the GUI.

Various dependency management techniques are tried; including one using lambdas that ends up burning our brains at the end of the episode.

Oh, yeah, and we get caught by that refactoring we did last episode, when we removed all the keyword arguments.

Anyway -- The Architecture has Begun.


The github repository for this series is: https://github.com/unclebob/MACS_GOMOKU

4. Seriously, We Lost It!
By Robert C. Martin and Justin Martin, 56m

Wondering what the Mobile App Case Study series is all about?
Watch this free 3-minute intro video and find out!


A spasm of Refactoring.

A spasm of refactoring in which we lost the video of the first tomato -- thankfully!

Yes, it's true. We lost the first tomato. Well, we didn't lose it. We just forgot to hit the record button.

But don't worry. We summarized it for you.

We also SPED UP THE TESTS!

Well, we think we did anyway. It's kind of hard to tell. You'll see. But Justin does a nice job showing you how to do it.

EXCEPTIONS ELIMINATED.

Anyway, we got down to business in the second tomato by removing all the horrible exceptions and replacing them with tuple-based error returns. As it turns out, this worked pretty well.

We also walked through the code replacing most of the keyword arguments with positional arguments -- something that swift does not make particularly convenient. We did this because the code just looked better once it was done.

And then we found a torture device and subjected ourselves to it.


The github repository for this series is: https://github.com/unclebob/MACS_GOMOKU

3. Chugging Along
By Robert C. Martin and Justin Martin, 1h 13m

Wondering what the Mobile App Case Study series is all about?
Watch this free 3-minute intro video and find out!


OK, Enough of this Model First nonsense. Let's write the GUI!

And let's write the GUI in a language that has static typing cranked all the way to 11; and that interfaces to a framework that was designed for a dynamically typed language!

What could go wrong?

Actually, our dynamic duo does a pretty good job of it. Despite struggling with floating point numbers and the strange path structure, in three tomatoes they get a functioning GUI on the screen.

There's just one problem: They didn't write any tests. Wasn't this series supposed to teach TDD?

Ah, but TDD and GUIs...


The github repository for this series is: https://github.com/unclebob/MACS_GOMOKU

2. Proceeding with Precision
By Robert C. Martin and Justin Martin, 1h 21m

Wondering what the Mobile App Case Study series is all about?
Watch this free 3-minute intro video and find out!


In this episode our intrepid pair continue to employ the Model First principle by adding more capability to the game board as well as beginning to build the rules that will detect wins.

Frustration mounts with the tool, the speed of tests, and the language; causing the pair to eventually resort to long dead german poets to vent their angst.

Exceptions begin to rear their ugly head; setting the pair on a path that will trouble them for several episodes to come.


The github repository for this series is: https://github.com/unclebob/MACS_GOMOKU

1. Getting Started
By Robert C. Martin and Justin Martin, 1h 22m

Wondering what the Mobile App Case Study series is all about?
Watch this free 3-minute intro video and find out!


Hey Justin, you're something of an Mobile app expert nowadays, aren't you?

Well, I have built several significant iPhone apps for various clients over the past few years.

Do you want to do a video series on the topic?

Sure, Dad. That sounds like fun. Actually, I've been learning Swift. Do you want to do the videos using Swift?

Swift, eh? Sure, why not. I don't mind learning a new language. We can do TDD right?

Yes, the tools support TDD, no problem.

Great! OK, so let's write a simple Go-Moku app.

You mean that five-in-a-row game you play on a GO board? That sounds like fun. So what are we trying to teach in this series?

Well, I think our focus should be to use the series to teach the following principles:

  • TDD -- How to do Test Driven Development, for a mobile app, in Xcode and Swift.

  • Pairing -- You and I will pair program, and talk through our issues so that the viewers can follow along.

  • Pomodoro -- We'll use the Pomodoro time-management technique both to structure the videos, and to manage our time.

  • Model First -- We'll drive the development by building the business rules first, and then fit the GUI, network, and data access in later.

  • Clean Architecture -- We'll separate the GUI, Business rules, data access, etc. into separable components. Keeping the architecture clean.

  • Dependency Management -- Using OO, we'll create a plugin structure between those components that will allow the application to scale.

  • Swift -- And, we'll explore some of the interesting language quirks and features of Swift.

OK, so just normal, professional, mobile development. I'm on board. Sounds like a hoot. Let's go!


The github repository for this series is: https://github.com/unclebob/MACS_GOMOKU

0. Intro
By Robert C. Martin and Justin Martin, 3m

This is our free introduction to the Mobile Application Case Study, in which we develop an iPhone app using Swift.

Get ready for quite a trip as we spend 7 episodes (21 tomatoes) TDD our way to a GoMoku application using XCode and Swift.

As you watch us you'll see the problems we had with the IDE, with the language, and with the framework. You'll also see how we solve them, and drive the application from it's initial meager beginnings to a final scalable architecture.

So, buckle up, because this is one cool ride.