Don’t worry about big software design decisions anymore
Driven by example, this book applies useful patterns of clean software architecture to macOS app development. Take on app development with solid principles, guided by extensive examples and explanation.
- Lifetime access to updates
- 4th, expanded edition
- Swift 3 ready
- 100% Money Back Guarantee: Because I know you’ll love the book!
Gain confidence that your stuff is really working. Even if you don't do it consciously, you apply structure your code. Take ownership of the process by understanding how to employ basic software architecture to your advantage. Know your options and design your code according to insight, not tradition.
Learn how to …
- make your code base robust,
- design reusable code,
- get a solid test harness up and running, and
- properly 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 out 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.
Core Ideas of “Exploring Mac App Development Strategies, 4th ed.”
We'll explore useful patterns to make the code manageable. Here are some of the topics I explore, discuss, and challenge in this book:
- 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
NSManagedObjectsubclasses) are bound to do a lot of different things for different clients, whereas by 'client' I mean: view components, 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 Transfer Objects in Swift using
structs, for example. Core Data should be pushed from the Domain, where the business logic is hosted, to an outer layer of the application and be degraded to a mere 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
NSNotificationto 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. You won't be a software architecture expert afterwards, but you'll know how to make your code better, designed to help you prevent bugs
- Patterns and principles
- Architecture overview
- Part 1: Bootstrapping
- Getting comfortable with Swift, porting Objective-C code to recreate the problem space
- Get Core Data and related tests running
- Prepare the user interface in its own layer
- Have tests in place for the app's domain
- Part 2: Sending Messages Inside of the App
- Naive event handling
- Ports & Adapters-approach
- Part 3: Putting a Domain in Place
- Sending Domain Events
- Handling Errors
- Doing real work in the background
- Part 4: Using Core Data for Convenience
- Undoing the architectural separations
- Reading it backwards: how to refactor from Core Data to Domain Model
- Interesting links
- On Swift
- About Objective-C API compliance-related problems
I host the book manuscript on GitHub and distribute it under a Creative Commons Attribution-ShareAlike 4.0 license. That means you can edit and re-use parts of it. Pull requests are always welcome!
Feel free to contribute to the book and the project on GitHub:
- Current version: 4.0.0 (2016-11-21)
- Written for Swift 3
- Comes as PDF, EPUB, and MOBI
Q: It's written in Swift! What about the frequent Swift language updates?
I'll keep the book and the code up to date so you are always equipped with the latest technology. Apart from updates depending on Swift, I'll update contents based on reader feedback and my own experience.
I intend this book to be an investment in your indie career. It will accompany your journey until the world's end – or until Macs stop to work the way they do.
Q: How can I get the updated version?
Just use the download link you received after your order! It'll work for every future update and is bound to your order number. Just shoot me an e-mail if you lost it and I'll give you a new one.
Q: Do you offer a money-back guarantee?
Totally. Either you're 100% happy or you get your money back, guaranteed for a lifetime. – Mine, first and foremost, because nobody else checks my mail :)