Skip to content

Latest commit

 

History

History
33 lines (17 loc) · 4.48 KB

01_introduction.md

File metadata and controls

33 lines (17 loc) · 4.48 KB

Introduction

For iOS developers at any level, learning new computer science concepts can be a time-consuming and challenging process. Many developers possess a good understanding of Swift/iOS coding syntax and commonly used design patterns. However, roadblocks are often encountered when it comes to understanding fundamental computer science ideas and algorithms.

If this describes your situation, here are some key things to consider as you approach learning this new area of development.

Your approach

As an iOS developer, you likely have experience writing Swift/Objective-C code and implementing design patterns like object-orientation, model-view-controller (MVC), asynchronous functionality, and delegation. In software development, there's usually a single best way to present and organize code for a given problem. Much of this comes down to applying specific syntax or using components from the iOS SDK correctly. We often look up these "best practices" in documentation or search for them on helpful websites like Stack Overflow.

However, when it comes to learning computer science concepts, you should consider setting aside the "single-best-way" mindset and instead focus on proving your approach. The idea of proving your approach is empowering but can also be confusing at first. Rather than thinking of a single way to solve a problem, assume there are many ways to reach a desired outcome. In this book, we'll cover concepts such as divide & conquer, the greedy approach, dynamic programming, and brute-force methods.

Consider the brute-force technique - this implies coding a solution with no concern for algorithmic efficiency. While a brute-force approach could be used to build an entire app, ask yourself if that would be the most optimal solution. How would you redesign your function/app/framework if it had to process 1 million rows of data? For world-class websites like Google, "optimal" often translates to speed and efficiency. As a result, many algorithms are essentially recipes to increase performance, solve seemingly unsolvable questions, or improve data storage and retrieval.

What to exclude

When learning algorithms such as Tries, Binary Search, Graphs and Hash Tables, a common trait they share is their approach to excluding data. Instead of asking "how can I search through all the data to find the answer," the question gets reversed to "what data can I exclude to assume the logical result?" For those new to algorithms, this insight often proves to be a valuable tool when the answer isn't immediately apparent.

Thought experiments

The term "thought experiment" is often associated with great thinkers like Albert Einstein. While you certainly don't need to possess genius-level understanding of STEM subjects to write code, the idea of reworking problems based on limited information is something that, as developers, we can certainly relate to. The concept of thought experiments reinforces solving hard questions by applying unorthodox approaches.

As you brainstorm, try changing things up and work on planning solutions on paper before committing them to code. This is where having a solid grasp of Big O Notation can be particularly helpful. What's nice about stepping away from the computer is that your primary effort can be put toward problem-solving without the added consideration of perfecting syntax. While you work, assume the code to prove your point is possible, even if you're unable to recall the exact syntax immediately.

Tools as secondary

While learning Swift and iOS development, it's important to view tools like Xcode, CocoaPods, and Git as secondary aids to maintain and document ideas, not as the primary way to generate new concepts. By seeing your software development tools in this context, you'll be well-positioned if you're ever asked to express the same ideas in a different programming language, tool, or upgraded environment.

Applying what you learn

Throughout this book, we'll explore various algorithms and data structures, implementing them in Swift. However, the goal isn't just to memorize these implementations. Instead, focus on understanding the underlying principles and problem-solving techniques. This knowledge will allow you to adapt and apply these concepts to a wide range of programming challenges, regardless of the specific language or platform you're working with.

By mastering these fundamental computer science concepts, you'll not only become a more effective iOS developer but also a more versatile and valuable software engineer overall. Let's begin!