Assumptions when using interfaces
From: Mike (michaelloll_at_hotmail.com)
Date: 02/16/05
- Previous message: Ian Upright: "Re: OO programming - illumination?"
- Next in thread: EventHelix.com: "Re: Assumptions when using interfaces"
- Reply: EventHelix.com: "Re: Assumptions when using interfaces"
- Reply: Daniel T.: "Re: Assumptions when using interfaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 15 Feb 2005 19:31:00 -0800
Hello all:
I had a question about interfaces. I am writing a piece of software
that in theory will allow programmers to submit jobs to be run on a
network. Like a grid, but not that advanced. All jobs must follow a
set of interfaces - originally I had used abstract classes in a
hierarchy, but I wanted to use interfaces to not force my users to
inherit from base classes.
Anyhow, basically my question revolves around one to many
relationships. I have an interface IJob which has various properties,
one of which is a collection of ITask, another interface. An IJob
contains a collection of ITask via its getTasks method (there is no
setter needed, I beleive, since my execution engine only ever reads the
tasks, it never sets them; so the developer using my interfaces would
load his tasks however he saw fit).
Throughout the life of an object implementing ITask, the status of an
ITask will be udpated via its UpdateStatus method. So far, I have
something like (pseudo-language):
Interface IJob
collection GetTasks()
Interface ITask
void SetStatus(string)
string GetStatus()
Now, I beleive I can't make assumptions about how consumers of my
framework will stores there ITasks ... what I mean is, if I modify an
ITask obtained from a call to IJob::GetTasks, I can't assume that the
modification will be persisted between calls to GetTasks, right?
So if I did this:
job.GetTasks()[0].SetStatus("Processing")
I can't guarantee that this is true in a subsequent call:
job.GetTasks()[0].GetStatus() == "Processing"
Right?
I should store the tasks myself in an array or something while I am
using them.
Any help is appreciated. What can I assume? Any guidance is
appreciated. Are there any good texts on using interfaces like this.
Thanks.
-- Mike
- Previous message: Ian Upright: "Re: OO programming - illumination?"
- Next in thread: EventHelix.com: "Re: Assumptions when using interfaces"
- Reply: EventHelix.com: "Re: Assumptions when using interfaces"
- Reply: Daniel T.: "Re: Assumptions when using interfaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]