A System And A Method To Analyze A Design For A Piece Of Code


Updated about 2 years ago

Abstract

A system and a method to analyze a design for a piece of codeA system (1) to analyze a design (10) for a piece of code (2)includes an interface (4) for providing a set of callpatterns (6) and a set of weights (7) related to each of thecall patterns (6), and a processor (5) adapted for receivingthe set of call patterns (6) and the set of weights (7), andfor processing the set of call patterns (6) and the set ofweights (7) to provide an output (3) related to quality ofthe design (10), wherein the design (10) for the piece ofcode (2) is represented by using the call patterns (6) fromthe set and the call pattern (6) defines invoking of a part(8) of piece of code (2) by another part (8) of the piece ofcode (2) while executing the piece of code (2).

Information

Application ID 1375/KOL/2011
Invention Field GENERAL ENGINEERING
Date of Application 2011-10-27
Publication Number 02/2017

Applicants

Name Address Country Nationality
SIEMENS AKTIENGESELLSCHAFT WITTELSBACHERPLATZ 2 80333 MÜNCHEN GERMANY Germany Germany

Inventors

Name Address Country Nationality
TUSHAR SHARMA NATIONAL GAMES VILLAGE, KORMANGALA 560034 BANGALORE KARNATAKA, INDIA India India

Specification

Description
A system and a method to analyze a design for a piece of code
The invention relates to a system to analyze a design for a
piece of code. More specifically, the invention relates to a
system to analyze quality of the design for a piece of code.
A design forms a skeleton for developing a piece of code.
Introducing a change with a rigid, inflexible, and defective
skeleton could be time consuming, effort intensive, and error
prone. Therefore a flexible, maintainable, extensible design
is desired in order to achieve smooth integration of changes
in the piece of code.
One possible way to provide to provide such extensible design
is to refactor the design of the piece of code, which
theoretically amend the design whenever a need for such
change is required in real time. However, in practical
scenario, the requirements to amend the piece of code keeps
on getting accumulated in lieu of enterprise level decisions
to introduce changes in the deign. This makes the job of
refactoring the design of the piece of code difficult.
Moreover, for making the enterprise level decisions to
refactor the design of piece of code, some measures are
required to decide for change in quality of the design with
respect to the human efforts to be put by the software
developers.
One way to measure the quality of the design is suggested by
Khaer et al., in An empirical analysis of software systems
for measurement of design quality level based on design
patterns, 10th international conference on Computer and
informationtechnology, 2007. iccit 2007. pp 1-6. The paper
discloses use of call patterns to measure quality of software
design, wherein the call pattern defines invoking of a part
of piece of code by another part of the piece of code while
executing the piece of code.
However, detecting call patterns precisely is a non-trivial
challenge as call patterns can be customized, and the
customized structure of the pattern may not look like a
standard pattern. Therefore, the mere presence of call
patterns may not reflect the precise quality of the software
design.
The object of the invention is to analyze a piece of code to
determine quality of a design of the piece of code by using
call patterns.
The object of the invention is achieved by a system of the
claims 1 and a method of the claim 7.
The idea of the invention is to analyze a design of the piece
of code by sending a set of call patterns and a set of
weights related to each of the call patterns from an user
interface to a processor, and further processing the call
patterns and the weights to provide an output related to
quality of the design by the processor. The design for the
piece of code is represented by using the call patterns from
the set. The call pattern defines invoking of a part of piece
of code by another part of the piece of code while executing
the piece of code.
According to an embodiment of the system, the processor is
adapted to categorize the call patterns into various call
types, such that each weight refers for each call type. This
helps to provide more comprehensive processing of the call
patterns with respect to the weights.
According to one embodiment of the system, the call types of
the call pattern are based on code types of the part of the
piece of code is being called by code types of the another
part of the piece of code, wherein each part of the piece of
code is categorized into various code types. Defining the
call types on a basis of code types provides a better co-
relation between the part of the piece of the codes and the
design of the piece of code, as the code types are based on
the part of the piece of code and the call types are based on
call patterns which are further comprised to form the design
for the piece of code.
According to another embodiment of the system, atleast one of
the parts of piece of code belongs to more than one code
types. This helps to recognize the part of the piece of code
which lies into more than one code types and thus making the
analysis by the system more comprehensive.
According to yet another embodiment of the system, the
processor adapted to process the set of call patterns and the
set of weights by assigning atleast one of the weights to
each of the call pattern. Such processing step correlates the
call patterns with the weights to recognize quality of each
call pattern, so that over all quality of the design can be
identified.
According to an exemplary embodiment, the processor is
adapted to further process the set of call patterns and the
set of weights to provide the output related to quality of
the design by calculating weighted average of the call
patterns in the set. This provides an easy way to provide the
output related to quality of the design.
The above-mentioned and other features of the invention will
now be addressed with reference to the drawings of a
preferred embodiment of the present hearing aid device. The
illustrated embodiment of the system for analyzing design of
a piece of code is intended to illustrate, but not limit the
invention. The drawings contain the following figures, in
which like numbers refers to like parts, throughout the
description and drawings.
FIG 1 is a schematic representation of a system for analyzing
a design for a piece of code.
FIG 2 is a tabular representation of weights assigned to
various call types
FIG 3A is a schematic representation of first version of call
patterns mapped onto corresponding piece of code for
providing a result on execution of the piece of code
FIG 3B is a schematic representation of second version of
call patterns having better quality mapped onto corresponding
piece of code for providing the same result on execution of
the piece of code
Discussing FIG 1 along with FIG 2, FIG 3A, and FIG 3B. While
discussing FIG 1, FIG 2, FIG 3A and FIG 3B references will be
made to each other.
FIG 1 illustrates a system 1 for analyzing a design 10 of the
piece of code 2 for qualitative analysis. One way to
represent design 10 is to use call patterns 6 between the
various parts 8 of the piece of code 2, wherein the call
pattern 6 defines invoking of one part 8 of the piece of code
2 by another part 8 of piece of code 2. The system 1 includes
an interface 4 for transferring a set of call patterns 6 and
a set of weights 7 to a processor 5 for processing the call
patterns 6 and the weights 7 to provide an output 3 related
to the quality of the design 10 for the piece of code 2.
Various parts 8 of the codes can be categorized as code types
on a basis of structural execution of the parts 8, as
template type (T), hook type (H), and rigid type (R). The
structural execution means the way parts 8 of the piece of
code 2 are defined, declared and called by other parts 8 of
the piece of code 2. The structural execution is further
explainable using class diagrams from the unified modeling
language. A hook type (H) part 8 of the piece of code 2 is
declared in one class and defined in its subclass. A part 8
of the piece of code 2 which calls at least one hook type
part 8 is known as a template type (T) part 8 of piece of
code 2, while a rigid type (R) is declared and defined in a
same class. Every part 8 of the piece of code 2 need not be
lying in any of the code types, rather the code types are
assigned to those parts 8 of the piece of code 2 to define
the design 10 which forms a minimal set by which structure,
behavior, and rationale of design 10 can be captured and
described. In an alternate embodiment, the parts 8 of piece
of code 2 are not categorized on the basis of structural
execution; rather parts 8 of the piece of code 2 are analyzed
on being called by other parts 8 to determine call patterns
6.
The part 8 of the piece of code 2 may represent more than one
code types. In such cases, a new code type is included into
the code types to represent such parts 8 of the piece of code
2. Exemplarily, if part 8 of the piece of code 2 is playing
template as well as hook type roles, then the part 8 of the
piece of code 2 is assigned a new type i.e., TH (template-
hook) . While, if the part 8 of the piece of code 2 is both
template/hook and rigid type, then it is treated as
template/hook type. In an alternate embodiment, separate code
types are not assigned to the parts 8 which belong to more
than one code types and the call patterns 6 are formulated
with the T, H and R code types only.
The weights 7 provided to the processor 5 by the interface 4
have a mapping to the call types 9. One such exemplary
mapping is shown through the tabular representation of call
types 9 and weights 7 of the FIG 2. Various parts 8 of the
piece of code 2 which can be mapped to the methods in the
class diagrams are categorized as Temporary type (T), Hook
type (H), Rigid type (R), and Temporary-Hook Type (TH). The
call types 9 of call patterns 6 are formulated out of these
code types by an expression X -> Y, where X, Y belongs to the
set {T, H, R, TH}. For example, if template type parts 8 of
the piece of code 2 calls hook type of part 8 of the piece of
code 2, then the call pattern 6 will be T1->H2. The table in
the figure shows on left hand side shows the call types 9 and
right hand side shows the corresponding weights 7 for each
call sides. In total there are four possible call types 9
shown for which the weights 7 0, 1, or 2 are assigned. The
weights 7 are not assigned to H->TH, H->H, R->TH, and R->H,
as they will be represented by TH->TH, TH->H, R->TH and R->H
respectively. The call types 9 which are recommended have
been given higher weights 7 and which are not preferred have
been provided lower weights 7. The phenomenon for assigning
the weights 7 can be understood as follows:
• Call types 9 X->H or X->TH, where X can be of code types
T or TH, are the most desirable call types 9. Thus,
highest weight 7 (i.e. 2) is assigned to these call
types 9.
• Call types 9 X->T, where X can be of any code types, are
second in line for desirability of call types 9. Thus,
mediocre weight 7 (i.e. 1) is assigned to these call
types 9.
• Call types 9 X->R, where X can be of any code types, are
least desirable call types 9. Thus, least weight 7 (i.e.
1) is assigned to these call types 9.
Alternatively, the a user using the user interface 4
identifies call patterns 6 and assigns weights 7 to each of
the call patterns 6 without identifying call types 9 assigns
weight 7 to each call pattern 6 manually from the set of the
weights 7.
According to FIG 1, the processor 5 processes the call
patters and weights 7 to provide the output 3 related to the
quality of the software design 10. While processing, the
processor 5 recognizes call types 9 of each of the call
patterns 6 and assign the weights 7 accordingly to each of
the call patterns 6 according to the call types 9 it belongs
to. Further, the processor 5 calculates a weighted average of
the call patterns 6 as the output 3 related to quality of the
design 10. The weighted average (0) can be determined using
following equation:
0 = Summation of Wi (Total instances of each call pattern)/
Wx(Sum of total instances of all call patterns) - (A)
Wherein Wi refers to weight 7 assigned for ith call-pattern,
and
Wx refers to maximum weight 7 assigned to any call-pattern.
Using equation (A), the value of the output 3 lies between 0
to 1, inclusive of both 0 and 1, wherein 0 means the worst
quality of the design 10 for the piece of code 2 and 1
represents best quality of the design 10 for the piece of
code 2.
Alternatively, the system 1 need not output 3 the weighted
average of the call patterns 6, rather system 1 just
categorize the call patterns 6 into various call types 9 and
further mention each of the call types 9 present in the piece
of code 2.
The phenomenon of weighted average is further explained by
two exemplary versions of the call patterns 6 which provides
same result on execution. The first version of call patterns
6 mapped onto corresponding piece of code 2 is illustrated by
FIG 3A and the second version of call patterns 6 mapped onto
corresponding piece of code 2 is illustrated using FIG 3B.
FIG 3A is a schematic representation of design 10 for the
first version of call patterns 6 mapped onto the
corresponding piece of code 2. The design 10 includes only
rigid code types. The different parts 8 of the piece of code
2 are R0, R1-1, R1-2, R2 and R3. The call patterns 6 are as
follows R1->R1-1, R1-1->R1-2, R1-2->R2, and R1-2->R3. As all the call
patterns 6 belongs to least desirable code types, thus the
weights 7 assigned to each of the call patterns 6 are 0 using
the table of FIG 2. Thus the weighted average (0) of the call
patterns 6 is 0 using equation (A). This means the quality of
the design 10 of the piece of code 2 is poor.
FIG 3B is a schematic representation of design 10 for the
second version of call patterns . 6 mapped onto the
corresponding piece of code 2. The design 10 includes only
rigid, template and hook code types. The different parts 8 of
the piece of code 2 are R0, R1, T1, and H1. The call patterns 6
are as follows R0->R1, R1->T1, and T1->H1. Using the Table from
the FIG 2, the weights 7 assigned to the call patterns 6 are
0, 1 and 2 respectively. Thus the weighted average of the
call patterns 6 is 0.5 using equation (A). This is a better
quality of the design 10 of the piece of code 2 in comparison
to the first version of the call patterns 6 as illustrated in
FIG 3A.
The system 1 can also take the design 10 as an input to the
processor 5 rather than the set of call patterns 6 and in
such a case, the system 1 identifies call patterns 6 for
further processing the call patterns 6 and the weights 7.
The weights 7 need not be input as the set, rather a user can
input weights 7 randomly for each of the call patterns 6, as
and when required by the processor 5 to process the call
patters to provide the output. In an alternate embodiment,
the weights 7 need not be provided by the interface 4, rather
the system 1 can use a rule set defining the weights 7 to be
assigned to each call patterns 6.
The processor 5 can be a stand alone micro-processor
specially designed to function the system 1 or it can be a
central processing unit of a person computer adapted to
process the call patterns 6 and the weights 7.
The interface 4 can be a textual or a graphical interface
which can receive input as call patterns 6 and weights 7 from
the user and further transfers the call patterns 6 and
weights 7 to the user. In an alternate embodiment, the
interface 4 can receive the call patterns 6 and the weights 7
from a memory device which maybe internal memory device like
hard disk or external memory device like USB stick, memory
card, CD-ROM, etc.
We claim:
1. A system (1) to analyze a design (10) for a piece of code
(2) comprising:
- an interface (4) adapted to provide a set of call patterns
(6) and a set of weights (7) related to each of the call
patterns (6),
- a processor (5) adapted to receive the set of call patterns
(6) and the set of weights (7), and to process the set of
call patterns (6) and the set of weights (7) to provide an
output (3) related to quality of the design (10),
wherein the design (10) for the piece of code (2) is
represented by using the call patterns (6) from the set and
the call pattern (6) defines invoking of a part (8) of piece
of code (2) by another part (8) of the piece of code (2)
while executing the piece of code (2).
2. The system (1) according to the claim 1, wherein the
processor (5) is adapted to categorize the call patterns (6)
into various call types (9), such that each weight (7) refers
for each call type (9).
3. The system (1) according to the claim 2, wherein the call
types (9) of the call pattern (6) are based on code types of
the part (8) of the piece of code (2) is being called by code
types of the another part (8) of the piece of code (2),
wherein each part (8) of the piece of code (2) is categorized
into various code types on a basis of structural execution of
the parts (8) of the piece of code (2).
4. The system (1) according to the claim 3, wherein atleast
one of the part (8) of piece of code (2) belongs to more than
one code types.
5. The system (1) according to any of the claims 1 to 4,
wherein the processor (5) adapted to process the set of call
patterns (6) and the set of weights (7) by assigning atleast
one of the weights (7) to each of the call pattern (6).
6. The system (1) according to the claim 5, wherein the
processor (5) is adapted to further process the set of call
patterns (6) and the set of weights (7) to provide the output
(3) related to quality of the design (10) by calculating
weighted average of the call patterns (6) in the set.
7. A method to analyze a design (10) for a piece of code (2)
comprising:
- transferring a set of call patterns (6) and a set of
weights (7) related to each of the call patterns (6) from an
interface (4) to a processor (5),
- processing the set of call patterns (6) and the set of
weights (7) and providing an output (3) related to quality of
the design (10),
wherein the design (10) for the piece of code (2) is
represented by using the call patterns (6) from the set and
the call pattern (6) defines invoking of a part (8) of piece
of code (2) by another part (8) of the piece of code (2)
while executing the piece of code (2).
8. The method according to claim 7, further comprising:
- categorizing the call patterns (6) into various call types
(9) by the processor (5), such that each weight (7) refers
for each call type (9).
9. The method according to any of the claim 7 or 8, further
comprising:
- processing the set of call patterns (6) and the set of
weights (7) by assigning atleast one of the weights (7) to
each of the call pattern (6) by the processor (5).
10. The method according to claim 9, further comprising:
- further processing the set of call patterns (6) and the set
of weights (7) to provide the output (3) related to quality
of the design (10) by calculating weighted average of the
call patterns (6) in the set.

