• Ei tuloksia

Software design is a process of envisioning and defining software solutions for one or more sets of problems. It contains many procedures such as abstraction, refinement, software architecture, modularity, front-end UI. However, this chapter focuses on three main points: software architecture, modularization and user interface.

2.3.1 Software Architecture

Software architecture is the highest abstract version of a system that defines the blueprint of a software system. It identifies the software a system which consists of a collection of key components interacting with each other by the connectors that describes the re-lations among them. The software architecture lays a solid foundation for the software and it is costly to modify once implemented. The aims of designing software architecture is to bring the software characteristics such as flexibility, modularity and scalability into the structure solution to fulfil technical requirements of the software. A good software architecture is crucial when developing a software that keeps itself easily maintainable and reduces the costs, avoiding the duplicate codes. It also increases the performance of the software and makes it fault-tolerant.

Architectural design patterns are common, reusable solutions for designing software ar-chitecture. The purpose of the architectural pattern to fit the collection of components together and achieve the message and data flow between each other. Nowadays, for de-signing a data acquisition software architecture [21], the producer-consumer and

event-driven patterns are the most common solutions.

The producer-consumer pattern originates from Master-Slave Pattern [22] is a classic example of parallelism that multiple tasks are performed synchronously. Figure 2.7 il-lustartes the principle of a multi-producer and multi-consumer design proposed by Ben Stopford. This pattern consists of two main sections: producers and consumers who share a common buffer such as queues [23]. The multiple producers generate data and messages on its own rate and then send these data via a shared memory. In another end, the consumers utilize the data at a different speed and a few common consumers can deplete even multiple data. To connect the producer and consumer, a queue is usually applied to achieve data communication. Queue is an excellent mechanism to pipe the data from producer to consumer which could not only avoid data loss during the trans-mission and keeps a great amount of data in the memory pool at run time. Usually, there are two different way of inserting data. The first one is to append the data element into the end of the queue and it follows the First-In-First-Out (FIFO) [24] principle. The FIFO guarantees the data generated from the producer will be executed in order. The other method is to insert the prioritised data into the front of the queue to assure immediate execution.

Figure 2.7. Multiple producers generate the data own its own speed and multiple con-sumers utilize them at a different rate. The data and messages are transmitted via queues [25].

Figure 2.8. The publisher notifies a message to multiple subscribers who subscribe to the event when it happens via an event channel. It achieves the communication between decoupled software components [26].

Event-driven pattern is another classical design paradigm based on publish-subscribe model in which the flow of the software is determined by the events. An event is rec-ognized as any important changes in the states of the system hardware or software.

There are two sources of events, internally and externally. The external events mainly stem from user actions such as a keystroke or mouse click. The start or end of the soft-ware execution can be considered as an internal event. Figure 2.8 explains the principle of publish-subscribe mechanism [27] in event-driven pattern. Once an event happens, the event publisher categorizes the event messages and notifies them to the event sub-scribers without knowing the number of specific subsub-scribers or the outcome of the event.

The subscriber triggers the actions only when it receives the message. The event chan-nel is used for transmitting the events between the decoupled software components. The primary advantage of event-driven mechanism is that the triggering and executing of the events are asynchronous without blocking. It also avoids the unnecessary polling for the operating system which saves the CPU resources for other tasks [28].

The producer-consumer provides an excellent solution for data flow inside the software system with the possibility of acquiring and consuming data simultaneously, while the event-driven pattern triggers the communication between each decoupled software com-ponent. As a result, it is possible to make the software scalable, loose-coupled and easy maintained.

2.3.2 Modularization

Modularization is a technique to break down a large software system into multiple in-dependent and discrete modules that are supposed to perform own functionalities inde-pendently. Effective modular design can be accomplished if the separate modules are independently solvable, adjustable as well as compatible.

Figure 2.9.The main program consists of two modules name M1 and M2 which have own functions. Every module could either interact with the other one or use its own functions to finish certain tasks.

Figure 2.9 shows an example of modularization of software design, the main program consists of two discreet modules named M1 and M2. Every module has limited or none reliance on the other and each has own functions to fulfil certain tasks. In order to accom-plish a system task, each module could interact and cooperate or adopt its own methods.

There are two criteria to assess the extent of modularity for a software: cohesion and coupling. Cohesion describes the strength of the relationship between data and func-tions within a single module. Usually, a high cohesion in the module is recommended because high cohesion is associated with common characteristics of the software and it reduces the duplicate of codes. Coupling measures the strength of the relationship be-tween different modules inside a software. Low coupling tends to be preferable because modules should be as much independent as possible from other modules. Hence, the modification of modules does not affect heavily on the others. All in one, a good modular software should be high-cohesion and low-coupling.

OOP is one of the typical solutions to modularize the software based on the concept of class and object. Class corresponds to either the things in reality or the abstract entities which contains a collection of data and methods. It acts like a blueprint that defines the behaviours of the data and methods. The object is an instance of the class. OOP provides encapsulation for objects, which means the internal representation of data can be hidden from outside of the scope of objects or in case of misuse. Only the own methods of objects can have access to the internal data.

The advantage of software modularization is obvious. Software can be divided into

sev-eral units regarding functionalities and the individual modules are easier to maintain and modify compared to the whole software system. Components with high-cohesion inside a module could be reused.

2.3.3 User Interface

User interface is the front-end window compared to software architecture design to which users interact to operate the software. Users can control the hardware and software by using the user interface. The user interface is an important part of a software which directly interacts with users and gives users insight into the software. Graphical user interface is one of most common UIs and it provides user graphical ways to interplay with the software. It is believed that the UI should be simple to use, clear to understand and respond to user actions.

A basic graphical UI usually contains a window, a tab, a menu, an icon and cursor. A window is a place where contains all the content of the software. Contents such as tab, file path input, or icons are placed and displayed in a window. The window could be resized, minimized or maximized to flexibly meet users’ requirements. A main window could also contain few child windows such as tabs. A Tabbed Document Interface (TAB) can store multiple independent child windows in the same main window. The selected tab window is considered as the preferred panel to view. This design helps highlights the preferred window as well hides the unused one which saves space on the main window.

For instance, most web-browsers have adopted this design. A menu is a collection of similar type of items which are grouped and placed together in the window. Some menu could be either invisible or invisible according to the workflow of the software. Icon is regarded as the smallest element of the UI such as button or file path input. They can be either clicked or double licked to trigger certain functionalities. Lastly, a cursor is identified as user inputs and it interacts with external devices such as a mouse or touchpad. They are used to manipulate the icons for users.

User interface is a critical part of the software and it determines the user experience directly. Therefore, a good design of the user interface makes a software attractive and simple to use.

3 RESEARCH METHODOLOGY AND MATERIALS