Exploring Mac App Development Strategies
$7.99
Minimum price
$13.99
Suggested price

Exploring Mac App Development Strategies

Patterns & Best Practices for Clean Software Architecture on the Mac with Swift 3 and Tests

About the Book

Driven by Example, this Book Applies Useful Patterns of Clean Software Architecture to Mac App Development

You do some kind or other of what may be called "software architecture" anyway.

So better know the reasons for the moves you take. Own the alternatives, and design your code accordingly to gain confidence that your stuff is really working.

Learn how to …

  • design reusable code,
  • get a solid test harness up and running, and
  • separate the components of your application. 

All this will make your application easier to change and easier to maintain. It will make you a happier developer, even when you're just exploring new parts of the Cocoa Framework.

To develop Mac applications, you'll need to know why and how to separate components. Using the latest technology and a head-start into Swift programming, this book will show you the pro's and con's of several design decisions and discuss alternative approaches so you get to know your options.

The Core Ideas of the Book

I want to share the core ideas and theses of the book with you:

  • Apple's Core Data is a very invasive framework. It works best when you couple everything, beginning at the user interface, to Core Data entities. Cocoa Bindings make a lot of the magic possible, but they come at a cost: the Core Data entities (or NSManagedObject subclasses, for that matter) are bound to do a lot of different things for different "clients", wheras by 'client' I mean consuming views, background services, and the like. It'd be easier to maintain the code if you model entities for each "Bounded Context" separately.
  • Adopting Domain-Driven Design thinking, small service objects are favorable. It's easy to create Data Transfor Objects in Swift using structs, for example. Core Data should be pushed outside the domain (i.e. where the business logic is hosted) and become an implementation detail.
  • Once you free your app from the entanglement by Core Data (and other Apple suggested best practices which don't scale well), you will be able to leverage powerful design patterns. I created domain event wrappers around NSNotification to make event handling easier and failure-proof. Using events to propagate changes (instead of using Bindings, for example) makes concurrent programming easier.

That's part of the topics we cover in this book. Maybe you won't be a DDD expert afterwards, but so neither am I. Instead, we'll explore useful patterns to make the code manageable and to get more comfortable ever writing Mac applications which are ready to scale.

The Book is Open Source, by the way!

The book is Open Source. You can contribute on GitHub:

Just create a pull request if you came up with a better description of something, or if you want to add a useful reference, for example. Together, we can make the book a lot better.

Your feedback is much appreciated!

About the Author

Christian Tietze
Christian Tietze

Christian develops the Word Counter for Mac on his own and has a few years experience creating iOS apps, too. He can move fast and deploy often thanks to clean code and solid application design.

Christian writes regularly on his own website where you may find out more about future book projects. He's also writing for Zettelkasten.de, where he and his pal Sascha are discussing theory and practice of good knowledge management.

Bundles that include this book

$38.99
Bought separately
$20.00
Bundle Price

Table of Contents

  •  
    • Prologue
      • Who Is This Book For?
      • Contributing to the Book Manuscript and Example Project
      • Motivation to Write This Book
      • The Example
      • Architecture Overview
      • Patterns & Principles
  • The Story of Developing a Clean App by Example
    • Part 1: Bootstrapping – Setting Up the Project, Core Data, and Unit Tests
      • How to Load Core Data NSManagedObjects in Tests
      • Introduce Repository and Its Collaborators for Tests
      • Preparing the UI: Create View Controllers and Test Their Setup
      • Use of Automated Tests
      • Finally, Add Boxes to the Strictly Item-Centric Application
      • Functional Testing Helps Transition to Adding Real Features
    • Part 2: Sending Messages Inside of the App
      • Naive Event Handler
      • Ports and Adapters
    • Part 3: Putting a Domain in Place
      • Introducing Events in Place of Notifications
      • Error Handling
    • Part 4: Using Core Data for Convenience
      • How to Change the Project to Put Core Data at It’s Center
      • Abstract from Core Data
      • Core Data in the UI
    • Epilogue
      • Learning Through Writing
      • The Use of Cocoa Bindings
      • Objectives Accomplished?
  • Appendix
    • Further Reading
      • Interesting Links
      • Interesting Books
    • Bonus Articles
      • Strong Reference Cycles
      • Access Rights VS Laissez-faire Objective-C
      • On Swift
      • Adopting Swift 2.0 Errors
  • Notes

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub