Saturday, 3 August 2019

Objects Graph, Complete Model of a Program.

Object Graphs.

Directed Objects Graph / pl: 'Skierowany Graf Obiektów' / can be a complete model of a program, that can be executed. Or it can be a data model as well.

Values of Objects' references/pointers/handles/etc ... are also a part of state, as any variable's value is, as well.

In a Directed Graph / pl: 'Graf Skierowany' / we have 'dots & arrows', 'nodes & arrows'.

In a directed object graph, objects are 'dots/nodes', references/etc are 'arrows'.

Graphs can be either 'directed' or 'undirected', but in this article we don't need to use 'undirected graphs'.


Resources.

Classes are 'objects blueprints', a part of application's static resources.

After Classes are written & ready, objects can be created.

Other resources as graphic image files, dvd iso files, localization text files, etc ... are also a part of application's static configuration, can be used in objects graph as a part/whole of objects graph's initial state.


Graphs, Construction & Program's Execution.

I call objects graph's construction, including initial state's set-up: 'Configuration', 'Application Configuration', 'Object Graph Configuration'.

Different versions of application are just different objects graphs, with different initial state. Different versions sometimes do not need to be backward-compatible, sometimes are wholly different software - more than functionality reductions and new functionality additions. Code should be reusable, usable in many projects.

Objects graph configuration can be done manually - in one of 'entry points' to application, or tools as Java's
'Spring Framework' with it's 'xml configuration' can be used.

After objects graph is configured, we can 'launch' a proper entry point / for example: one of main(...) methods /, so application starts.


We can have many 'entry points', and many 'root objects' ... but eventually we might need to choose which 'entry point' to use at that moment, which 'application/version' to run this time.


Summarizing, object-oriented application's development & launch goes through following phases:
1. Write Classes,
2. Construct Objects Graph, setting-up initial state using 'hardcoded' data and 'static resources' as well.
3. Launch one of Entry Points, providing values to arguments if neccessary.
4. Application starts, can enter 'Dynamic Initialization Phase' - if needed,
5. Applicaion switches to 'Running Phase', starts doing it's job,
6. ...

No comments:

Post a Comment