Recently busy to interview iOS development, I was surprised that the interviewer asked how to divide the directory structure, but also specifically asked each subdirectory of the file name.
The directory structure is really important, and the interviewer is undoubtedly trying to pry into the development experience. A clear directory structure that allows people to understand the business and functions at a glance, which can also reflect the developer's experience and architectural level.
At the moment, I have been exposed to projects that are more conventional in two structures:
1. Main directory According to the business classification, the internal directory according to the module classification (main directory according to the MVC architecture classification, internal according to the Project module classification)
优点: Relatively fast positioning of the corresponding business.
缺点: module related classes are too scattered, need to switch back and forth to find files, inconvenient to develop.
2. Main directory According to the module classification, the internal directory according to the business classification
优点: Centralize the class of modules to facilitate management and development.
缺点: When several modules share some classes, they are not well categorized.
Suppose to Jane book iOS app Catalog classification (unofficial):
- 1. Main directory According to the business classification, the internal directory according to the module classification
- 2. Main directory According to the module classification, the internal directory according to the business classification
注意: The above two categories are not absolute, but also in accordance with business needs to classify. If the company multi-project (refers to the outsourcing company, ha ~), you can try to classify according to their own logic, or you can observe the next side of the project, will learn the mystery. The code is the same, look at the great God write, even can directly imitate the code style of the Great God, others will treat you as the great God!
ps: commented that the Chinese name of the directory notes is lo. Indeed in development, some very experienced programmers do not do so, even in the code are rarely Chinese comments. But personally, ordinary or middle-rank senior engineer really drip is necessary more comments, because of less experience, variable and method names may not be named bad, many with GOOGL translation, and even to review the code can not be literal. Thank you note the advantage is that even if you do not understand the code I write, it will also be able to let you know what it is to do (million, ha ~), convenient and convenient for others! Finally, the directory is not really good or bad points, as long as the application of their own business, is the right directory!
About the directory structure of iOS projects