IOS componentized development · What is componentized and ios Components
More and more companies have started componentization. When will you wait ......
Speaking of the development mode, we are most familiar with the Development Mode MVC or recently popular MVVM. However, the componentized development I am talking about today is actually not a type of MVC. It is actually ·····
In actual work, especially in large projects, and when many members participate in development, the business line is constantly complicated with the continuous development of time, you will encounter the following series of problems. Really annoying ·····
- 1. Code Coupling is very serious. The existence of a controller depends on many controllers. A controller may depend on many controllers.
- 2. The project gradually becomes bloated, huge, and complex. Each compilation takes a long time.
- 3. The entire project should maintain a consistent development model. Those who like MVC are not good at MVVM and those who like MVVM feel that MVC is too Low.
- 4. Independent tests are not allowed.
The problems of traditional team development models are gradually exposed in constant iterations. So we should understand a more advanced and efficient team development model, that is!Componentized Development
The following is a detailed introduction.Componentization
OrModular
Development
What is componentized development?
Componentized development refers to splitting a bloated and complex project into independent function modules or components based on its functions or attributes. Then, based on the project and business needs, in a certain way, any project is organized into a project with complete business logic. This is the so-called componentized development.
Advantages of componentized Development
Since componentized development is mentioned in the above problems, it is necessary to explain the advantages of componentized modular development. In this way, we can clearly locate the problems we want to solve during the comparison. Determine whether componentized development is the team development mode we need.
- 1. components are independent of each other. The Code of each component development member should be compiled, run, and tested independently.
- 2. Reuse of resources, especially functional and instrumental code, can be easily reused
- 3. Improved Iteration efficiency. To increase or decrease functions through iteration, you only need to split and combine components. Convenient and efficient
Precautions for componentized Development
Several issues need to be considered when the new project is split by component, or when the old project is restructured by component. Decoupling is not an easy task for old projects with high coupling.
- 1,Basis for component splittingThat is, what content should be divided into one component?
You can split data according to the following aspects:
- ①Basic Components
Global constants, common macros, common classifications, isolation and encapsulation of common third-party frameworks, and some commonly used small function classes
- ②Function components
Image carousel, image and text menus, bullet screens in videos, cameras, videos, QR codes, downloading functions, and customized prompt boxes can all be encapsulated in a single component.
- ③Business Module
E-commerce shopping cart, order management, ordering process, personal Center
For example, video or live video member management, video playback full screen, small screen in the lower right corner, cache, etc.
2,Componentization Method
I have been talking about componentization. What is component. How does a component exist?
Component form:Each component exists as a pod library.
Internal components:Components are divided into folders according to their favorite development mode.
Component test:Each component corresponds to a separate demo to test the function of the component. In this way, the test function is decoupled.
3,Component combination
Since the component exists in the form of each pod library. The component combination method is to add and install each component by using CocoaPods.
Components that are combined can communicate with APIs provided by components as needed, or middleware can communicate with components in a unified manner. In the subsequent articles, I will introduce them one by one.
Summary
The content after the topic of componentized development will be constantly updated. Welcome to your attention!
Author: Biharry
Link: https://www.jianshu.com/p/c8f49ac9311f
Source: Simplified book
Copyright belongs to the author. For commercial reprint, please contact the author for authorization. For non-commercial reprint, please indicate the source.