< IUP ISI | MediaWiki-Silk Revision as of 21:59, 25 October 2010 (view source)Alexandre (talk | contribs) (→Choice architecture)← Older edit Revision as of 22:01, 25 October 2010 (view source) Alexandre (talk | contribs) (→Choice architecture)Newer edit → Line 33: Line 33: * Disadvantage * Disadvantage ** Readability ** Readability +** Can handle only 1 request at a time. Multiple classes Multiple classes * Advantage * Advantage ** Readability ** Readability +** Can handle some requests at a time. * Disadvantage * Disadvantage ** The memory management ** The memory management Revision as of 22:01, 25 October 2010 Contents 1 Introduction 2 Choice architecture 3 Technical contacts requirements 4 MediaWiki UML Introduction API The API is composed of some classes (UserGroup, Namespace, General, Page...) and a MediaWiki class to access data. Library architecture at the begining The library is composed of a unique class: MediaWiki. Choice architecture Synchronous or asynchronous? Two choices are possible to develop the request management in the library: synchronous and asynchronous. Synchronous way will lead us to use normal function call. But, since we expects the end of the function, the interface can freeze especially if there is a lot of latency. Moreover, this way will allow to not use signals. Asynchronous way don’t block the interface because the application doesn’t wait the result of each request to execute the program. This method will lead us to use signals to access to the result. On the one hand, use synchronous way will lead to use a QEventloop to avoid the freezing and a QNetworkAccessManager in synchronous mode. Otherwise, this way can involve the use of different threads in the application. On the other hand, use asynchronous way will lead us to use signals and a QNetworkAccessManager in asynchronous mode. To conclude, we choose the asynchronous one. Moreover, this method is the one used in the library architecture at the begining. But the asynchronous way give the problem of access to the result. Develop Unique class vs multiple classes? Unique class Advantage No memory managing The request calls are normal : wiki->allpagesRequest() Disadvantage Readability Can handle only 1 request at a time. Multiple classes Advantage Readability Can handle some requests at a time. Disadvantage The memory management Technical contacts requirements First, the technical contacts want a asynchronous interface: ”Even if you use a QEventLoop,you'll often need different threads in the application, and those can be a bitch. You can have a look at the current MediaWiki class to how those signals / slots should look like.” Secondly, to call a request, the code should look like: MediaWiki * mw = new MediaWiki(“mon_url”); mw->allpagesRequest(); connect(mw, SIGNAL(allpagesResult(QList<MediaWiki::Page>)), SLOT(allpagesProcess(QList<MediaWiki::Page>)); MediaWiki UML MediaWiki The MediaWiki class allows developers to call asynchronous request to access the MediaWiki data. For this, developers call a request like allpagesRequest() who send the request with the QNetworkAccessManager. To process the result, developers connect the signal allpagesResult() with his own slot. Because the class MediaWiki needs to emit signals, MediaWiki inherit QObject. Why don’t separate the code To follow the first development of the MediaWiki class and with the agreement of the technical contacts, we don’t separate MediaWiki and its requests. Who manages the memory? There is one class, so the library can manage the memory. Why QNetworkAccessManager? It’s the Qt class for HTTP requests and it is asynchronous. By the way, we can use this class in a synchronous way using QEventLoop. KDE library? At this time, we don’t use KDE library because Qt provides the necessary. Namespace To avoid name conflicts with others libraries, we propose to define a namespace like silk::. mediawiki:: was a possibility but there will be a redundancy (mediawiki::MediaWiki). Binary compatibility For ensure the binary compatibility, we’ll use only a pointer to MediaWikiPrivate, which will contain attributes. In this case, modify the attributes doesn’t fail a class which uses MediaWiki. Retrieved from "https://community.kde.org/index.php?title=IUP_ISI/MediaWiki-Silk/Architecture&oldid=5652" Content is available under Creative Commons License SA 4.0 unless otherwise noted.