Re: Application logic and Business logic
From: Dmitry A. Kazakov (mailbox_at_dmitry-kazakov.de)
Date: 03/09/05
- Previous message: paul campbell: "Re: Application logic and Business logic"
- In reply to: frebe: "Re: Application logic and Business logic"
- Next in thread: frebe: "Re: Application logic and Business logic"
- Reply: frebe: "Re: Application logic and Business logic"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 9 Mar 2005 21:06:10 +0100
On 9 Mar 2005 10:58:15 -0800, frebe wrote:
> Dmitry A. Kazakov wrote:
>> Staff may return a set of employees
>> and the set may have indexing operation "()". So
>> Staff (1234)
>> could be C++ish:
>> Staff () (1234)
>
> So, you are working with arrays in this case.
It is not array, it is an ADT with has array interface. Internally it could
be anything.
> What if you want to find
> employees living in a given city, using your ADT theory?
>
> (
> My "relational" solution would be:
> q = staffTab.createQuery();
> q.setFilter(new Equals(staffTab.city(), "LA"));
> )
There are many ways of shaping it:
1. Staff ("LA");
-- Staff has two overloaded array interfaces
2. Staff (Place ("LA"));
-- Staff is indexed by a filter object. The filter is an ADT with
-- the functions "and", "or", "not". ID is a constructor of Filter'Class
-- Place is another constructor.
3. Staff.Place ("LA");
-- The member function Place returns a subset of employees living in LA.
4. Place (Staff, "LA");
-- Same as above
5. Staff and Place ("LA");
-- Intersection of two sets of employees
6. Place ("LA").Staff;
-- The member function staff returns a subset of employees of the
-- city ADT constructed by Place ("LA")
7. Select (Staff, Place ("LA"));
-- Same as 5, but using a functional sugar rather than oeprator one
...
The point is that with little exceptions, how does it look tells little
about how does it work.
Of course if some caching schemata is needed and the same process may
concurrently work with several caches, then it would be a good idea to
expose the context of the cache. That could be the scope of the call:
do -- This scope is one of the transaction context
Staff and Place ("LA");
...
exception
when others =>
-- on rollback do something useful
end;
if the language supports things like above. And only if it that is
impossible a transaction/query object can explicitly appear in the calls:
declare
Context : Transaction;
begin
Select (Context, Staff, Place ("LA"));
-- or
Context.Select (Staff, Place ("LA"));
exception
when others =>
-- on rollback do something useful
end;
which is definitely uglier.
-- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
- Previous message: paul campbell: "Re: Application logic and Business logic"
- In reply to: frebe: "Re: Application logic and Business logic"
- Next in thread: frebe: "Re: Application logic and Business logic"
- Reply: frebe: "Re: Application logic and Business logic"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|