Mark DiFranco introduces a method for architecting the core logic of your app in a way that makes writing tests much easier. Once covering common mistakes, he explains how to build your app from the bottom up. Learn what the single responsibility principle is, and how it can keep your codebase flexible. Then, create an architecture diagram of the app to help us stay on track when building it.
- [Narrator] Now that we have our external dependencies…wrapped in protocols, we can start building…the core logic of our app.…A common strategy at this point…is to start building from the top down.…Starting with what we want the app to do…and working our way towards lower level APIs.…In the context of our speedometer app,…we would first build the speed provider…and then hook it into the core location APIs.…An issue with this strategy, however,…is that it facilitates creating large classes…that hold too much logic.…Classes that do too much are harder to test…and tend to contain more bugs.…
Plus, if we make our classes as small as possible,…they'll be easier to refactor down the line.…This is called the Single Responsibility Principle.…Each class should be responsible for exactly one thing.…To help follow the Single Responsibility Principle,…let's build our app up from the external dependencies.…In order to ensure our classes…maintain a single responsibility,…we can create an Architecture Diagram for our app.…Let's take a look at creating one for the speedometer app.…
- Why write unit tests?
- What is dependency injection?
- Using protocols to help with tests
- Handling external dependencies
- Anatomy of a test case
- Writing tests
- Analyzing code coverage
- Visualizing test results
- Writing and extending UI tests
Skill Level Intermediate
1. Dependency Injection
2. Using Protocols
3. Writing Tests
4. UI Tests
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.