Examining the Relationships Between Software Coupling and Software Performance: a Cross-Platform Experiment
Total Page:16
File Type:pdf, Size:1020Kb
Journal of Computing and Information Technology - CIT 19, 2011, 1, 1–10 1 doi:10.2498/cit.1001353 Examining the Relationships between Software Coupling and Software Performance: A Cross-platform Experiment Liguo Yu1 and Srini Ramaswamy2 1 Computer and Information Sciences Department, Indiana University, South Bend, USA 2 Industrial Software Systems, ABB Corporate Research Center, Bangalore, India Coupling measures the degree of dependencies between Alexander et al., 2010). Table 1 lists the def- software modules. Considerable research has been initions of several major types of coupling in performed to relate software coupling with software understandability, maintainability, and reusability, which structured software systems, in which the de- are the key properties of software maintenance and gree of dependency is considered in increasing evolution. However, only a few research works have order from the bottom (data coupling) to the been reported that study the relationships between soft- ( ) ware coupling and software performance. This study top content coupling . Strong coupling means implemented two benchmarks that measure and compare a high degree of dependency between software the performance of software programs implemented with modules, while loose coupling means a low de- different kinds of coupling, common coupling, data coupling, and stamp coupling. The experiment is run gree of dependency between software modules. on three different platforms, Windows, Linux, and Mac. The results show that (1) the relative performance of systems implemented using different software coupling is platform dependent; (2) while loose coupling is more favorable than strong coupling with respect to software Name Definition maintenance and evolution, it has the drawback of re- duced performance of a software program. Based on this Two modules are content coupled if one accesses and study, we make some suggestions to balance the use of Content Coupling strong coupling and loose coupling in designing evolving changes the internal data software systems in order to achieve both maintainability or logic of the other. and evolvability without compromising on performance. Two modules are common Common Coupling coupled if they refer to the same global variable. Keywords: component dependency, coupling, perfor- mance, cross-platform experiment Two modules are control coupled if one passes a Control Coupling variable to the other that is used to control the internal logic of the other. Two modules are stamp 1. Introduction coupled if they pass data Stamp Coupling through a parameter that is a record (structure). Coupling is a measure of the degree of inter- Two modules are data coupled if they pass data action between two software modules. Many Data Coupling through a parameter that different types of coupling have been identi- is a value. fied, including data coupling, stamp coupling, control coupling, common coupling, and con- tent coupling (Stevens et al., 1974; Page-Jones, Table 1. Definitions of various kinds of coupling in 1980; Offutt et al., 1993, Offutt et al., 2008, structured software systems (Offutt et al., 1993). 2 Examining the Relationships between Software Coupling and Software Performance... Maintenance and evolution are inevitable for The remainder of this paper is organized as fol- a software product. After a software prod- lows. Section 2 describes the research objec- uct is released, it requires continued mainte- tives. Section 3 describes the benchmarks and nance and evolution. Coupling between soft- the experiment. Section 4 contains the results ware modules strengthens the dependency of of the study. Conclusions and future work are one module on others and increases the prob- in Section 5. ability that changes in one module may affect the other modules, which makes maintenance and evolution difficult and more likely to in- 2. Research Objectives troduce regression faults (Banker et al., 1993; Schach et al., 2003; Yu et al., 2004).Ithas been shown that strong coupling is related to For the different types of coupling listed in Table fault-proneness of a software system (Kafura 1, control coupling and content coupling repre- and Henry, 1981; Selby and Basili, 1991; Troy sent the control flow in the software program. and Zweben, 1981). Furthermore, the fault- Because of the poor design property of control proneness of one module can adversely affect coupling and content coupling, they are rarely the maintenance and evolution of a number used in both structured and object-oriented de- of other modules. Therefore, many software sign methodologies. Especially content cou- pling is not supported by modern programming engineering researchers have suggested that a ++ good software system should have loose cou- languages, such as C and Java. Therefore, pling (say, data coupling) between components this study will not investigate control coupling while strong coupling (say, content coupling) and content coupling. should be avoided as much as possible. The other three types of coupling identified in Moreover, with the increase in the number of ap- Table 1, common, stamp, and data coupling rep- plications using distributed computing the con- resent three different kinds of interactions be- cept of coupling is being extended beyond soft- tween software modules. They are commonly ware modules contained within one program. It used in most modern programming languages. is now also used to represent interactions be- Figure 1 describes the difference among these tween software components in distributed sys- three types of coupling: the interactions be- tems. One such distributed computation frame- tween module m1 and module m2 can be imple- mented via common coupling (a), data coupling work is web services. Loose coupling or low de- ( ) ( ) pendencies between distributed software com- b , or stamp coupling c . ponents indicate the flexibility of updating and reconfiguring services (Kaye, 2003; Erl, 2004). For example, if the server is down, loose cou- pling allows the client component to easily con- nect to a new server component and obtain the same service. Therefore, distributed computa- tion also requires loose coupling between the client and the server components. Hence, from the viewpoint of maintenance and evolution, both software modules within a sys- tem as well as software components distributed over a network should utilize loose coupling in- stead of strong coupling. However, the imple- mentation differences between loose and strong Figure 1. Three different types of coupling between module m1 and module m2: (a) common coupling; (b) coupling might have different effects on system ( ) performance. To our knowledge, very few re- data coupling; and c stamp coupling. search works have been done in this area, to understand the relationship between the issues Common coupling is implemented through global of software coupling and software performance. variables. Because both m1 and m2 can access This research is intended to study this issue by a global variable, the change of the value of building two benchmarks to test the difference the global variable done by one module could in performance of systems implemented with potentially affect another module. Data cou- different types of coupling. pling between m1 and m2 is established through Examining the Relationships between Software Coupling and Software Performance... 3 the function (method) call, in which either a • Conjecture 2: Any integer number greater data value or a data reference (data address or than 5 can be written as the sum of three pointer) is passed between m1 and m2. Stamp prime numbers. coupling between m1 and m2 is achieved if a ( ) In this study, Benchmark 1 implements a pro- record data structure, class is passed between gram to verify Conjecture 1, and Benchmark 2 these modules. We remark here that stamp cou- implements a program to verify Conjecture 2. pling could also be implemented through pass- ( ) The architecture of the benchmarks is shown ing the reference address, pointer of a record. in Figure 2. In each benchmark, three differ- But it is not included in our current study. ent interactions are implemented between the In theory, any of these three types of coupling is Main control module and the Find primes not a unique choice between any two modules in module. In Benchmark 1, the three implementa- a software system. In other words, the same ef- tion are common coupling (pass by global vari- fect of interactions between two modules can be able (GV)), data coupling (pass by data value implemented through either common, data, or (DV)), and data coupling (pass by data refer- stamp coupling. As we discussed before, data ence (DR)). In Benchmark 2, the three imple- coupling is a much looser form of coupling than mentations are common coupling (GV),data stamp coupling, which is in turn, a much looser coupling (DR), and stamp coupling (pass by form than common coupling. Hence, from the data structure – (DS)).TheMain control mod- viewpoint of maintenance and evolution, we can ules can choose any of the three implementa- extrapolate that data coupling is more favored tions to run the experiment. over stamp coupling, which is more favored over common coupling. However, not much knowledge has been obtained with respect to the effect of these different types of coupling on software performance. The objective of this study is to understand how data coupling (pass by data value and pass by data reference), stamp coupling (pass by data structure), and common (pass by