Recently, some developer friends asked me how I could improve my capabilities. Looking back on my long career in iOS development, I also had the feeling of “Let me make a feature to fulfill a requirement and I’ll do it, but I don’t know how to improve it next.” Here is a list of iOS development techniques and some of my thoughts on learning progress.

IOS technology stack

According to my understanding, iOS related technologies are divided into four categories: basic, requirement, efficiency and quality from the perspective of engineering implementation. Basic refers to the basic knowledge and skills of program development and iOS development. Requirements are the requirements of the product. Once basic skills are in place and product requirements are fulfilled, the rest is all about improving project quality and improving development efficiency.

A rough mind map:

basis

The basics include language, framework, memory, networking, storage, rendering, threading.

The language of iOS development is OC and Swift. OC is still the main language in China. In addition to the syntax of OC, it is best to understand its object model, dynamic mechanism and other features. For now, Swift is risky but not rewarding for teams, but it’s best for individuals to keep an eye on it.

Frameworks are Foundation/UIKit and all the different frameworks that apple has packaged, Foundation and UIKit are familiar to everyone who does iOS development, and as iOS becomes more and more powerful, as Apple provides more and more frameworks, StoreKit/MessageUI/AVFoundation etc can be learned after use.

Then there are the four key parts of the most common flow on the client side: pulling data from the network, storing it to the local file system, fetching it from there into memory, and finally rendering it out. All of the processing takes place in the operating system’s processes and threads.

The client generally only needs to care about HTTP/HTTPS/DNS protocols, understand the principle of HTTPS, and deal with the hijacking of DNS by carriers. In addition, it is necessary to deal with all kinds of abnormal situations and make a retry mechanism. IOS as a mobile network is unstable. Depending on the situation, optimize the connection under weak network, do a good offline mechanism, and pay attention to avoid consuming too much traffic. There is also the communication protocol between the client and the background, and the data structure is usually JSON or Protobuf. Because the client saves part of the content locally, many APPS will need to do incremental updates of the data.

Storage is mainly SQLite, SQLite as a storage engine is the core of most APPS, but also the key point of performance optimization, the most basic need to know the primary key index transaction database basic concepts, further need to understand the specific storage mechanism/index implementation/SQLite seven-layer structure, etc. To find the best solution when you encounter a problem. On the client side, noSQL is rarely used. In addition to SQLite, it is generally used to store single files. XML files or objects serialized into binary storage are also commonly used.

In terms of memory, you need to understand reference counting, ARC mechanism, automatic release pool and other relevant points of OC. You should also be familiar with garbage collection mechanism of other languages. In addition, you need to avoid memory leakage and manage client cache to avoid OOM or low cache hit ratio.

The rendering aspect is mainly text and image. Based on the text aspect, UIKit has been well encapsulated, and CoreText also provides more free typesetting and rendering methods. Image rendering only needs to pay attention to decompression time, and further needs to understand the specific rendering mechanism of iOS, such as layer mixing, rendering time, off-screen rendering, so as to do more optimization.

In terms of threads and processes, iOS development only needs to consider the process when doing Extension. Generally, it only needs to deal with threads. It is necessary to understand the knowledge points such as main thread, sub-thread, multi-threaded concurrent lock competition, deadlock, GCD, Runloop and so on.

demand

Demand can be summarized as general demand, special demand and operational demand.

Common demand is the network pull data -> storage -> read -> display, most apps are mainly in the realization of this kind of demand, familiar with the above basic knowledge can be easily realized.

Special requirements refer to the requirements of some specific apps, such as browser kernel, text typesetting engine, audio and video and image processing engine, icon drawing engine, etc., which require in-depth study in related fields to do a good job.

Operational requirements are the requirements in the continuous operation process after the launch of the APP, including dynamic functions, which can be added or deleted at any time. Generally, this part is undertaken by the embedded Web. The configuration system is also a dynamic one, which can control the display function through various switches. The statistical system records various operation data of the APP, including user growth, retention rate, function usage, etc. The flow of events can clearly see the flow of users’ use in the APP. Some apps will also develop recommendation systems to push different content to different users according to the collected data, so as to improve user conversion rate.

The quality of

The bigger the APP, the more effort it will put into ensuring and improving the quality of the APP, including performance optimization, building monitoring systems, improving code quality, ensuring safety, and ensuring quality through testing.

Performance tuning range is very big, in the network / / storage/memory/rendering algorithm optimization in many aspects, on the general performance optimization can be divided into three steps, one is testing all aspects of the data, the quantitative performance, 2 it is to find performance bottlenecks, 3 it is to find ways to optimize, the first step in data validation optimization effect.

Monitoring system in products for the public users both front-end backend has always been very important, you always need to know what the user in the process of using your product have what problem, let your APP in the known controllable state, the client of the most common point to Helen, this needless to say, and generally for the error code in the APP, Local errors, network errors, etc., need to be monitored so that exceptions can be immediately detected and handled. Other common monitoring includes lag monitoring, database monitoring, traffic consumption monitoring, memory consumption monitoring, various time-consuming monitoring, etc., as well as all kinds of business-related monitoring. The larger the APP, the more detailed the monitoring items are, aiming to find problems in time and measure the quality of the APP. In addition to monitoring problems, there is also a need to take corrective action when things go wrong, either by configuring embedded function switches or by accessing hot repair libraries.

In terms of security, the security of the client is much less than that of the server, especially under the protection of the sandbox mechanism of the iOS system, which is already relatively secure. The most important thing to pay attention to is the security of network transmission, to avoid the tampering of network transmission content or the disclosure of sensitive information such as user names and passwords. If there is confidential information in the code, it can be considered to reinforce the APP by confusing the code to reduce the probability of cracking.

