Learn how to implement the reactive programming paradigm with C++ and build asynchronous and concurrent applications Key Features Efficiently exploit concurrency and parallelism in your programs Use the Functional Rea...
详细信息
ISBN:
(数字)9781788624244
ISBN:
(纸本)9781788629775
Learn how to implement the reactive programming paradigm with C++ and build asynchronous and concurrent applications Key Features Efficiently exploit concurrency and parallelism in your programs Use the Functional reactive programming model to structure programs Understand reactive GUI programming to make your own applications using Qt Book Description reactive programming is an effective way to build highly responsive applications with an easy-to-maintain code base. This book covers the essential functional reactive concepts that will help you build highly concurrent, event-driven, and asynchronous applications in a simpler and less error-prone way. C++ reactive programming begins with a discussion on how event processing was undertaken by different programming systems earlier. After a brisk introduction to modern C++ (C++17), you'll be taken through language-level concurrency and the lock-free programming model to set the stage for our foray into the Functional programming model. Following this, you'll be introduced to RxCpp and its programming model. You'll be able to gain deep insights into the RxCpp library, which facilitates reactive programming. You'll learn how to deal with reactive programming using Qt/C++ (for the desktop) and C++ microservices for the Web. By the end of the book, you will be well versed with advanced reactive programming concepts in modern C++ (C++17). What you will learn Understand language-level concurrency in C++ Explore advanced C++ programming for the FRP Uncover the RxCpp library and its programming model Mix the FP and OOP constructs in C++ 17 to write well-structured programs Master reactive microservices in C++ Create custom operators for RxCpp Learn advanced stream processing and error handling Who this book is for If you're a C++ developer interested in using reactive programming to build asynchronous and concurrent applications, you'll find this book extremely useful. This book doesn't assume any previous knowledge of reactive
A limited form of dependent types, called Generalized Algebraic Data Types (GADTs), has recently been added to the list of Haskell extensions supported by the Glasgow Haskell Compiler. Despite not being full-fledged d...
详细信息
A limited form of dependent types, called Generalized Algebraic Data Types (GADTs), has recently been added to the list of Haskell extensions supported by the Glasgow Haskell Compiler. Despite not being full-fledged dependent types, GADTs still offer considerably enlarged scope for enforcing important code and data invariants statically. Moreover, GADTs offer the tantalizing possibility of writing more efficient programs since capturing invariants statically through the type system sometimes obviates entire layers of dynamic tests and associated data markup. This paper is a case study on the applications of GADTs in the context of Yampa, a domain-specific language for Functional reactive programming in the form of a self-optimizing, arrow-based Haskell combinator library. The paper has two aims. Firstly, to explore what kind of optimizations GADTs make possible in this context. Much of that should also be relevant for other domain-specific embedded language implementations, in particular arrow-based ones. Secondly, as the actual performance impact of the GADT-based optimizations is not obvious, to quantify this impact, both on tailored micro benchmarks, to establish the effectiveness of individual optimizations, and on two fairly large, realistic applications, to gauge the overall impact. The performance gains for the micro benchmarks are substantial. This implies that the Yampa API could be simplified as a number of "pre-composed" primitives that were there mainly for performance reasons are no longer needed. As to the applications, a worthwhile performance gain was obtained in one case whereas the performance was more or less unchanged in the other.
In this paper, we present a solution to this year's DEBS Grand Challenge based on concepts from reactive systems. reactive systems is a system architecture style with the following properties: Responsive, resilien...
详细信息
ISBN:
(纸本)9781450332866
In this paper, we present a solution to this year's DEBS Grand Challenge based on concepts from reactive systems. reactive systems is a system architecture style with the following properties: Responsive, resilient, elastic, and message driven. When systems are built based on these properties, they tend to be more flexible, loosely-coupled, and scaleable. In this paper, we describe how to combine the operators given in the reactiveX API to realize the individual challenge queries using asynchronous data-flows and evaluate the performance.
reactive programming languages and libraries, such as reactiveX, have been shown to significantly improve software design and have seen important industrial adoption over the last years. Asynchronous applications - wh...
详细信息
ISBN:
(纸本)9781728125084
reactive programming languages and libraries, such as reactiveX, have been shown to significantly improve software design and have seen important industrial adoption over the last years. Asynchronous applications - which are notoriously error-prone to implement and to maintain - greatly benefit from reactive programming because they can be defined in a declarative style, which improves code clarity and *** this paper, we tackle the problem of refactoring existing software that has been designed with traditional abstractions for asynchronous programming. We propose 2Rx, a refactoring approach to automatically convert asynchronous code to reactive programming. Our evaluation on top-starred GitHub projects shows that 2Rx is effective with common asynchronous constructs and it can provide a refactoring for 91.7% of their occurrences.
Dataflow languages provide natural support for specifying constraints between objects in dynamic applications, where programs need to react efficiently to changes in their environment. In this article, we show that on...
详细信息
Dataflow languages provide natural support for specifying constraints between objects in dynamic applications, where programs need to react efficiently to changes in their environment. In this article, we show that one-way dataflow constraints, largely explored in the context of interactive applications, can be seamlessly integrated in any imperative language and can be used as a general paradigm for writing performance-critical reactive applications that require efficient incremental computations. In our framework, programmers can define ordinary statements of the imperative host language that enforce constraints between objects stored in special memory locations designated as "reactive." reactive objects can be of any legal type in the host language, including primitive data types, pointers, arrays, and structures. Statements defining constraints are automatically re-executed every time their input memory locations change, letting a program behave like a spreadsheet where the values of some variables depend on the values of other variables. The constraintsolving mechanism is handled transparently by altering the semantics of elementary operations of the host language for reading and modifying objects. We provide a formal semantics and describe a concrete embodiment of our technique into C/C++, showing how to implement it efficiently in conventional platforms using off-the-shelf compilers. We discuss common coding idioms and relevant applications to reactive scenarios, including incremental computation, observer design pattern, data structure repair, and software visualization. The performance of our implementation is compared to problem-specific change propagation algorithms, as well as to language-centric approaches such as self-adjusting computation and subject/observer communication mechanisms, showing that the proposed approach is efficient in practice.
Graphical user interfaces (GUIs) mediate many of our interactions with computers. Functional reactive programming (FRP) is a promising approach to GUI design, providing high-level, declarative, compositional abstracti...
详细信息
ISBN:
(纸本)9781450320146
Graphical user interfaces (GUIs) mediate many of our interactions with computers. Functional reactive programming (FRP) is a promising approach to GUI design, providing high-level, declarative, compositional abstractions to describe user interactions and time-dependent computations. We present Elm, a practical FRP language focused on easy creation of responsive GUIs. Elm has two major features: simple declarative support for Asynchronous FRP; and purely functional graphical layout. Asynchronous FRP allows the programmer to specify when the global ordering of event processing can be violated, and thus enables efficient concurrent execution of FRP programs; long-running computation can be executed asynchronously and not adversely affect the responsiveness of the user interface. Layout in Elm is achieved using a purely functional declarative framework that makes it simple to create and combine text, images, and video into rich multimedia displays. Together, Elm's two major features simplify the complicated task of creating responsive and usable GUIs.
Software-Defined Networking (SDN) enables more dynamic and fine-grained network control. In particular, network operators can route traffic not only based on packet header fields, but also higher-level parameters such...
详细信息
Software-Defined Networking (SDN) enables more dynamic and fine-grained network control. In particular, network operators can route traffic not only based on packet header fields, but also higher-level parameters such as user settings, traffic characteristics, and application-layer information extracted by virtualized network functions such as DPI, firewall and authentication servers. Integrating these higher-level parameters into an SDN programming framework brings substantial benefits but is still missing in the SDN community. In this paper, we articulate the challenges and then propose Trident, a novel unified SDN programming framework. Trident extends algorithmic SDN programming with a new abstraction called stream attribute, which integrates meta parameters into the match-action programming paradigm. Further, Trident adopts the idea of reactive value from function reactive programming, eliminating the complexity of manually handling dynamicity. To effectively and efficiently realize these novel ideas, Trident introduces reactive table as the basic processing unit and develops a domain-specific distributed update protocol to maintain consistency during updates. Evaluations show that Trident puts very little overhead on integrating existing network management tools and network functions, and can handle up to O(10(5)) routing requests per second with O(100) milliseconds latency.
Chatbots are reactive applications with a conversational interface. They are usually implemented as compositions of client-side components and cloud-hosted services, including artificial-intelligence technology. Unfor...
详细信息
ISBN:
(纸本)9781450360708
Chatbots are reactive applications with a conversational interface. They are usually implemented as compositions of client-side components and cloud-hosted services, including artificial-intelligence technology. Unfortunately, programming such reactive multi-tier applications with traditional programming languages is cumbersome. This paper introduces wcs-ocam1, a new multi-tier chatbot generator library designed for use with the reactive language reactiveML. The paper explains our library with small didactic examples throughout, and closes with a larger case-study of a chatbot for authoring event-processing rules.
Dataflow languages provide natural support for specifying constraints between objects in dynamic applications, where programs need to react efficiently to changes of their environment. Researchers have long investigat...
详细信息
ISBN:
(纸本)9781450309400
Dataflow languages provide natural support for specifying constraints between objects in dynamic applications, where programs need to react efficiently to changes of their environment. Researchers have long investigated how to take advantage of dataflow constraints by embedding them into procedural languages. Previous mixed imperative/dataflow systems, however, require syntactic extensions or libraries of ad hoc data types for binding the imperative program to the dataflow solver. In this paper we propose a novel approach that smoothly combines the two paradigms without placing undue burden on the programmer. In our framework, programmers can define ordinary statements of the imperative host language that enforce constraints between objects stored in special memory locations designated as "reactive". Differently from previous approaches, reactive objects can be of any legal type in the host language, including primitive data types, pointers, arrays, and structures. Statements defining constraints are automatically re-executed every time their input memory locations change, letting a program behave like a spreadsheet where the values of some variables depend upon the values of other variables. The constraint solving mechanism is handled transparently by altering the semantics of elementary operations of the host language for reading and modifying objects. We provide a formal semantics and describe a concrete embodiment of our technique into C/C++, showing how to implement it efficiently in conventional platforms using off-the-shelf compilers. We discuss common coding idioms and relevant applications to reactive scenarios, including incremental computation, observer design pattern, and data structure repair. The performance of our implementation is compared to ad hoc problem-specific change propagation algorithms, as well as to language-centric approaches such as self-adjusting computation and subject/observer communication mechanisms, showing that the proposed approa
Synchronous modeling is at the heart of programming languages like Lustre, Esterel, or SCADE used routinely for implementing safety critical control software, e.g., fly-by-wire and engine control in planes. However, t...
详细信息
ISBN:
(纸本)9781450376136
Synchronous modeling is at the heart of programming languages like Lustre, Esterel, or SCADE used routinely for implementing safety critical control software, e.g., fly-by-wire and engine control in planes. However, to date these languages have had limited modern support for modeling uncertainty - probabilistic aspects of the software's environment or behavior - even though modeling uncertainty is a primary activity when designing a control system. In this paper we present ProbZelus the first synchronous probabilistic programming language. ProbZelus conservatively provides the facilities of a synchronous language to write control software, with probabilistic constructs to model uncertainties and perform inference-in-the-loop. We present the design and implementation of the language. We propose a measure-theoretic semantics of probabilistic stream functions and a simple type discipline to separate deterministic and probabilistic expressions. We demonstrate a semantics-preserving compilation into a first-order functional language that lends itself to a simple presentation of inference algorithms for streaming models. We also redesign the delayed sampling inference algorithm to provide efficient streaming inference. Together with an evaluation on several reactive applications, our results demonstrate that ProbZelus enables the design of reactive probabilistic applications and efficient, bounded memory inference.
暂无评论