The systemic impact of client-side apps
Context
In the beginning of the 3rd millennium we notice emerging trends in the process of developing software applications, with the purpose of improving computational efficiency (maximizing response speed, minimizing electricity consumption). The diversification of interaction paradigms, not only between applications and users, but between development environments and programmers as well, is taking proportion in this technological period. .NET, sustained by new iterations of Windows for the PC and Windows Mobile, and Java, sustained by Linux (and Android, which is based on it), are constantly expanding as platforms. One can also see a similar parallelism between Mac OS and iPhone OS. These combinations between systems and programming languages define new practices of efficiency, which, along with existent ones, can be generalized in a global vision.
In the given conditions, a unitary programming strategy is needed, as a software engineering standard which should consistently treat aspects that can be optimized, in the context of increasing pressure from the user community, eager of maximum performance with minimum costs and improved effects on the environment. Furthermore, we can argue the necessity of real time solutions for decisional problems which can appear during implementation.
The purpose of this article is to study the impact of client-side apps on local computation resources and to reveal optimization techniques which are usable on multiple programming platforms.
Algorithmic optimization
One of the aspects that can be optimized within a program is algorithm implementation. Its subject usually consists of data structures, therefore a detailed knowledge of them is needed, including the difference between primitive and wrapper types (e.g.
int vs.
Integer in Java), selection mechanisms (how the compiler sees these types) and the possibility of an object being
immutable. Once this basis is established, certain structural profiles define themselves - for example, in the case of collections, access by index (array) or by sequence (list). Continuing this rationale, we notice the distinct purposes of sorting a finalized data set and real-time sorting. Thus, solutions that are put in practice are highly dependent on the application context, the choice being based on a set of criteria. Such a criterion is the magnitude order of execution time (known as the O notation).
An additional dimension of the client-side app's life is the periodical refreshing of information and the means of storing / accessing it. The actual behavior has to be defined carefully, considering the possible lack of an internet connection. We can deduce the necessity of storing a data copy in the moment of refreshing so as not to affect user experience. As a
case study, i'd like to point out the processing of an XML feed through the JSON serialization format. We have, therefore, referred to the data input and the observable behavior relative to algorithms. So, if we would map this activity on an IPO model (
Input Process Output), the necessity of adjusting the actual process stands out, purpose which can be reached by parameterizing certain portions of code. This way the acceptance to future changes increases, so the programmer's ability to anticipate flexibility in structures becomes very important. To define the parameterization both in hierarchy and in code, it can be encapsulated as attributes in an object, more such objects supporting more user profiles (personalized settings for every user). The adjusting can be done in the opposite way as well by collecting usage statistics, process which is divided into 3 steps:
- initiating communication on the user machine
- calling a server-side script
- modifying a database
In the present context, certain standards, like anonymity, have to be upheld. For example, you could assign every user the number of milliseconds which passed from 1970 to that install. This is implemented in many programming languages (e.g. in Javascript it's new Date().getTime()) and this way you don't need to store data that might be considered private, like the IP.
IPO model of the client-side app
A part of the interface optimization can also be included in this section, with specific techniques:
- dynamic definition: brings an improvement in memory usage and programming time
- changing / destroying graphical elements: can be very important on mobile phones, since an app might be interrupted by a call, but after it's over it has to be able to revert to the initial state
- intuitive interaction
- visual space: influenced by the container object, the actual functionality and by the equilibrium between volatile notifications and the ones which contain full sets of data
- recycling graphical elements: through geometric models (e.g. rotation, for 'back' and 'forward' buttons)
Note: by 'volatile notification' we mean a message that appears for a few seconds, not taking space an indefinite amount of time.
Treating graphical resources
How images are used, along with native loading mechanisms, can play an important role in optimizing the performance of a program, especially if they intervene directly in the dynamic behavior of a program. You can see below a comparison between the most spread formats. As the image dimension increases, the speed differences widen, but the order remains constant. So for small images the intrinsic features of these formats take precedence (choice should be based on the main purpose: transparency, color depth, etc.), while on bigger images additional metrics could be constructed to help us decide (e.g. [format loading speed] * [format storing space]).
Figure 2:
Speed ratings based on image loading stress tests on user machines
(component of my bachelor thesis: "The systemic impact of client-side apps. Optimization techniques")
Anyway, apps diversify as we take into consideration more working parameters. For example, the actual process of reading data from a file can be highly dependent on the operating system, just like a graphical container object which displays an image. Also, the impact is different on mobile systems vs. desktop or laptop systems in the sense that the first almost always run on battery, resulting not just a need to optimize actual rendering of the image but also to reduce the number of renderings. Furthermore, in the context of connectivity which is more and more present in the 3rd millennium, multiple types of client-side apps have developed having defined dedicated computation devices (e.g. videoboards) and differentiated applicative purposes (e.g. video games vs. web browsers) as criteria. The current situation in technology is made hole by emergent formats like JPEG XR (also called HD Photo) promoted by Microsoft, APNG (Animated PNG) promoted by Mozilla or SVG (Scalable Vector Graphics).
Conclusion
We have gone over a number of techniques which are applicable in a large set of contexts, suggesting a unitary optimization strategy which starts in the design phase (or even specification) and reaches implementation. We've also touched the area of automatic comparisons. We'll talk about the research possibilities they open in future articles.