comp.lang.ada
 help / color / mirror / Atom feed
From: ms <m.siedlarek@nctz.net>
Subject: Interface to aggregated type
Date: Mon, 6 Aug 2012 11:42:03 -0700 (PDT)
Date: 2012-08-06T11:42:03-07:00	[thread overview]
Message-ID: <8e844311-f470-4382-8acc-ffe30aee1c18@googlegroups.com> (raw)

My question is half-ada/half-architectural, I'll explain it on simple HTTP server example.

Imagine HTTP library providing two packages - `Headers` which provides container for HTTP headers (`Header_Container` type) and `Requests` which is a abstraction over HTTP request message (`Request` type).

Clearly `Request` aggregates `Header_Container`, as HTTP requests generally contain some set of headers.

My dilemma is - `Headers` package already provides some sort of `Header_Container` manipulation interface - procedures for inserting and deleting headers and functions to return them, but I want allow these operations also on container aggregated inside `Request` type (which is probably a private record).

Now I have several options such as duplicating header manipulation interfaces entirely (eg. function Header_Value (R : Request, Name : String) in `Requests` package) or making aggregated `Header_Container` field public (can I make only some of the record's fields public and leave others private?). Both have pros and cons, and possibly even more solutions exist.

What would you do?



             reply	other threads:[~2012-08-06 18:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 18:42 ms [this message]
2012-08-06 19:43 ` Interface to aggregated type Dmitry A. Kazakov
2012-08-06 20:28   ` ms
2012-08-06 19:56 ` Marius Amado-Alves
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox