Ticket #340 (closed Task: fixed)

Opened 8 years ago

Last modified 8 years ago

Refactor object fetch/store code

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.1
Component: DeepaMehta Standard Distribution Version: 4.0.12
Keywords: Cc: dgf, Malte
Complexity: 13 Area:
Module: deepamehta-core

Description (last modified by jri) (diff)

The (DB attached) object implementations (topics, associations, types) have too much responsibility.
The fetch/store code is encapsulated in the respective objects, that is objects fetch and store itself.
This has proven problematic:

  • Objects are constructed with incomplete models which causes difficult situations.
  • Extending the meta model and reusing fetch/store code becomes cumbersome.

New concept:
Strip the fetch/store code from the object implementations and collect it in its own class. This class is responsible for fetching and storing sole models (topic models, association models, type models) and creating (DB attached) objects from them. So, it's a factory.

Note: this ticket was "Meta model: Child Topic Order", see #346.
It turned out that ticket's task demands for the refactoring addressed here.

Change History

comment:1 Changed 8 years ago by jri

  • Status changed from new to accepted

comment:2 Changed 8 years ago by Jörg Richter

Core: extend meta model by "Ordered" flag (#340).

Both, "Composition Definition" and "Aggregation Definition" have a new boolean child type: "Ordered" (dm4.core.ordered).

COMPATIBILITY NOTE:
For a production instance a migration must be supplied that adds the "Ordered" type.

See ticket 340.

comment:3 Changed 8 years ago by Jörg Richter

Core: refactor type construction pt.1 (#340).

Former approach:
Types are constructed with a model that is initialized only partial and then load and init the remaining parts themselfs.

New concept:
Construction of types is the responsibility of the object factory.
Loading the model and constructing the actual type object from it are strictly separated.
Never construct a type with a partly initialized model.

Does not yet work.
Do not install the "child-order" branch.

Done

  • data type
  • index modes

Pending

  • association definitions
  • label configuration
  • view configuration

In preparation of "Child Topic Order".

See ticket 340.

comment:4 Changed 8 years ago by Jörg Richter

Core: refactor type construction pt.2 (#340).

Done

  • association definitions

Pending

  • label configuration
  • view configuration

Does not yet work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:5 Changed 8 years ago by Jörg Richter

Core: refactor type construction pt.3 (#340).

Done

  • label configuration
  • view configuration

So, a type doesn't *load* itself anymore.
Still does not work.
It occurred a type must not *save* itself either.

Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:6 Changed 8 years ago by Jörg Richter

Core: refactor type storage pt.1 (#340).

Done:

  • base topic parts

Pending:

  • data type
  • index modes
  • association definitions
  • label configuration
  • view configuration

Does not yet work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:7 Changed 8 years ago by Jörg Richter

Core: refactor type storage pt.2 (#340).

Done:

  • data type
  • index modes
  • association definitions

Pending:

  • label configuration
  • view configuration

Does not yet work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:8 Changed 8 years ago by Jörg Richter

Core: refactor type storage pt.3 (#340).

Done:

  • label configuration
  • view configuration

Does not yet work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:9 Changed 8 years ago by jri

  • Complexity changed from 8 to 13
  • Area Data Model deleted
  • Type changed from Enhancement to Task
  • Description modified (diff)
  • Summary changed from Meta model: Child Topic Order to Refactor object fetch/store code

comment:10 Changed 8 years ago by Jörg Richter

Core: refactor type storage pt.4 (#340).

Introducing a 2-level caching architecture solves a problem with cyclic type definitions.
Note: we deliberatley support cyclic type definitions.
Consider the association type "Composition Definition": it is a composite type which itself is build of Composition Definitions (here: "Include in Label" and "Ordered" boolean childs).

Does not yet fully work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order" (#346).

See ticket 340.

comment:11 Changed 8 years ago by Jörg Richter

Core: refactor type storage complete (#340).

There are still glitches.
Do not install the "child-order" branch.

See ticket 340.

comment:12 Changed 8 years ago by Jörg Richter

Core: fix topic type default URI (#340).

There are still glitches.
Do not install the "child-order" branch.

See ticket 340.

comment:13 Changed 8 years ago by Jörg Richter

comment:14 Changed 8 years ago by Jörg Richter

Core: fix assoc def sequence update (#340).

Type API:

TypeModel? API:

  • getAssocDefs() returns Collection<AssociationDefinitionModel?> (instead of a Map)
  • removeAllAssocDefs() is new method
  • setAssocDefs() is removed

Dropped copy constructors:

See ticket 340.

comment:15 Changed 8 years ago by Jörg Richter

Core: extend meta model by "Ordered" flag (#340).

Both, "Composition Definition" and "Aggregation Definition" have a new boolean child type: "Ordered" (dm4.core.ordered).

COMPATIBILITY NOTE:
For a production instance a migration must be supplied that adds the "Ordered" type.

See ticket 340.

comment:16 Changed 8 years ago by Jörg Richter

Core: refactor type construction pt.1 (#340).

Former approach:
Types are constructed with a model that is initialized only partial and then load and init the remaining parts themselfs.

New concept:
Construction of types is the responsibility of the object factory.
Loading the model and constructing the actual type object from it are strictly separated.
Never construct a type with a partly initialized model.

Does not yet work.
Do not install the "child-order" branch.

Done

  • data type
  • index modes

Pending

  • association definitions
  • label configuration
  • view configuration

In preparation of "Child Topic Order".

See ticket 340.

comment:17 Changed 8 years ago by Jörg Richter

Core: refactor type construction pt.2 (#340).

Done

  • association definitions

Pending

  • label configuration
  • view configuration

Does not yet work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:18 Changed 8 years ago by Jörg Richter

Core: refactor type construction pt.3 (#340).

Done

  • label configuration
  • view configuration

So, a type doesn't *load* itself anymore.
Still does not work.
It occurred a type must not *save* itself either.

Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:19 Changed 8 years ago by Jörg Richter

Core: refactor type storage pt.1 (#340).

Done:

  • base topic parts

Pending:

  • data type
  • index modes
  • association definitions
  • label configuration
  • view configuration

Does not yet work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:20 Changed 8 years ago by Jörg Richter

Core: refactor type storage pt.2 (#340).

Done:

  • data type
  • index modes
  • association definitions

Pending:

  • label configuration
  • view configuration

Does not yet work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:21 Changed 8 years ago by Jörg Richter

Core: refactor type storage pt.3 (#340).

Done:

  • label configuration
  • view configuration

Does not yet work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order".

See ticket 340.

comment:22 Changed 8 years ago by Jörg Richter

Core: refactor type storage pt.4 (#340).

Introducing a 2-level caching architecture solves a problem with cyclic type definitions.
Note: we deliberatley support cyclic type definitions.
Consider the association type "Composition Definition": it is a composite type which itself is build of Composition Definitions (here: "Include in Label" and "Ordered" boolean childs).

Does not yet fully work.
Do not install the "child-order" branch.

In preparation of "Child Topic Order" (#346).

See ticket 340.

comment:23 Changed 8 years ago by Jörg Richter

Core: refactor type storage complete (#340).

There are still glitches.
Do not install the "child-order" branch.

See ticket 340.

comment:24 Changed 8 years ago by Jörg Richter

Core: fix topic type default URI (#340).

There are still glitches.
Do not install the "child-order" branch.

See ticket 340.

comment:25 Changed 8 years ago by Jörg Richter

comment:26 Changed 8 years ago by Jörg Richter

Core: fix assoc def sequence update (#340).

Type API:

TypeModel? API:

  • getAssocDefs() returns Collection<AssociationDefinitionModel?> (instead of a Map)
  • removeAllAssocDefs() is new method
  • setAssocDefs() is removed

Dropped copy constructors:

See ticket 340.

comment:28 Changed 8 years ago by Jörg Richter

Core: refactor topic/assoc storage code (#340).

Topics and asssociation doesn't store itself.
Instead the Object Factory gets a model and stores it, and then creates the object from it.
Objects are never constructed from partly uninitialized models (in particular the ID).

See ticket 340.

comment:29 Changed 8 years ago by jri

  • Status changed from accepted to closed
  • Resolution set to fixed
  • Description modified (diff)

Regarded as complete for the moment.
Despite the factory concept is not yet fully realized the initial problem is solved now: an object is never created with a partly uninitialized model.

Last edited 8 years ago by jri (previous) (diff)
Note: See TracTickets for help on using tickets.