Code quality is mainly based on team collaboration. Most teams will define code specifications to make everyone’s code styles consistent. Some will develop a code specification inspection tool to ensure that the submitted code complies with the code specification. In addition, many teams will implement code review mechanism to check each other’s code and reduce the probability of dirty and bad code. The specific review mechanism varies from team to team.

Testing is a major. Because of the rapid iteration of domestic terminal products, black box testing is common. Although no problems can be guaranteed, the cost is low and the efficiency is high.

The efficiency of

Client architecture can say is to improve the efficiency of development cooperation, because the function can be used a lot of kinds of methods, may not need what architecture, whether large or small can be implemented by a set of APP, but poor architecture on large APP code will be very confusion, resulting in development/cooperation/debug efficiency will be more and more low, Good architecture improves efficiency here. Most architectures are layered abstractions and decouples, separating functional components from each other, modularizing services, and separating responsibilities from each other. As long as layered abstraction and decoupling are done well enough, no matter how big an APP is, it is a Mosaic of many small modules, which can reduce complexity and improve development efficiency. But sometimes decoupling leads to communication problems, and abstractions have granularity issues that need to be weighed on a case-by-case basis. There are various architectural patterns to refer to in the industry, such as MVC/MVVM/MVP/VIPER, etc. In addition to decoupling and abstraction, there are architectures that change the way programming is done, such as responsive programming, one-way data flow, and so on.

Continuous integration means the continuous integration of everyone’s work (code/resources, etc.) together to produce the finished product and automate the build, which involves code management (Git/SVN), compilation process, certificate and signature mechanism, automated testing, packaging and distribution, etc. There will also be some custom automation processes, such as automatic code generation, automatic configuration changes based on the DEBUG/release package type, etc. Repetitive tasks should be automated to improve development efficiency.

In order to improve the efficiency of development, cross-platform development has always been the pursuit of the goal. There are many attempts in the industry. This article summarizes comprehensively. In general, the best cross-platform scheme at present is Web (H5), at the cost of slightly lower performance.

The advanced

After this list of iOS development topics, let’s talk about how to learn and improve.

If self-learning ability is strong, there is no need to say more, each of the above points have a large number of information online, such as memory network storage of basic computer knowledge there are classic books, one by one to hit the line, as long as the understanding is deep enough, you can already become an expert in the field, and it is easy to understand by analogy.

But this kind of learning method will be boring, also difficult to practice, I still recommend learning in practice, specifically in the peacetime development process to constantly find problems -> solve problems.

Found the problem

First of all, you want to be in an environment where there are a lot of engineering problems that need to be solved, so it’s easy to spot them. It’s best to be in one of these projects:

  1. A project in a period of high growth. Growth brings a lot of problems, and everything is immature. It is natural and valuable to solve these problems.
  2. For huge projects, super apps will bring many problems that small and medium-sized apps have not encountered. Moreover, due to the large volume, even if only 1/1000 people encounter it, it will affect hundreds of thousands of people, which is of great value to be solved and there will be many detailed problems.
  3. Projects with “special needs” as mentioned above, which require in-depth research in one area, will naturally encounter many problems.

If it happens not to be in any of these three types of projects, it doesn’t matter, as long as it is a healthy development project, there will always be problems and room for optimization, it is just a matter of cultivating awareness to find the problem, many times the problem is there, but no one sees it, no one thinks it can/should be solved. According to the points in the above column, you can ask yourself whether you can improve efficiency and quality at relevant points, such as whether you can improve the efficiency of front-background joint debugging, whether you can automatically generate repetitive code, whether you can shorten the startup time, whether you can improve the efficiency of online problem discovery and troubleshooting, etc. Questions will cover all of the points mentioned above.

If your project isn’t healthy, you don’t really have any problems or problems worth solving, or you haven’t graduated yet, here’s a one-size-fits-all question: How do well-known open source projects actually work? Analyze the open source project source can learn many things, all kinds of open source projects also cover a lot of knowledge, as long as deep to study them, study its architecture and coding, don’t understand the place to supplement the knowledge, is also a good way to learn, if can output the effect will be better, after learning of hands-on practice.

To solve the problem

Different ways to solve problems vary greatly, and there are some common routines to consider:

1. How does the industry solve this problem? What’s wrong with their plan? How can I do better? Industry has a variety of open source library and technology sharing, as long as the problem is not too wide, most people will have proposed solution, compare and study the existing scheme, see if they can meet the requirements, find out their advantages and disadvantages, and see if I can do better than they are better or more suitable for solving problems.

2. Can the solution be generalized and encapsulated into an open source library for other projects? This is how open source projects come about. If you encounter a problem that someone else doesn’t solve, don’t miss the opportunity to encapsulate it into an open source library for the benefit of society.

3. Is there any way to prevent similar problems in the future? Some problems may recur, can be prevented, or can be found and repaired in time when problems occur, which may involve the improvement of development process, automation and monitoring system.

4. Can we sum up the methodology (routine) to solve this kind of problem? It is better to output articles or share, the process of writing is a very good learning process, because it is necessary to express the original vague ideas clearly, forcing yourself to sort out ideas.

conclusion

Here is a list of iOS related technical points as I understand them, as well as a few tips for improving capabilities in practice. It may not cover all aspects, but it is just a reference. In addition, this is only limited to iOS development, in fact, as a programmer should not limit the scope of their learning, have more time to understand the back-end/front-end/operation and maintenance will be very conducive to the improvement of their own development ability.