Concepts, Techniques, and Models of Computer Programming by Peter Van-Roy & Seif Haridi
Author:Peter Van-Roy & Seif Haridi [Van-Roy, Peter & Haridi, Seif]
Language: eng
Format: epub
Tags: Computers, Programming, General
ISBN: 9780262220699
Google: _bmyEnUnfTsC
Amazon: 0262220695
Publisher: MIT Press
Published: 2004-02-20T00:00:00+00:00
6.3 The declarative model with explicit state
421
We give a concrete example from our experience to show the usefulness of
components. Component-based programming was an essential part of the In-
formation Cities project, which did extensive multi-agent simulations using the
Mozart system [155, 162]. The simulations were intended to model evolution and
information flow in parts of the Internet. Different simulation engines (in a single
process or distributed, with different forms of synchronization) were defined as
reusable components with identical interfaces. Different agent behaviors were de-
fined in the same way. This allowed rapidly setting up many different simulations
and extending the simulator without having to recompile the system. The setup
was done by a program, using the module manager provided by the System mod-
ule Module. This is possible because components are values in the Oz language
(see Section 3.9.3).
6.2.3
Object-oriented programming
A popular set of techniques for stateful programming is called object-oriented
programming. We devote the whole of Chapter 7 to these techniques. Object-
oriented programming adds a fourth property to component-based programming:
• Inheritance. It is possible to build the system in incremental fashion, as
a small extension or modification of another system.
Incrementally-built components are called classes and their instances are called
objects. Inheritance is a way of structuring programs so that a new implementa-
tion extends an existing one.
The advantage of inheritance is that it factors the implementation to avoid
redundancy. But inheritance is not an unmixed blessing. It implies that a com-
ponent strongly depends on the components it inherits from. This dependency
can be difficult to manage. Much of the literature on object-oriented design, e.g.,
on design patterns [58], focuses on the correct use of inheritance. Although com-
ponent composition is less flexible than inheritance, it is much simpler to use.
We recommend to use it whenever possible and to use inheritance only when
composition is insufficient (see Chapter 7).
6.3
The declarative model with explicit state
One way to introduce state is to have concurrent components that run indefinitely
and that can communicate with other components, like the stream objects of
Chapter 4 or the port objects of Chapter 5. In the present chapter we directly
add explicit state to the declarative model. Unlike in the two previous chapters,
the resulting model is still sequential. We will call it the stateful model.
Explicit state is a pair of two language entities. The first entity is the state’s
identity and the second is the state’s current content. There exists an operation
that when given the state’s identity returns the current content. This operation
Copyright c
2001-3 by P. Van Roy and S. Haridi. All rights reserved.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12563)
Hello! Python by Anthony Briggs(9911)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9794)
The Mikado Method by Ola Ellnestam Daniel Brolund(9775)
Dependency Injection in .NET by Mark Seemann(9335)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8292)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Grails in Action by Glen Smith Peter Ledbrook(7693)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7017)
Microservices with Go by Alexander Shuiskov(6784)
Practical Design Patterns for Java Developers by Miroslav Wengner(6698)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6637)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Angular Projects - Third Edition by Aristeidis Bampakos(6047)
The Art of Crafting User Stories by The Art of Crafting User Stories(5575)
NetSuite for Consultants - Second Edition by Peter Ries(5510)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5310)
Kotlin in Action by Dmitry Jemerov(5061)