A system and a method to analyze a design for a piece of code
A system (1) to analyze a design (10) for a piece of code (2)
includes an interface (4) for providing a set of call
patterns (6) and a set of weights (7) related to each of the
call patterns (6), and a processor (5) adapted for receiving
the set of call patterns (6) and the set of weights (7), and
for processing the set of call patterns (6) and the set of
weights (7) to provide an output (3) related to quality of
the design (10), wherein the design (10) for the piece of
code (2) is represented by using the call patterns (6) from
the set and the call pattern (6) defines invoking of a part
(8) of piece of code (2) by another part (8) of the piece of
code (2) while executing the piece of code (2).

Documents

Name Date
1375-KOL-2011-(27-10-2011)-SPECIFICATION.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-GPA.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-FORM-3.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-FORM-2.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-FORM-1.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-DRAWINGS.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-CORRESPONDENCE.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-CLAIMS.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-ABSTRACT.pdf 2011-10-27
1375-KOL-2011-(27-10-2011)-DESCRIPTION (COMPLETE).pdf 2011-10-27
1375-KOL-2011-(01-11-2011)-FORM-18.pdf 2011-11-01
ABSTRACT-1375-KOL-2011.jpg 2011-12-13
1375-KOL-2011-(22-02-2013)-CORRESPONDENCE.pdf 2013-02-22
1375-KOL-2011-(22-02-2013)-ANNEXURE TO FORM 3.pdf 2013-02-22
1375-KOL-2011-AbandonedLetter.pdf 2019-01-03
1375-KOL-2011-FER.pdf 2018-04-24

Orders

Applicant Section Controller Decision Date URL