refactor-the-mega-controller

by andymatuschak

Commits contain refactoring steps taken in my talk, "Let's Play: Refactor the Mega-Controller"

443 Stars 37 Forks Last release: Not found 16 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Let's Play: Refactor the Mega-Controller

Hello! This project needs some explanation.

This is the companion source for a talk I've been giving under the same name. You can also watch a more "improvised" version of it I gave at Realm.

The idea is to take a highly-coupled, highly-ugly view controller implementation and to incrementally isolate, abstract, and test components of it, reducing dependencies of each piece along the way.

I've tried to use this project to demonstrate some of the architectural design principles I've been developing for Swift. The source probably won't make much sense outside of the context of the talk, but perhaps in time I'll annotate the source with docstrings so that it can be read on its own.

If you're reading this outside the context of my talk, I'll offer this caveat: all added layers of abstraction also add complexity. Not all of these steps will necessarily be worth it given the tradeoffs of your own project. This project attempts to demonstrate aggressive isolation for instructive purposes, but I don't always advocate that in practice.

How to read the refactorings

The progressive refactorings are represented in the Git history.

HEAD
represents where the refactoring stopped. You'll want to step back to the first revision, then step forward to see how each step was refactored.

Now you try!

I did these refactorings pretty quickly. You should feel free to try your hand at cleaning up this awful view controller on your own; send me pull requests, and we'll chat about 'em!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.