Dynamics AX Polymorphism

Dynamics AX polymorphism is orders of magnitude more interesting than what is offered in typical OOP languages like C#.  The analogy that comes to mind is comparing polymorphism to how tuples find values amongst an OLAP cube’s dimensions.  In this case the cube’s values are the type’s properties and methods, known as members.

In typical OOP languages you just have the subtype (S) dimension impacting the type’s members (M):

M:(S) –> M

AX adds layer (L), user authorization (U), and license key (K) dimensions:

M: (S,L,U,K) –> M

There are probably additional dimensions, but the important point is that the type’s properties and methods can appear / behave vastly different depending on S, L, U, and K.

Typical OOP subtyping just adds members to a subtype; members of a base type are not removed.  Well in AX the L, U, and K dimensions can remove members from a subtype even though they appear in the base type.

Dynamics AX 2012 also adds models and events.  Models group functionality while events extend functionality.  I haven’t fully wrapped my mind around the whole topic but the basic idea is that events allow developers of different models to contribute to the behavior of a member.  Developers working in different layers / models define the events.  AX determines the collection of events to execute and then does so.

Continuing the tuple analogy, perhaps models and events form additional dimensions so that the tuple of (S,L,U,K) is a projection which results in a collection of code to execute.  I wonder how the order of execution and other commutative issues are dealt with.

Regarding persistence, AX supports both SQL Server and Oracle as the persistence store of type instances.  The properties of a type instance are stored in table columns while the existence of an instance is the existence of a table row.  What is interesting is that (S,L,U,K) impact the projection of the columns retrieved.  Row and column level security seems like a substantial leap from table security but imagine adding subtype, layer, and license key to the mix.

Dynamics AX is certainly not the OOP your father grew up with!