accessors/mutators

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

accessors/mutators

Janko Mivšek
Hi all,

To properly make Swazoo ready for persistance in Gemstone, Versant,
probably Objectivity, OmniBase (Steve?)  and GLORP (Alan?) we need to
introduce accessors/mutators to all instvars.

Persistance managers/ODBMS-ses need to know somehow, that an object is
changed. Some of them do that automatically, some need you to announce
change manually. Experience shows that manual "announcement" is best way
to do.

You announce object change by sending a method like #markDirty in GS to
an object you changed. Object is then added into a pool of so called
dirty objects, which need to be written to persistent store during commit.

The best place to call #markDirty calls is in mutator methods in order
to be sure, that you really mark your object dirty after change. If your
methods deal with instvars directly you need to be much more carefull
that you don't forget marking an object dirty. By doing that only in
mutators you can be much more sure, that you didn't miss that. Of course
you need to strictly change instvars through mutators and never directly.

So I propose that we refactor Swazoo to introduce accessors/mutators and
using only them to instvar access.

I will do and publish that tommorow for review.

Janko




Reply | Threaded
Open this post in threaded view
|

0.9.58 with accessors/mutators to preview

Janko Mivšek
Hi all,

Just published to preview a new version 0.9.58 with all instvar access
through accessors/mutators. Collections are only accessed and
initialized. Booleans are accessed, set and reset. Timestamps are
accessed and set to Timestamp now.

All original tests passed (except etagTest, which didn't work on my
Linux before too).

Any comments are welcome.

I'll try to make Swazoo-Gemstone package with extrensions for Gemstone
during weekend.

Janko

Janko Mivsek wrote:

> Hi all,
>
> To properly make Swazoo ready for persistance in Gemstone, Versant,
> probably Objectivity, OmniBase (Steve?)  and GLORP (Alan?) we need to
> introduce accessors/mutators to all instvars.
>
> Persistance managers/ODBMS-ses need to know somehow, that an object is
> changed. Some of them do that automatically, some need you to announce
> change manually. Experience shows that manual "announcement" is best
> way to do.
>
> You announce object change by sending a method like #markDirty in GS
> to an object you changed. Object is then added into a pool of so
> called dirty objects, which need to be written to persistent store
> during commit.
>
> The best place to call #markDirty calls is in mutator methods in order
> to be sure, that you really mark your object dirty after change. If
> your methods deal with instvars directly you need to be much more
> carefull that you don't forget marking an object dirty. By doing that
> only in mutators you can be much more sure, that you didn't miss that.
> Of course you need to strictly change instvars through mutators and
> never directly.
>
> So I propose that we refactor Swazoo to introduce accessors/mutators
> and using only them to instvar access.
>
> I will do and publish that tommorow for review.
>
> Janko
>
>
>
> _______________________________________________
> Swazoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swazoo-devel
>