Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Web site for the containers library (http://www.velocityreviews.com/forums/t741771-web-site-for-the-containers-library.html)

jacob navia 01-09-2011 10:31 PM

Web site for the containers library
 
I have set up a google project for the containers library.

http://code.google.com/p/ccl/

This project tries to address the problem of the lack of an easy to use
library that would complement the standard library so that not every
c programmer has to reinvent hash tables, flexible arrays, red-black
trees, and similar data structures.

I will present this project to the french standardization group as
soon as it is possible.

Please read the documentation in downloads/ccl.pdf

The source can be browsed in source/svn/trunk

jacob

jacob navia 01-10-2011 12:01 AM

Re: Web site for the containers library
 
Le 10/01/11 00:39, Richard a écrit :
> jacob navia<jacob@spamsink.net> writes:
>
>> I have set up a google project for the containers library.
>>
>> http://code.google.com/p/ccl/
>>
>> This project tries to address the problem of the lack of an easy to use
>> library that would complement the standard library so that not every
>> c programmer has to reinvent hash tables, flexible arrays, red-black
>> trees, and similar data structures.
>>

>
> Whats wrong with the oodles of OSS solutions out there?


(1) This library introduces the concept of an interface, i.e. a table
of functions in a single object that opens a new name space to avoid
as much as possible name pollution.

The syntax looks like:

HashTable *ht = iHashTable.Create(512); // Creation

iHashTable.Add(ht,"A key", &data); //add an element

d = iHashTable.GetElement(ht, "A key"); // Retrieve data

iHashTable.Finalize(ht); // Destroy the table

The only name used here is "iHashTable". The interface is the
table of functions of the HashTable container.

(2) This library introduces the concept of a general container,
and a subclassing of it: sequential and associative containers.
All containers share the same vocabulary. It is easy then,
to change the data representation without doing enormous
changes to the code.

(3) It introduces the concept of general iterators that allow you to
use the same vocabulary for iterating through a container, be it
a list or a hash table.

But the main point is that it proposes a standard way of handling this
data structures. My goal is to achieve an extension of the standard
library so that software written in C can interoperate. The problem
with the absence of a standard way of doing a list or a hash table
is that
(1) Each developer has to develop again and again the same software
(2) The resulting mess of slightly different implementations forces
the developer to develop "adapters" that convert lists in XYZ format
to lists in ZYX format...

Note that the aim is here not to provide a library (even if a sample
implementation is provided) but a *standard* vocabulary.

For instance, using the same vocabulary an implementation can develop
a small bare bones version for small machines, and a full fledged
version for bigger machines.

Please take a look to the documentation (pdf) to see more in detail what
is this proposal about.


Ben Pfaff 01-10-2011 12:05 AM

Re: Web site for the containers library
 
jacob navia <jacob@spamsink.net> writes:

> All containers share the same vocabulary. It is easy then,
> to change the data representation without doing enormous
> changes to the code.


Developers promoting container libraries often mention this as a
feature. But why is it such a great feature? Who wants to
change data representations often?
--
Ben Pfaff
http://benpfaff.org

Ian Collins 01-10-2011 12:10 AM

Re: Web site for the containers library
 
On 01/10/11 01:05 PM, Ben Pfaff wrote:
> jacob navia<jacob@spamsink.net> writes:
>
>> All containers share the same vocabulary. It is easy then,
>> to change the data representation without doing enormous
>> changes to the code.

>
> Developers promoting container libraries often mention this as a
> feature. But why is it such a great feature? Who wants to
> change data representations often?


It's not that uncommon when you can!

In C++ sometimes find I want a sorted container when I initially did not.

Then there's generic algorithms..

--
Ian Collins

jacob navia 01-10-2011 12:12 AM

Re: Web site for the containers library
 
Le 10/01/11 01:05, Ben Pfaff a écrit :
> jacob navia<jacob@spamsink.net> writes:
>
>> All containers share the same vocabulary. It is easy then,
>> to change the data representation without doing enormous
>> changes to the code.

>
> Developers promoting container libraries often mention this as a
> feature. But why is it such a great feature? Who wants to
> change data representations often?


It is possible to change from a single linked list
to a double linked, for instance, if you see that you are
inserting very often items at the middle of a list.

Or to drop lists altogether and use an array if you see that you are
not inserting so much and a flexible array would be much faster.

Or you decide that the bottleneck of searching through the whole array
is too much and you need a hash table.

Applications discover that some of the assumptions done at
design time are no longer valid. Hence it is important
to be able to change that.

jacob



Tim Harig 01-10-2011 12:32 AM

Re: Web site for the containers library
 
["Followup-To:" header set to comp.lang.c.]
On 2011-01-09, Richard <rgrdev_@gmail.com> wrote:
> jacob navia <jacob@spamsink.net> writes:
>> I have set up a google project for the containers library.
>>
>> http://code.google.com/p/ccl/
>>
>> This project tries to address the problem of the lack of an easy to use
>> library that would complement the standard library so that not every
>> c programmer has to reinvent hash tables, flexible arrays, red-black
>> trees, and similar data structures.
>>

> Whats wrong with the oodles of OSS solutions out there?


Using OSS libraries has worked well; but, because there are so many
available with different interfaces, it also causes some common problems:

1. It create yet another dependency that people using your software have to
contend with and bloat because it means having to have several
different redundant libraries installed to meet the needs of
different pieces of software with each using their own preferred
library.

2. It creates a complexity issue for developers who may have to learn
several different redundant interfaces to work with different
projects to which they might contribute.

Charles 01-10-2011 06:10 AM

Re: Web site for the containers library
 
Ben Pfaff wrote:
> jacob navia <jacob@spamsink.net> writes:
>
>> All containers share the same vocabulary. It is easy then,
>> to change the data representation without doing enormous
>> changes to the code.

>
> Developers promoting container libraries often mention this as a
> feature.


It's a stepping stone. It's where all container library developers start
out. As experience increases with that design, its limitations and
"incorrectness" become clear.

> But why is it such a great feature?


It's not.

> Who wants to
> change data representations often?


Inexperienced and/or unknowledgeable developers or those who won't or
can't analyze and design before jumping in and coding. I see no reason to
build a library in a fashion to support that. Indeed, it is GOOD for
someone to have more tedium when a design change is necessary because of
inadequate capability or preparation, for learning by making mistakes is
a powerful teaching process.



Charles 01-10-2011 06:17 AM

Re: Web site for the containers library
 
jacob navia wrote:
> Le 10/01/11 01:05, Ben Pfaff a écrit :
>> jacob navia<jacob@spamsink.net> writes:
>>
>>> All containers share the same vocabulary. It is easy then,
>>> to change the data representation without doing enormous
>>> changes to the code.

>>
>> Developers promoting container libraries often mention this as a
>> feature. But why is it such a great feature? Who wants to
>> change data representations often?

>
> It is possible to change from a single linked list
> to a double linked, for instance, if you see that you are
> inserting very often items at the middle of a list.
>
> Or to drop lists altogether and use an array if you see that you are
> not inserting so much and a flexible array would be much faster.
>
> Or you decide that the bottleneck of searching through the whole array
> is too much and you need a hash table.
>


Those scenarios are all from lack of understanding of the requirements
(or lack of understanding of containers/algos and how/when to use them)
or lack of skills beyond coding (analysis and design).

> Applications discover


How many applications have you seen discover anything? Do you work in the
AI field?

> that some of the assumptions done at
> design time are no longer valid. Hence it is important
> to be able to change that.
>


That's some "hearty" reasoning! Are you high? ;-)



Tim Harig 01-10-2011 06:52 AM

Re: Web site for the containers library
 
On 2011-01-10, Charles <cmake@nospam.net> wrote:
> Ben Pfaff wrote:
>> jacob navia <jacob@spamsink.net> writes:
>> Who wants to
>> change data representations often?

>
> Inexperienced and/or unknowledgeable developers or those who won't or
> can't analyze and design before jumping in and coding. I see no reason to
> build a library in a fashion to support that. Indeed, it is GOOD for
> someone to have more tedium when a design change is necessary because of
> inadequate capability or preparation, for learning by making mistakes is
> a powerful teaching process.


Fred Brookes told us to plan to throw away because you will anyway.
Perhaps you don't think he was intelligent enough to plan ahead?
Pitfalls of preoptimization are well known and the simple fact is that
requirements have a tendency to change. All the planning in the world
will not help you when somebody decides to use a display engine you
decided that you designed as a web browser as the basis for an IDE and
development platform. That your code was flexible enough to hit the
ground running when requirement changes take place or when being used
for things you never originally intended *is* a good measure of how well
you planned your project.

Ian Collins 01-10-2011 07:03 AM

Re: Web site for the containers library
 
On 01/10/11 07:17 PM, Charles wrote:
> jacob navia wrote:
>> Le 10/01/11 01:05, Ben Pfaff a écrit :
>>> jacob navia<jacob@spamsink.net> writes:
>>>
>>>> All containers share the same vocabulary. It is easy then,
>>>> to change the data representation without doing enormous
>>>> changes to the code.
>>>
>>> Developers promoting container libraries often mention this as a
>>> feature. But why is it such a great feature? Who wants to
>>> change data representations often?

>>
>> It is possible to change from a single linked list
>> to a double linked, for instance, if you see that you are
>> inserting very often items at the middle of a list.
>>
>> Or to drop lists altogether and use an array if you see that you are
>> not inserting so much and a flexible array would be much faster.
>>
>> Or you decide that the bottleneck of searching through the whole array
>> is too much and you need a hash table.
>>

>
> Those scenarios are all from lack of understanding of the requirements
> (or lack of understanding of containers/algos and how/when to use them)
> or lack of skills beyond coding (analysis and design).


Nonsense.

How many clients do you have who know exactly what they want at the
start of a project and never change the project scope?

--
Ian Collins


All times are GMT. The time now is 07:27 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.