Modularity Flashcards

1
Q

what is module

A

each of the set of standardized parts that are used to create more complex structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how is modularity being measured

A

by using three factors - cohesion, coupling and connascence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is cohesion

A

cohesion is an indication of the extent to which parts of a module should be kept together, inside the module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is coupling

A

coupling is an indicator of how much calls a module needs to make to another module so as to be able to perform any meaningful transaction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what are the varieties of cohesion

A

functional (best), sequential, communicational, procedural, temporal, logical, coincidental (worst)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is LCOM measure of cohesion

A

LCOM or Lack of Cohesion Measurement is a part of Chidamber and Kemerer suit of Object - oriented metrics. It represents the sum of the methods not shared via sharing of a common field; so for example, in a class if there are 3 out 10 methods that shares common attribute, would have lower LCOM score (and therefore less cohesion, which is usually bad) than the class that has 7 out of 10 methods that uses the shared common attribute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is afferent coupling

A

number of inbound calls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what is efferent coupling

A

number of outbound calls

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is abstractness

A

the ratio between number of abstract methods to concrete method is the measure of abstractness

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is instability

A

the ratio between efferent coupling / sum of afferent & efferent coupling; higher value indicates that there are lot of outbound calls that a class makes, thereby making it susceptible to breakage in case any of the called classes break

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is distance from main sequence

A

distance from main sequence = |abstractness + instability - 1|; if abstraction scores high, a class falls to zone of uselessness, if instability is very high then the class falls to zone of pain

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is connascence

A

two components are connascent if change in one, requires changing in the other, to ensure that the system functions correctly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is the difference between static and dynamic connascence

A

static connascence indicates source code level coupling and dynamic connascence indicate runtime coupling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what are the variety of static connascence

A

static connascence indicates the degree to which multiple components agree on the name, type, meaning, position, algorithm of a given entity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is the use of connascence as a tool

A

connascence is a measure that needs to be minimized across module boundaries, by the use of encapsulation; the connascence within a module should be made high

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what are 7 typical code review sections

A

Style, Correctness, Complexity, Design, Security & Coverage

17
Q

what are to be used for consistent styling

A

checkstyle & .editorconfig

18
Q

what are to be used to ensure code correctness

A

spotbugs, pmd, checker, error prone etc. can find potential coding issues

19
Q

what is used to measure code complexity

A

code complexity are of two types, cyclometric complexity, which if higher makes testing more difficult and cognitive complexity, which if higher makes understanding code more difficult

20
Q

what is used to find design flaws

A

checkstyle, pmd validates design issues with class, method, parameter and source code level design issues

21
Q

what is the way to find security vulnerability

A

using findsecbugs and sonarquebe

22
Q

how to measure code coverage

A

by using Jacoco

23
Q

what are some advanced mechanism to find design flaws

A

PMD’s LawOfDemeter — Law of Demeter is a simple rule that can help in reducing tight coupling between classes.

Checkstyle’s DesignForExtension — based on Effective Java 3rd Edition book by Joshua Bloch, Item 17: Design and document for inheritance or else prohibit it.

PMD’s CouplingBetweenObjects — detects tightly coupled classes that are difficult to test, analyze and extend by measuring its number of unique attributes, local variables and return types.

jPeek — you can use this tool to measure the cohesion of our classes and as a result, help to keep the high cohesion of classes, modules, packages.