• No se han encontrado resultados

Plan de gestión para los residuos sólidos generados en centros de salud

3. Revisión de la literatura

3.5. Aspectos técnicos y operativos de la gestión integral de los residuos sólidos

3.5.1. Plan de gestión para los residuos sólidos generados en centros de salud

As depicted in Figure 1.2 in Chapter 1, SCAN consists in a series of four steps. In Step 1, SCAN uses execution traces to identify segments by finding cohesive and decoupled fragments of the trace. The trace segmentaion approach based on dynamic programming is presented in Chapter 4. Then, in Step 2, it merges similar segments using the Jaccard measure on terms extracted from the segments. After that, in Step 3, it uses an IR-based approach to label segments. Step 2 and 3 are presented in Chapter 5. This chapter presents Step 4, which uses FCA to identify relations among segments.

While we expect the labels produced in Step 3 to fully describe the concept implemented by a segment, they do not help developers to relate segments in a same trace with one another. For example, segments with identical labels may appear multiple times, in different trace regions. Furthermore, two segments may share many terms, which could possibly indicate the existence of a higher-level concept common to both segments. To discover such relations among segments, SCAN uses Formal Concept Analysis (FCA) and highlights commonalities and differences among segments by identifying terms shared between multiple segment labels and terms that are specific to particular segment labels.

As described in Section 2.4 in Chapter 2, FCA groups objects that have common attributes. In SCAN, objects are segments and attributes are the terms of the segments labels. The

binary relation states which term is included in which label. A FCA concept is a cohesive set of segments sharing some terms in their labels. Figure 6.1 shows an example of a FCA lattice for the ArgoUML scenario “add a new class” in which each node represents a formal concept (X, Y ). SCAN uses the lattice to identify relations among segments as explained in the following.

Figure 6.1 ArgoUML FCA lattice for the scenario “add a new class”.

Types of Relations. By applying FCA on the segments and terms from their labels and analysing the resulting lattices, we identified the following relations among segments: same phase, sub/super concept, and macro-phase.

Two distinct segments sharing the same relevant terms are considered to activate the same concept, thus forming a phase. For example, in Figure 6.1, SCAN identifies Segments 2, 8, and 14 as part of the same phase because these segments belong to the same concept. These three segments share the same terms and actually activate the same concept.

Sub-concept relation exists when a set of segment(s) activate part of a concept of another set of segment(s). SCAN identifies a sub-concept relations between two segments when relevant terms in the label of one segment are a superset of the terms of the label of another segment, i.e., by selecting the intent of a concept of interest in the lattice. For example, in Figure 6.1, Segments 2, 8, and 14 share the terms “generat, key, java, and modul ” with the Segments 3, 9, and 15 and thus are a sub-concept of these segments. Conversely, a super- concept relation exists when terms in the label of one segment are a subset of the terms of another.

which activates a set of concepts. SCAN identifies macro-phases by finding repeating se- quences of FCA concepts. For example, in Figure 6.1, there are several phases such as: Phase 2: Segments 2, 8, and 14; Phase 3: Segments 3, 9, and 15; Phase 4: Segments 4, 10, and 16; Phase 5: Segments 5, 11, and 17; and Phase 6: Segments 6, 12, and 18. A segment activates the phase that it belongs to, thus, for example, Segment 2 activates Phase 2. The next segment in the trace, Segment 3, activates Phase 3. In the same way segments 4, 5, and 6 activate respectively Phases 4, 5, and 6. Thus, the sequence of Segments 2 to 6 activates the sequence of Phases 2 to 6. However, the same sequence of phases is also activated with the sequence of Segments 8 to 12 as well as with the sequence of Segments 14 to 18. Thus, the three sequences of Segments 2 to 6, Segments 8 to 12, and Segments 14 to 18, activate the same concepts, i.e., activate the concepts of Phases 2 to 6. SCAN abstracts those five phases and identifies the macro-phase containing Phases 2 to 6.

Sequence Diagram. The FCA lattice shown in Figure 6.1 can be used by developers in the more familiar form of a UML sequence diagram. To obtain a sequence diagram from the FCA lattice, segments are considered in the order in which they appear in the execution trace. Each segment is associated with its most specific FCA concepts in the FCA lattice. Methods are activated in the sequence diagram for each FCA attribute of the segment-specific FCA concepts. The topmost reachable FCA attributes are activated first and all FCA attributes in the sub-FCA concepts are activated as nested operations.

