Topic: Generic Library evalutaion
Author: "Vladimir Frolov" <voidbent@gmail.com>
Date: 12 May 2006 17:30:07 GMT Raw View
Hello,
I would like to propose the following classification to evaluate
quality of standard for some (generic in our case) library.
Standard for generic library can provide three kinds of decisions:
1. Standard describes some aspect of library and provide a mechanism to
control this aspect. For example, in C++ Standard Template Library one
knows about allocators and can define a way how all containers will
allocate memory. This kind of decision is flexible because it allows
using library in different situations when one can't change an
environment. Standard of generic library can use Policy Pattern
("allocators" is a kind of policy pattern as a fact), described by
Andrei Alexandrescu in Modern C++ Design book to provide first type
decisions.
2. Standard describes some aspect of library but doesn't provide a way
to control this aspect. For example, one knows that all iterators of a
vector become invalid and can't be used after this vector is changed,
and one can't force invalid iterator to throw an exception when this
iterator was used by mistake. This type of decision is non-flexible
because one is forced to use quick but unsafe iterators instead of
controlling iterators safety.
3. Standard describes some aspect of a library as undefined. For
example, STL Standard says that std::basic_string is able to have a
reference counted implementation. This fact impedes of using
std::string on concurrent environment. One is able to use std::string
on such environment only if concrete STL implementation guarantees that
std::string is not reference counted. This king of decision is rigid
because one can neither change the environment where library used nor
control the aspect of library.
Let's say that library is super-flexible if standard of this library
provides only first kind decisions. Library is still flexible if there
are first and second kind decisions in standard. Otherwise library is
non-flexible.
So that one can say that STL is non-flexible but Loki library by Andrei
Alexandrescu is oriented to be super-flexible.
Let's say that library is super-scalable if one can add first kind
decisions to standard and it will cause linear increasing of structural
complexity. If complexity of library will grow non-linearly but not
quadratic one can say that library is scalable. If complexity of
library standard after adding first kind decisions grows exponential
the standard is non-scalable.
So, according to this classification, STL library is both non-flexible
and non-scalable and Loki library is super-flexible but non-scalable.
And I insist on the fact that General Policy Pattern (which I describe
in a post with the same subject) is a way to build super-flexible and
at the same time super-scalable generic libraries or library standards.
(General Policy Pattern is a kind of Policy when all possible actual
policies are passed to entity through one template parameter, and this
parameter is called General Policy).
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]