Michael Lauer
Neu-Isenburg, Hessen, Germany
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the books product page, located at www.apress.com/9781484253793 . For more detailed information, please visit http://www.apress.com/source-code .
ISBN 978-1-4842-5379-3 e-ISBN 978-1-4842-5380-9
https://doi.org/10.1007/978-1-4842-5380-9
Michael Lauer 2019
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
1. Introduction
In the beginning, the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
Douglas Adams, The Hitchhikers Guide to the Galaxy
This chapter explains why Vala is a good idea and how you could benefit from a massively increased productivity, if you use it. It talks a bit about the history of Vala and mentions the authors personal involvement. Structure, audience, and typographic conventions are presented.
Why Vala?
Throughout the last decades, software development has been subject to a gradual but significant shift in priorities. Whereas in former times the run-time performance of a program was the most important aspect, these days, the build-time performance the time required to transfer a problem description into a running programis becoming more and more relevant. The build-time performance not only depends on the initial effort for writing a program but also includes the time required for debugging and maintenance, which is usually significantly higher compared to the initial writing.
The figure below shows some of the more common languages with respect to their run-time and build-time efficiency.
Figure 1-1
Build-Time vs. Run-Time Efficiency
One of the main factors that play into the run-time and build-time performance of a program written in a certain programming language is the languages level of abstraction . Low-level programming languages support a direct mapping of instructions to machine code (the native language to the CPU). This results in a speedy run-time performance but generally requires a higher implementation effort. Examples for languages with a low level of abstraction are C and Assembler, they belong to the oldest programming languages.
The widespread use of computer programs in almost every aspect of human life has lead to an increasing complexity of software systems. In light of the rapid advances in processing power, this complexity can be handled by creating higher levels of abstractions in programming languages. High-level programming languages allow to formulate algorithms in a more natural way, reducing the time to solve a problem and making it easier to read, understand, debug, and maintain. Considering that the programming costs are often a major factor when creating a new software system, this allows for significant economic advantages. Examples for languages with a high level of abstraction are Python and Rubyalso called scripting languages or sometimes 4GLs (fourth-generation languages).
A high level of abstraction comes with a more complex translation of a programs source code into machine codeinstructions can no longer be directly mapped, but even simple statements can lead to tens, hundreds, or even thousands of generated machine code instructions. Writing compilers for such languages is a complex task. A way to simplify this is to use the interpreter concept, where a program no longer gets directly translated into machine code but into an intermediate representation, sometimes called bytecode, which then gets executed by a special programan interpreter or a virtual machine (VM).
Compared to a real CPU, a virtual machine, such as the JAVA virtual machine (JVM), provides an execution environment at a much higher levelon the expense of a slower run-time and increased memory requirements.
This situation gets tightened with the vast success of todays mobile platforms, such as smartphones, tablets, or smart home gadgets for the Internet of Things (IOT). In contrast to stationary systems, mobile systems come with severe resource constraints. Battery efficiency is very important. On the other hand though, any recent (networked) GUI application contains an intrinsic level of complexity that is best handled by employing a programming language with a sufficiently high abstraction level.