Where should a boolean flag be located in the GUI class or controll class

T

Tony Johansson

Hello!

I have a controll class called AnimalManager that have a collection of
animals that constitute of a inheritance tree where the most general base
class is the Animal that is abstract.
Now I serialize all these animals using binary serialization and I want to
use a boolean flag that I can check so I know if the collection of animals
has been saved to file(serialized).

I''m a bit unsure if this flag should be put in the GUI presentation
layer(PL) or the Business layer(BL) which is the AnimalManager ?

//Tony
 
A

Arne Vajhøj

I have a controll class called AnimalManager that have a collection of
animals that constitute of a inheritance tree where the most general base
class is the Animal that is abstract.
Now I serialize all these animals using binary serialization and I want to
use a boolean flag that I can check so I know if the collection of animals
has been saved to file(serialized).

I''m a bit unsure if this flag should be put in the GUI presentation
layer(PL) or the Business layer(BL) which is the AnimalManager ?

Definitely not in the PL.

If you persist everything together, then AnimalManager seems
to be the logical place.

If you persist Animal instances individually, then the flag should
be there.

Or in a class with this flag and the object it describes in case
that you want a very clean data model with no persistence related
stuff in.

BTW, I think the flag you want is the same as the commonly used
dirty flag, that indicates whether the object has been modified
and needs to be written back.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top