Main Technologies

After we finished our research, we have used Swift as our main language and Xcode and its toolchains as our IDE in our Prototype Stage 1 Project.


alternative
alternative

System Architecture

This page introduces the design of the mobile application. Generally speaking, this architecture adopts the classic Model-View-Controller (MVC) pattern (Reenskaug and Coplien, 2009).

Models include UserModel, ChannelModel and VideoModel, each holding information and buffered data from X5GON Backend. User interactions are captured through Observers in various ViewControllers inherited from MainViewController. With the main logic implemented in these Controllers, they dispatch view changes to relevant Views or ViewCells, and make modifications to data in Models accordingly. Then, we use a daemon thread to keep track of changes and update them with the X5GON backend when suitable.

UML Class Diagram

Click on the diagram below to get a clearer view of the general software design of the application.

alternative

Design Patterns

Prototype Design Pattern (Duell, 1997)

Prototype Design Pattern is used in the project on ViewControllers to ensure single responsibility principle and make ViewControllers replica for different Video sessions more reliable.

Adapter Design Pattern (Freeman et al., 2004)

Adapter Design Pattern is used specifically for user authentication module in the application. When UserModel uses its static method to authenticate with X5GON backend, we provided a specific AuthenticateAdapter layer in case of future variations of authentication methods.

Builder Design Pattern (Gamma et al., 1994)

Builder Design Pattern is used in the project on constructing new UserModel, VideoModel or ChannelModel. Since the models contain a great amount information and cannot be fetched in one attempt, we used VideoBuilder and UserBuilder to store temporarily constructed middle-objects.

Data Storage and Entity Relations

We are currently storing cached VideoModel and UserModel in the local caching folder as .mp4 and .json files.

In the future, we are looking to optimise data storage with the CoreData storage provided by Cocoa Touch Applications (Apple Developer, 2020). We also aim to provide an Entity Relationship Diagram at a later stage of the project.

Sequence Diagram

We provide a sequence diagram to clearly illustrate what functionalities are being supported at this stage.

Click on the diagram below to get a clearer view.

alternative

Implementation

Since our project is a mobile application, our implementation is heavily View based. Our team decide to present each view class in our application.


Implementation Highlights

Since a brief introduction of overall System Architecture can be found above, we provide several highlights that are worth noting at our current development stage.

alternative

Generate Thumbnails on-the-fly

The X5GON backend provides users with videos but not thumbnails or preview methods. To tackle this issue, we used a DispatchQueue (Apple, 2009) to create a separate Thread that aims to generate thumbnails by fetching the video image at 1 minute mark, without interfering with user interface on the main thread.

Click on the code below to see an sample of implementation for such methods.

alternative

Load everything behind the scene

We kept performance in mind since our application is rather network-heavy and requires common re-rendering. That's the key reason why we load everything behind scene with Apple's Grand Central Dispatch Multi-threading (Apple, 2009) and hint UIView whenever we finish loading to refresh only bits of Cells. This ensures smallest amount of load on both CPU and GPU on mobile platforms, and of course, greatest responsive from a users' perspective.

Click on the code below to see an sample of implementation for such methods.

alternative
alternative

References

  • Apple (2009). Apple Technical Brief on Grand Central Dispatch" (PDF). Archived from the original on September 20, 2009. Retrieved September 12, 2009.

  • Apple (2020). Core Data | Apple Developer Documentation. [online] Available at: https://developer.apple.com/documentation/coredata [Accessed 22 Jan. 2020].

  • Duell, Michael (July 1997). "Non-Software Examples of Design Patterns". Object Magazine. 7 (5): 54. ISSN 1055-3614.

  • Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (1994). Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley. pp. 97ff. ISBN 0-201-63361-2.

  • Freeman, Eric; Freeman, Elisabeth; Sierra, Kathy; Bates, Bert (2004). "Head First Design Patterns" (paperback). O'Reilly Media: 244. ISBN 978-0-596-00712-6. OCLC 809772256. Retrieved 2013-04-30.

  • Reenskaug, Trygve; Coplien, James O. (20 March 2009). "The DCI Architecture: A New Vision of Object-Oriented Programming". Artima Developer. Archived from the original (html) on 23 March 2009. Retrieved 3 August 2019. "More deeply, the framework exists to separate the representation of information from user interaction."