Beruflich Dokumente
Kultur Dokumente
net/publication/235651500
CITATIONS READS
2 198
3 authors:
Ilija Antović
University of Belgrade
20 PUBLICATIONS 34 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Dusan Savic on 30 May 2014.
Fig. 5: The basic pattern structure of the problem (BPSP) Theorem of STIF: The transformation T is said to be
symmetry transformation S, if between si and sj exists an
We call this structure: "The basic pattern structure of the equivalence relation after the transformation.
problem (BPSP)". Based on the above analysis we have T
concluded that the structure of the problem - BPSP is si ---> sj si
transformed into the structure of solutions - BPSS Between states si and sj there is the relation of
(Figure 6). equivalence if there is the injective function f which
satisfies: f(si) = f(sj) => si = sj (if f(si) equal to f(sj), It
follows that si equal to sj)
Proof: If the function f, which we call " function of
origination ":
f (si) = a) f(sj) , if sj is image of si,
b) si between si and sj exist equivalence relation for the
State= { s1,s2,…,sn} – set of states injective "function of origination" f, for which applies: if
si, sj State, where is i,j 1..n (si,sj are elements of f(si) = f(sj), then si = sj
State) Symmetry transformation is essentially a function fst
if => sj is image of si , where is criteria that which maps si in sj: fst (si,sj)
determines when sj is image of si. The theorem of STIF will be presented by UML class
diagram (Figure 7). System has many states.
If the function f is applied to si and sj, we obtain : Transformation T is defined between two states si and sj.
f(si) = f(sj) => sk = sk After transformation between si and sj a relation exists. If
It follows: between si and sj there is an equivalence relation after
f(si) = f(sj) => si = sj transformation then a symmetry transformation is
which can be presented as follows: executed. The equivalence relation exists if it is defined
sk = sk by function of origination (f). The equivalence relation
f↑ T f ↑ is realized by Equality operation.
si ---> sj
Based on the above, we can conclude that there exists the
equivalence relation ≡ between si and sj: si ≡ sj, which is
realized by the equality operation = between si and sj: si
= sj if there is a injective function f for which applies: if
f(si) = f(sj), then si = sj, for all si and sj.
Thus the theorem is proven. The transformation T
between si and sj is symmetry transformation because
1 * 1 (si)
System * State T
1 (sj)
1 1
Between states si and sj exist the
equivalence relation, if exist the injective
function f, for which applies: f(si) = f(sj) =>
Symmetry transformation (S)
si = sj
Relation - fst
Equality operation
sj
Y1 Y2 Yn
...
si is original, while sj is an image. Proof: The above statement is true if it is proven that each
of these symmetry transformations is invertible and the
This means that the "function of origination" for class set of the symmetry transformation satisfies the following
diagram is defined as follows: 4 axioms [Coplien 2001] which defines the group:
1. Closure. For all a, b G, the set G is closed under
if si HAS sj or si IS sj => sj is image of si composition: ab, ba G.
2. Associativity. For all a, b, c G, the composition is
If function f apply to si and sj, we obtain: associative: (ab)c = a(bc).
3. Existence of an Identity Element. For all a G, there
f(si) = f(sj), sj = sj, exists an element e G such that ae = a = ea.
4. Existence of Inverses. For each a G, there exists an
It follows: a-1 G such that aa-1 = e = a-1a.
f(si) = f(sj) => si = sj If the function of origination f applied to each pair,
This means that IS and HAS relationships, between S1 S1
classes si and sj, realize equivalence relation between f(Y1) ---> f(Y) => Y ---> Y
these classes. It follows that there is a symmetry
transformation between si and sj. S2 S2
f(Y2) ---> f(Y) => Y ---> Y
class Y1
{ void m() {…}} Fig. 14: The symmetry transformation between X and Y’
class Y2
and symmetry group between Y and Y’
{ void m() {…}}
Based on the aforementioned, the symmetrisation process
class Main (Figure 15) can be represented as follows:
{
public static void main(String arg[])
{ X x = new X(); fnsg(X,Y) -> fst(X,Y’) + fsg(Y,Y’)
x.m(); Definition PT1: The Design pattern is the symmetrisation
} process (fsp) that no-symmetry group of originale (X) and
}
its image (Y) transforms to:
a) the symmetry transformation between the original (X)
After that, the symmetrisation process happens, which
and its abstract image (Y’) and b) the symmetry group of
transforms no-symmetry to symmetry group (how the
the concrete image (Y) and its abstract image (Y’) .
pattern is occuring). The No-Symmetry group:
In this sense, the symmetrisation process SP can be
fnsg(X,Y) represented as the following pattern:
is being transformed into (solution in pattern) (Figure 19): SP ( fnsg(X,Y) , fst(X,Y’) fsg(Y,Y’) )
1. the symmetry transformation between the original (X)
Here is another definition that easily explains what the
and its abstract image (Y’):
design patterns are:
fst(X,Y’)
Definition PT2 : A Design pattern is a process which
and
transforms the no-symmetry structure (problem) into the
symmetry structure (solution).
SOLUTION
PROBLEM
fst(X,Y’)
Y1
SP X Y’
X
fsg(Y,Y’)
Y2
fnsg(X,Y) Y1 Y2
DESIGN PATTERN
Fig. 15: The design patterns as the symmetrisation process
class X // fst(X,Y’) + fsg(Y,Y’) If we want to ensure that the process of the construction is
{ Y y;
independent of the presentation we introduce a new
X(Y y1) {y1 = y;}
void m() element Builder (abstract image) which together with the
{ y.m(); Director establishes symmetry transformation:
}
}
fst(Director,Builder)
abstract class Y’ whereas with the ConcreteBuilder element establish
{ abstract void m(); } symetry group:
class Y1 extends Y fsg(ConcreteBuilder,Builder)
{ void m() {…} } Accordint to PT1 Builder pattern has a form:
class Y2 extends Y fnsg(Director,ConcreteBuilder) ->
{ void m() {…}} fst(Director,Builder) + fsg(ConcreteBuilder,Builder)
class Main
{ public static void main(String arg[]) Bridge pattern provides an independent abstraction of
{ X x; an operation from its implementations. One abstraction of
if (condition1) an operation can have more implementations
x = new X(new Y1());
else (realisations). This pattern has the following elements:
x = new X(new Y2()); Abstraction (original) and ConcreteImplementor (image),
x.m(); which is represented by the set of elements:
}
ConcreteImplementor1,ConcreteBuilder
}
concreteImplementor ,..., ConcreteBuildern.
Between Abstraction and ConcreteImplementor no-
9. The examples of the design pattern symmetry group (problem in the pattern), is formed,
explained by the symmetry concepts which can be marked:
GOF patterns / Elements of pattern Original Abstract image Concrete image Comment [F1]: Profesore, ovde ste negde stvljali
Abstract Factory Client AbstractFactory ConcreteFactoryi slovo i na kraju naziva paterna.
Client AbstractProductA ProductAi
Client AbstractProductB ProductBi
Builder Director Builder ConcreteBuilder
Factory Method main Creator ConcreteCreator
Prototype Client Prototype ConcretePrototypei
Singleton Singleton
Adapter Client Target Adapter
Bridge Abstraction Implementor ConcreteImplementori
Composite Client Component Leaf
Client Component Composite
Composite Component Leaf
Composite Component Composite
Decorator Decorator Component ConcreteComponent
Decorator Component Decorator
Façade main Façade
Flyweight FlyweightFactory Flyweight ConcreteFlyweighti
Proxy Client Subject Proxy
Chain of Responsibility Client Handler ConcreteHandleri
Handler Handler ConcreteHandleri
Command Invoker Command ConcreteCommand
Interpreter Client AbstractExpression TerminalExpression
Client AbstractExpression NonterminalExpression
NonterminalExpression AbstractExpression TerminalExpression
NonterminalExpression AbstractExpression NonterminalExpression
Iterator Client Agregate ConcreteAgregate
Client Iterator ConcreteIterator
Mediator Colleague Mediator ConcreteColleaguei
Memento CareTaker Memento
Observer Subject Observer ConcreteObserver
State Context State ConcreteStatei
Strategy Context Strategy ConcreteStrategyi
Template Method main AbstractClass ConcreteClass
Visitor Client Visitor ConcreteVisitori
ObjectStructure Element ConcreteElementi
Table 1: Elements of GOF design patterns explain by concepts of our theory (Original, Abstract image, Concrete image)
10. Conclusion and pointed out the cases in which the "function of
If we look at previous attempts to formalize design origination" is applicable. Thereafter, we have defined the
patterns, we can say that they mostly try to create the theorems of the symmetry group realized by the class
formal languages (BPSL, DPML ,..., Lepus) which will diagram and the theorems of the no-symmetry group
describe the design patterns. These languages are focused realized by the class diagram where we have shown the
on a precise definition and specification of solutions, cases in which the set of classes makes, or does not make
while less attention is given to a problem being solved. the symmetry group. At the end of the paper we have
This paper explains formally the design patterns as the described the design patterns by one program which is
process of transformation (T) the problem into the explained with the symmetry concepts. The result of the
solution through the symmetry concepts (symmetry paper is two definitions of the design patterns:
transformations and symmetry groups). We have tried to Definition PT1: The Design pattern is the symmetry
confirm formally the attitudes of Jim Copliena and Liping process (fsp) that no-symmetry group of origin (X) and its
Zhao which were the first to suggest a link between image (Y) transforms to:
patterns and symmetry concepts. a) the symmetry transformation between the original (X)
Our theory is derived on the base analysis of the design and its abstract image (Y’) and b) the symmetry group of
pattern [1] in which we have observed the structure of the concrete image (Y) and its abstract image (Y’) .
solutions which is common to the most of the GOF Definition PT2 : The Design pattern is the process which
patterns. Based on that structure we have defined the transforms the no- symmetry structure (problem) into the
structure of the problem and explained how to perform symmetry structure (solution).
the transformation of the structure of the problem into the
structure of the solution. We think that this study formally explains what the
We have defined the theorem of the symmetry patterns are and when and how patterns are occurring.
transformation for the given injective function, where we According to the definition of symmetry given by Rosen
explained the cases when between the two states, after the [6]: Symmetry is immunity to a possible change, the aim
transformation, there is an equivalence relation. We have of this study is to define a formal basis for making the
shown the application of these theorems in class diagrams stable and sustainable software systems, based on
symmetry concepts, which will be able to change but will
also be immune to change. We consider that further
development of software systems should seriously
consider the concepts of symmetry because they exist in
the bases of all conservation laws (Conservation of
Energy, Conservation of Linear Momentum,
Conservation of Angular Momentum, ...). In this sense,
Noether's Theorem, states that there is a one-to-one
correspondence between conservation laws and
symmetries of differentiable physical systems. Nobel
laureate PW Anderson, said: "It is only slightly
overstating the case to say that physics is the study of
symmetry." We believe that in times to come,
“Conservation Laws of the software system“ and the
study of symmetry in this context, will bring software
systems and the physical systems close togather and
enable the use the considerable knowledge from the
physics in the software engineering.
References