The development of IOS large-scale project

Source: Internet
Author: User

The headline is scary, so don't be afraid, but it's definitely not a literacy sticker, it needs a certain iOS development. In my years of farm life, most of the time is to do small projects, the larger may also be the attitude of millions of lines of code, and windows tens of millions of lines of the source of the system is almost trivial. However, a rare million line of code for an iOS project is pretty big. What I want to say is that people always grow up and will take on bigger responsibilities and accept greater challenges, and one day there will be a major task for you. However, software development is not overnight, nor how vigorous, more is mediocre in a lot of detail processing. Doing large projects does not necessarily require deep skills, perhaps the scientific processing of details and the management of norms.

First of all, the selection of programming language, OBJECIVE-C is still swift? I haven't used Swift in the project, because I can't crush myself to use it, where its advantages are, and you can't force your teammates to learn Swift. Of course, do not mean no, the first to use Swift to develop meaningless products of people without seniority wearing tinted glasses despise not swift counterparts. Do you know how many pits there are in objecive-c and Swift? Did you know that Swift also shared a runtime environment with OBJECIVE-C? Do you know that using Swift will make the IPA package larger than 10 m? Swift stands for the future, and Objecive-c is now. Swift can do objective-c can do, for example, closure completely can be replaced by blocks, the tuple is completely able to use the structure to replace. Production environment with OBJECTIVE-C, amateur looking at Swift, this is my mood. Raywenderlich now has a pile of swift tutorials, the use of cutting-edge technology in the domestic always slow a beat, to a large extent, the wall has prevented the development of domestic it practitioners, wall developers (including my Information Security engineering teachers) will one day be the trial of former history.

Again, the application architecture, it is also MVC, failure is also MVC. If the children of the team are allowed to develop according to the MVC they know, the result is usually a high coupling between classes, and the controller is almost toolbox ... Each time the version of the iteration will be suffering, if the function is not much can reluctantly adhere to the function of more will collapse, such as the Expo Garden China Pavilion Bar, and then share more than 5 layers to try, hehe. In the end, developers can only choose to reconstruct the reconstruction or run, the latter more practical we all understand, especially in the business of the King of the company, the code quality of a fart as long as work, but good programmers are dignified, deadline or shoot the head of the political task will often let the programmer tired of perfunctory, If you dislike it, you should withdraw. On the other, the MVC has become bloated, that is, weight loss bai. Usually after the weight loss MVC is called Mvcs or MVVM in the iOS world, these 2 are certainly not the same thing, the project selection Mvcs is still MVVM still depends on your transactional characteristics. is Mvcs and MVVM that perfect? Of course not, Mvcs should pay attention to the service/store of the chaos, the data will not be the same as the module pollution. MVVM is not good enough to increase the protection of the project is difficult, I said the view and viewmodel between the loose binding relationship, in iOS development mentioned MVVM we think of Reactivecocoa, there is no reactivecocoa can ah, Just Reactivecocoa many advantages, such as code convergence does not have to write everywhere, other advantages from a to explore it.

For the construction document arrangement, many people are controllers/views/models/vender ... So classify, originally this has a question, for example you want to find Controllera TableView use of CELLB class, you also want to go to the views inside one after another, too suffering, even if search is still bitter what can not see is the income. I usually distinguish by module, in which each module has a CONTROLLERS/VIEWS/MODELS/STORES/API so that the API is a wrapper for each interface, which is called by the store, The data parsed into the model and passed block to the controller to rewrite the view, is it very round? The racsignal created in the Rac,controller subscription store can do the same, U can make a try. There is also helper and utility, unrelated to the transaction, with the target nature, the support function of the code put into the helper, such as the creation of a custom target package. If it is only a function or algorithm, not a target and a lot of local can use, put it to utility, for example, sorting/encryption algorithm.

Construction document arrangement Construction

