Professional Documents
Culture Documents
Applying Mathematical Models in Software Design
Applying Mathematical Models in Software Design
88
Postorder type n-ary tree evaluation algorithms based on SELECT @rez = MAX (idactivitate) FROM Explorer
RETURN @rez END
the above described tree representation are used in order to
compute the total number of credits for curricula of weighted FCT_SuntDisciplineEchivalente MS SQL function [5]
average grade of students on various modules. Some efficiency verifies if two activities are equivalent by testing if they have
studies we have performed on processing the hierarchical the same canonical representative:
CREATE FUNCTION
structure are also given in [15]. [dbo].[FCT_SuntDisciplineEchivalente] ( @d1 as INT,
@d2 as INT) RETURNS BIT AS BEGIN
The view technique is convenient (fast at the database DECLARE @c1 AS INT DECLARE @c2 AS INT
engine level) for extracting complex data. Still, when DECLARE @r AS BIT
transmitted to client modules, large views may induce SELECT @c1 = [dbo].[FCT_GetCanon] (@d1)
SELECT @c2 = [dbo].[FCT_GetCanon] (@d2)
inefficiency by transferring a large amount of data via the IF (@c1 = @c2 ) OR (@d1 = @d2) BEGIN
network. By replacing such program sequences with strongly SET @r = 1 END
parameterized stored procedures, we succeeded to improve ELSE BEGIN SET @r = 0 END
run-time efficiency with up to 80%. A systematic comparison RETURN @r END
of hierarchic structures processing techniques is given in [4]. We further implement equivalence verification for modules
[5]. Let m1, m2 be two modules that contain distinct activity
representatives. We define the equivalence relations between
IV. IMPLEMENTING EQUIVALENCE ALGORITHMS ON modules as “mapping” (from one module to the other) only
MODULE HIERARCHIC STRUCTURES disciplines that are equivalent. Since in our hierarchic
Within this section we present means of implementing representation, all non-leaf modules consist only of modules,
equivalence algorithms [6] on the above described modular we introduce the following definition for module equivalence:
structures [5] (d1 m1 , ! d 2 m2 : d1 ~ d 2 )
Didactic entities, named activities (or in particular °(d m , ! d m : d ~ d ), IsLeafModule(m )
disciplines) are retained in a dedicated table – Tbl_activitati : m1 | m2 °° 2 2 1 1 1 2 1
®
IsActivity(d) := ®true, d Tbl _ Activitati [idactivitate] ° (md1 m1 , ! md2 m2 : md1 | md2 )
¯ false, otherwise °
°¯ (md2 m2 , ! md1 m1 : md1 | md2 ), otherwise
Disciplines are organized in hierarchies of modules, where
Two leaf modules are equivalent iif all contained
modules are retained in a dedicated table – see previous
disciplines are equivalent; two non-leaf modules are equivalent
section. In our hierarchic representation, all non-leaf modules
iif all contained modules are equivalent. By generically
consist only of modules.
denoting with ‘~’ an equivalence relations for activities or
IsModule(m) := ®true, m Tbl _ Modules[idmodul ] modules as above defined, we may state that:
¯ false, otherwise
m1 | m2 (d1 m1, ! d2 m2 : d1 ~ d2 )
IsLeafModule(m) := ®true, d m : IsActivity [d] (d2 m2, ! d1 m1 : d1 ~ d2 )
¯ false, otherwise For a leaf module m, we consider Canonic (m) =
Let d1, d2 be two didactic activities (in particular, {Canonic(d) | dm} – the set of canonical representative for
disciplines). We use the notation ‘~’ for describing the the contained activities / disciplines . It can be shown that two
equivalence of two activities / disciplines d1, d2 in the sense leaf equivalent modules have the same sets of canonical
that they are curricular-equivalent: d1 ~ d2 . module representatives. For a module m we can recursively
‘~’ is an equivalence relation [6] since it verifies compute its canonical representative set as [5]:
reflexivity, symmetry, transitivity properties. Canonic(m) = {Canonic(d ) | d m}, IsLeafModule[m]
®
The canonical representative of a disciplines’ equivalence ¯ {Canonic(md) | md m}, otherwise
class will be the ‘newest’ defined discipline i. e. having the Intuitively, the canonical set of a module is obtained by
biggest identifier code. “flattening” its module sub-tree and computing the union set of
We implemented, by means of stored a procedure, the all canonical sets corresponding to its descendant leaf modules.
simplification algorithm for determining the canonical Generically, we may state: Canonic (m) = {Canonic(d) | dm}
representative [6] for a given discipline. Based on this We further implement these hierarchic processings at a
algorithm, we may also test the equivalence of two disciplines database level, by means of stored procedures. We give below
by verifying they have the same canonical representative [5]: the MS SQL function that computes the canonical set of a
module (canonical set of all disciplines belonging to its
CREATE FUNCTION [dbo].[FCT_GetCanon]
(@IDA AS INT ) RETURNS INT AS BEGIN descendant leaf modules).
DECLARE @rez AS INT; CREATE FUNCTION [dbo].[FCT_GetActivitatiEchivModul]
WITH Explorer AS ( (@idModul AS INT)
SELECT idactivitate, idactivitateechiv RETURNS @rez TABLE (idactivitate INT) AS BEGIN
FROM echivalari_discipline -- select leaf modules from the module parent ..
WHERE idactivitate = @IDA UNION ALL WITH Explorer AS(
SELECT M.idactivitate, M.idactivitateechiv SELECT idmodul, legaturaasc, denumiremodul,
FROM echivalari_discipline M INNER JOIN Explorer E nivel, semstudiu
ON M.idactivitate = E.idactivitateechiv )
89
FROM modul WHERE idmodul = @idModul UNION ALL properties in order to increase software proficiency. We also
SELECT M.idmodul, M.legaturaasc,
M.denumiremodul, M.nivel, M.semstudiu
intend to study additional means of processing hierarchical
FROM modul M INNER JOIN Explorer E ON structures and complexity analysis directions with the view to
M.legaturaasc = E.idmodul ) improving software design techniques.
-- select disciplines from leaf modules
INSERT INTO @rez
SELECT ad.idactivitate FROM Explorer mc Acknowledgment We thank the development team in our
INNER JOIN modul_discipline md on IT department for contributing to AcademicInfo’s
mc.idmodul=md.idmodul implementation: Florina Covaci, Gabriel Pop, Monica Bojan,
INNER JOIN activitati_discipline ad ON
md.idactivitate = ad.idactivitate
Carmen Pavel, Kerekes Hunor, Zölde Attila, Kerekes Tünde,
RETURN END Andrei Popescu (and authors).
USP_SuntModuleEchivalente-CuCanonic – see [5] verifies
module equivalence by testing the equality of the canonical REFERENCES
sets. An alternate approach – MS SQL procedure [1] Alina Andreica, D. Stuparu, I..Mantu, “Symbolic Modelling of Database
USP_SuntModule_Echiv, which implements the module Representations”, International Symposium on Symbolic and Numeric
Algorithms for Scientific Computing 2005, IEEE Press, 2005, p 59-62
equivalence definition is also desribed in [5] .
[2] Alina Andreica, Calcul simbolic şi aplicaţii, Dacia, Cluj-Napoca, 2005
A run time benchmark for 20 / 100 activities per module – [3] Alina Andreica,”Implementing Parameterized Type Algorithm
see table 2 – is computed in order to compare stored Definitions in Mathematica”, IEEE Proceedings, Eighth International
procedures for module equivalence by implementing the SYNASC Symposium, 2006, P.35 - 40
definition versus verifying canonical sets; we may obviously [4] Alina Andreica, D Stuparu, C Miu, “Design Techniques in Processing
Hierarchical Structures at Database Level”, Iadis Information Systems
notice that the canonical approach is more efficient 2010 Proc, Porto, Ed: M. Nunes, P. Isaias, P. Powell, 2010, P. 483-488
[5] Alina Andreica, D Stuparu, C Miu, Mathematical Models in Software
V. CONCLUSIONS AND FUTURE WORK Design - Generic Sorting and Equivalence Algorithms, Theory and
Practice in Modern Computing 2012, 17-19 July 2012, Lisbon, Portugal
The categorical and parameterized approach reveals a [6] Bruno Buchberger, R. Loos, Algebraic Simplification, Computing,
general method for defining computational domains: this Suppl. 4, Springer Verlag, p.11-43, 1982
approach is used for implementing generic sorting procedures [7] B. Buchberger, "Automatic Invention and Verification by Lazy
at database level. We reveal the advantages of the approach in Thinking", D. Petcu, V. Negru, D. Zaharie, T. Jebelean Eds, Proceedings
order to deal with specific problems. The novelty of the of SYNASC 2003, p. 2-26
implementation consists in applying generic algorithms at [8] L. Dragan, S. Watt, "Performance Analysis of Generics in Scientific
database level and in modelling discipline and module Computing", SYNASC 2005 International Symposium, JD Cantarella
editor, IEEE Computer Society Press, 2005, p. 93-100
equivalence with equivalence and simplification algorithms.
[9] Client/Server and the N-Tier Model of Distributed Computing,
We also deal with techniques for representing and Micromax Information Services Ltd. 1999
processing hierarchical data structures that are used to [10] Dhawan P., .NET Remoting Performance, Building Distributed
implement simplification algorithms at database level and Applications with MS .NET, MS Press, 2002
addresses efficiency issues in this respect. The method we [11] Gamma E, Helm R, Johnson R, Vlissides J, Design Patterns, Teora, 2002
propose addresses means of implementing simplification and [12] Larson B., Delivering Business Intelligence with Microsoft SQL Server
equivalence algorithms on data structures based on modular 2005, McGraw-Hill/Osborne, 2006
entities. We reveal the advantages of applying the algebraic [13] MCAD/MCSD Training Kit: Developing XML Web Services & Server
equivalence model at a database level and of applying Components with MS Visual Basic .NET and MS Visual C# .NET
Editor, MS Press, Redmond, 2003
canonical representatives’ properties. Case studies are
[14] Ramakrishnan, R., Database Management Systems, 3rd edition, New
performed on our AcademicInfo information system that we York: McGraw-Hill, 2002
have designed and implemented [15] D. Stuparu, Alina Andreica, I.Mantu, “Comparing Access Techniques
Future work is related to refining techniques of software on Databases in Distributed Application Frameworks”, Collaborative
Support Systems in Business and Education, Cluj-Napoca, 2005, p 1-10
design by implementing specific mathematical models and
Run time (ms) for 10.000 Run time (ms) for 10.000
Procedure modules, 20 disciplines / module, ~100 disciplines /
compared module compared module
USP_SuntModule_Echiv 28895 136941
USP_SuntModuleEchivalente-CuCanonic 1394 1717
90