A portion of the sequence diagram for the FCA lattice in Figure 6.1 is shown in Figure 6.2 (generated using PlantUML1). The sequence diagram shown in Figure 6.2 contains the

same information available from the FCA lattice, but the sequential ordering of the called method makes it easier to read and understand for developers.

Segment 1 is associated with a FCA concept that has three super-FCA concepts, two of which are annotated with FCA concept-specific attributes. Starting from the topmost anno- tated FCA concept, the following methods are activated in the sequence diagram: “model, notat, ...”, “factori, diagram, ..”, and “implement”. Similarly, Segment 2 activates “generate, key, ...”, which has a nested activation labeled “display”, while Segment 3 activates only “generate, key, ...”. For the sake of clarity, only a portion of the method calls in Segment 4

are shown.

Figure 6.2 ArgoUML sequence diagram derived from the FCA lattice for the scenario “add a new class”.

6.2 Preliminary Evaluation

We aim to evaluate SCAN capabilities to identify relations among segments. In this evaluation, we reuse the scenarios previously used to validate segments labels reported in Tables 5.1 and 5.2 in Chapter 5.

The study aims at answering the following research question:

RQ1. Does SCAN help to discover relations between segments? Does it help to discover the macro-phases in a trace? This research question is formulated to verify the efficiency of SCAN when relating segments. To address this research question, we analyse the lattice produced by FCA to identify relations between different segments.

6.2.1 Results and Discussions

In the following, we report results aimed at addressing RQ1. We exploited FCA to identify linguistically overlapping segments. In other words, segments having the same or shared labels implement similar or related concepts. By looking at Figure 6.3 we can notice that, for example, segments 4 and 23 are identical and implement the same concept. This was confirmed by manual inspection of the source code. A developer can therefore use lattice information to infer relations between segments and identify segments implementing the same concept. We can also notice that sometimes a computation phase, represented as an FCA concept, is contained in a more abstract one. For example, in Figure 6.3 segments 28 and 30 are contained in a super-concept of the concept containing segments 26 and 31. In fact, they all share some labels (listen, change, remove, figure), but the latter segments (26, 31) have their own specific labels (intern, multicast ).

Figure 6.3 Excerpt of the JHotDraw FCA lattice for the scenario “Draw Rectangle, Delete Rectangle”.

Figure 6.1 shows the FCA lattice for the execution trace of the scenario “New Class”. As for JHotDraw, also for ArgoUML FCA helps to highlight relations between segments. For example, segments 4, 10 and 16 implement the same concept. The concept containing segments 3, 9 and 15 is a sub-concept of the one containing segments 2, 8 and 14 and in fact it points to higher level concepts (generate key java module), while the super-concept includes segments specific of the display functionality.

To identify macro-phases in a trace, we consider relations between cohesive sets of seg- ments, regarded as execution phases. A macro-phase is built by repeated segments in a trace. For example, in Figure 6.1, segments 2, 3, 4, 5 and 6 define an execution phase on the trace and this phase is repeated two times: first with segments 8, 9, 10, 11 and 12, and then with

segments 14, 15, 16, 17 and 18. The rest of the segments are also converted to an execution phases.

Qualitative results indicate that the automatically-produced labels, organised into a con- cept lattice where similar or identical segments are grouped together, are extremely useful to understand commonalities and differences between segments and to extract a view where macro-phases can be labeled by the terms associated with the super-concepts of the involved segments. Cohesive sets of similar segments can be identified in the concept lattice. Such sets, in turn, define macro-phases, that labeled with super-concept terms. The temporal or- dering of the segments involved in different macro-phases suggests the temporal organization of the recognized phases. We think this has huge potential in supporting comprehension of complex execution scenarios for large programs.

Flow Diagram of Phases. After defining the phases we can draw a higher level flow diagram of phases with labels as shown in Figure 6.4, using the temporal relations between phases. The “New Class” scenario, generating 19 segments, can be summarised into four macro-phases. The first phase deals with the program startup, this is followed by activity needed to create class and properties (e.g., state, composite, etc). The third phase is devoted to managing diagram events and, finally, the last phase models add events and model changes.