For the design of the network communication module, I personally think that every HTTP plea should be independent of each other, that is, you encapsulate the Post/get method will create a temporary goal, and long cohesion usually only adhere to one instance of the goal of a single-case approach to create. I will plead for each HTTP interface to create an API target, in which to plead for data, of course, in order to prevent the repetition of the code to establish a base API class, the subclass calls the parent class of the request method is OK, not just the interface and parameters. Thinking is so, in the future there are time to talk about the design of the API class.

For multi-threading, the GCD and nsoperation are the most used in iOS development, and GCD is sufficient in most cases. But Nsoperation also has its advantages, such as the ability to set the number of concurrent, can set the dependency between threads, can pause and restore, contrast flexible, multi-threaded download often use it. Interview also often ask GCD and nsoperation differences, this from a to check, the material is still rich in contrast, there is also an article for nsoperation see connection. GCD although strong, but still have a lot of people blind use, really for their worry, casually say a few points:

1. Disorderly use dispatch_after do timer cause crash! I don't know if there's another thing called Dispatch_source_set_timer?

Countdown

2. Do not use Dispatch_sync easily, thread synchronization method So many why you have to fall in love should not love it! Especially do not in dispatch_async inside with Dispatch_sync, do not ask why, Baidu inside Google a bit!

3.dispatch_once also on the creation of a single case of cent use, do not use blindly. Dispatch_once is only performed once in the full app life cycle, not just once in the target life cycle, brother!

4. What! You don't know how to create serial threads and parallel threads with GCD!

Serial

Parallel

For multi-team collaboration, Cocoapods is undoubtedly a very good tool if the project is developed using a sub-module approach. Relatively independent modules as far as possible to play a private pod, so, public channels to the structure of the full project, other departments only need to set up a private pod, the use of public channels to play the private pod of the independent development and debugging, instead of submitting code from time to the main project, so it would be very troublesome, For example, the code merge conflict, the certificate conflict, will be crazy. When the module development is completed and then submitted to the main project is good. Of course, private pods play more trouble, the private pod relies on more private pods in the increase of files to target will be very painful, xcode tacit consent is target all selected, and Apple reaction to expect them to deal with.

For data durability, the main thing is to adhere to the common data sources. There is a comparison of the main is the future of the app to advance compatibility, the kind of your application to start the collapse of the doubt, most of the new version of the data structure changes, does not support the old version of the data may be set, and so on. I always eccentric sqlite, the most used is Fmdb, no love for CoreData. To know that Apple's app news is Fmdb, I remember someone asking Facebook engineers "Why your app is slow", "because we use core data!". There is an open source library Magicrecord, the depth of the CoreData package, I used, it is also good.

What else is the unit test really necessary? Unit tests can make logic clearer, and when you just read the unit test code, you'll find that they're written as pseudo-code in a programming textbook. This is especially useful when TDD is a time of division. After writing unit tests, you can quickly sort out the logic and then use the code to implement it. Unit tests can reduce the coupling of the code. We know that a high-coupling code is hard to do with unit tests, and conversely, if you have to do a unit test, you're not going to write the code with a high degree of coupling. The unit quiz lets you know if your corrections to the code affect the original function, but that's all the regression tests can do. The Unit quiz features: It tests things that are small enough to be reused after code refactoring. Unit quizzes are only one test that can reach 100% coverage. Unit test beginning difficult, continue to do the words will be more and more simple, because the embarrassment is mainly because of the environment and the lack of pile function. A unit quiz is a simple fix for a bug, which is like hitting a lot of breakpoints in your program. Unit tests are a time-consuming exercise, but they are more time-consuming to fix bugs.

Talk so much, and finally talk about the need. I think in need of assessment should be as far as possible to throw out the details of the question to PM, they do not understand the skills, if the need to blindly develop, and then halfway to change the need, which is very hurt morale, especially when it comes to the revision of the architecture, which reminds me that the PM changes need to be the programmer to decide the brick diagram, Need to be unstable, do not start, willing to soy sauce Read blog. Well, long winded, how many people will see here? Expect to come back later to add some content. Specific website

http://www.keymob.com/

The development of IOS large-scale project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.