comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: tasks as part of record
Date: Mon, 6 Oct 2014 10:00:14 +0200
Date: 2014-10-06T10:00:14+02:00	[thread overview]
Message-ID: <1ek4634mtnybu.2yqt65o532me$.dlg@40tude.net> (raw)
In-Reply-To: c9eu13Fqo1jU1@mid.individual.net

On Mon, 06 Oct 2014 10:18:07 +0300, Niklas Holsti wrote:

> On 14-10-06 06:47 , Stribor40 wrote:
>> I though it would be easier if task is componenet of record.
> 
> *What* would be easier?
> 
> Tasks are intended for a specific purpose, which is useful in *some*
> applications: to execute separate threads of control concurrently, and
> possibly in parallel if the computer has several processors.
> 
> As I said before, it is unusual for an application to require a separate
> task for each data object (= student record), and such designs are
> usually complex and inefficient.

Well, actually it is not so unusual. The software pattern is called "active
object".

You are right it is not easy. However, concerning easier or not, what is
the alternative? Two separate yet coupled objects (task and record)? That
is not necessarily easier. Actually there are three variants all already
mentioned in the thread:

1. Separate record and task one referencing another;
2. Task in a limited record with an access discriminant to;
3. Data hidden in the task, exposed via task's entry.

#1 is a mess;

#2 is active object and has issues with initialization/finalization and
most likely will break under inheritance;

#3 is heavy-weight and coarse because all interfacing go though entries,
entries may have no results, tasks are non-tagged.

But the question is *what*, as you said.

>> i would like to operate on components of student record. 
>> For example for each student there will be one tasks.
> 
> Why? Why do you need concurrent / parallel execution of student operations?

A simulation?
 
> I suspect strongly that using tasks at all in your application is
> unnecessary, and only complicates the design, which is why I would like
> to understand why your application needs concurrency.

Exactly. Before discussing a solution there must be the problem stated.
 
-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2014-10-06  8:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-04 13:11 tasks as part of record Stribor40
2014-10-04 13:33 ` Simon Wright
2014-10-04 22:12 ` Stribor40
2014-10-05  7:36   ` Jacob Sparre Andersen
2014-10-05  8:11 ` Niklas Holsti
2014-10-06  3:47   ` Stribor40
2014-10-06  5:43     ` Jeffrey Carter
2014-10-06  7:18     ` Niklas Holsti
2014-10-06  8:00       ` Dmitry A. Kazakov [this message]
2014-10-06 11:40         ` G.B.
2014-10-06  8:06       ` Simon Wright
2014-10-06  8:24     ` Simon Wright
2014-10-12 22:33       ` compguy45
2014-10-13  7:32         ` Simon Wright
2014-10-13 14:45           ` compguy45
2014-10-13 15:33             ` Shark8
2014-10-18 18:21           ` Stephen Leake
replies disabled

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