XMPP protocol for Instant Messaging underlying writing (iii) IOS xmppframework--im underlying architecture design + technical preparation

Source: Internet
Author: User

Recently there have been some things that have not been very pleasant, which have led to a long break, I'm sorry. "Do not dazzle skill, understand the principle, be responsible for own code, can be responsible for the team and project"--Guo Elder in the group said the quotations, let me very happy and teachable. I write the first time blog is in 2011, when the original intention to write technical blog is to write a diary: Today I learned what knowledge, technology, record their own program of the growth of apes. With the accumulation of technology, write blog in order to share: silly, if you also encounter this problem, this is my solution, see these XXX processing good, can "copy" the answer to the 60 points to solve the problem. To this stage, the blog is to share in the meantime, help some people (you can also understand to start hooves-hyun). I want to make some people, have the same common people: the love of technology, like special research. But in the time of meeting, I was very afraid, afraid I can not help saying the wrong thing, I am afraid I can not help but want to impose their views to persuade others to recognize, I said is right, in fact, I am very afraid of competing with others technology. "How can you be so stupid, what's so noisy, he thinks he is right, then the problem he can solve on the line, you ensure that you do not make the bug you are right, do not discuss technology technical"-CAI senior in a humble quarrel with colleagues in the time of severe criticism. So--do you want to discuss technology? I think I will still choose to discuss technology. In the programmer's ranks, I always look at myself this way: I do not cow B, met can help me, to my new technology and knowledge of the people, I will go to the title of a great God, senior. I've always looked at the ape that asked me: He was very studious and wanted to learn from him. Knowledge and technology are everywhere, only learning is their own.

Today came home from work to see the Web page, read Cocoachina sent Mail, which has a bit of a laugh after reading. As a concern for the Cocoachina three years of iron powder, but also began a little disappointment on this site. Because part of the article is wrong outrageous, part of the article is swallowed, part of the article is not read value in order to complete the task, these will be completed the task of the same recommendation, like today just read the MVVM, after reading it didn't know what it brought me, What does MVVM have to do with wiki queries: theModel View ViewModel (MVVM) is anArchitectural patternused in software engineering this originated fromMicrosoftAs a specialization of the Presentation Model design pattern introduced byMartin Fowler.[1]. is very nostalgic for the early batch of great God's blog article.

Http://en.wikipedia.org/wiki/Model_View_ViewModel

OK, finally can start the topic of today's blog: IM infrastructure design + Technical preparation work


Disclaimer: I am just a pure iOS 3years + food forcing, if you have been misled, doubts, poisoning and other bad conditions, please pull your technical boss to evaluate: This idiot said right? Do you want to educate him together? (Education address: [email protected], welcome to the Great God education ~ ~ ~ (>_<) ~ ~ ~ ~)


I. MVC &MVVM Architecture

MVC MVP MVVM ... Wait, I really do not know, because I did not read, did not check the document, write project is not strict requirements so to write. Because I just know a little, "This TMD so many design patterns, in the end is for what I want to use." MVC, who has been patiently educating me for 2.5 hours and what MVC is, is the first boss to come back from the United States for more than n years. Bitter force coding 9 years of another boss has hard to write a demo to educate me, what is MVC. So I'm just saying one thing, what is model or module.

Http://zh.wikipedia.org/wiki/MVC

used to Package data related to the business logic of the application and the Processing Methods . "Model" has the power to directly access data, such as access to a database . "Model" does not depend on "View" and "Controller", that is, the model does not care how it will be displayed or how it is manipulated. However, the changes in Model data are generally published through a refresh mechanism. to implement this mechanism, the view that is used to monitor this model must be registered in advance on this model, so that view can understand the changes that have occurred on the data model (PS: This is the VM definition).


Keyword: encapsulation, processing methods, access to data, no dependencies, VMS need to be view registered (injection, injections, injection)

The son of MVC, a successor, is called MVVM and looks a little more handsome than his father Mvc. But the job, the real fuck, code flying, all kinds of protocol, all kinds of injections, as well as his father work orderly, practical, clean and tidy. --From a dish without MVVM forcing a monologue inside


If you have no idea of the data structure, presenttemp (a class similar to the definition and purpose of a format Struct ) and model, it is recommended that you summarize and analyze it, or ask your boss or seniors to help you explain. I don't feel shameful, as long as you make sense, I will accept your correct point of view.

Of course, you do not understand the design pattern, do not understand the architecture, in fact, it does not matter. Because I do not know very well, but I write the code is very clear, specification, VC is lightweight, cohesion poly-low coupling, colleagues good understanding, with simple and clear, then this is your architecture and mode. (Do not complete and maintain project in order to be gorgeous, and to make good maintenance project is good martial arts).


Two. Technical preparation work

Database: 1CoreData + Multi Thread Highly recommended

2 libSqlite3.0 + Multi Thread is not recommended

Listening: 1NSFetchedResultsController Highly recommended

2 Nsnotificationcenter general recommendations

3 KVO not very recommended

Multithreading: 1GCD Highly recommended

2NSOperationQueue & Nsoperation general recommendations

3 Nsthead not very recommended


Not recommended: These techniques are too specific, difficult to control, tired, error-prone, unsafe

General recommendation: Some technical implementation will require

Highly recommended: Abstract, easy to use, not error-prone


do IM, the data storage read, to the UI of the data fill redraw is very high requirements. Especially the data piece. If the multithreading data processing efficiency is low, then the message response is slow. If the UI data fills and draws poorly, then the instant Messaging experience sucks. Using highly recommended techniques can be a good guarantee for these.


Three. Practical use

Drawings: Architecture Design




Model+xmppservice: In preparation ...


There is no next period, if more people ask questions, will consider continuing to write.

A simplified version of the Model +xmppservice package is being prepared and then uploaded to Https://github.com/XiangqiTu/XQXMPPService. Some specific instructions will be in the comments. Please expect

XMPP protocol for Instant Messaging underlying writing (iii) IOS xmppframework--im underlying architecture design + technical preparation

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.