You are on page 1of 7
Chegg Find answers in our Expert Q&A Related Topics Vv Learn / Computer Science / Stamp Coupling Stamp Coupling Stamp Coupling Definition Stamp coupling happens when the modules of a program communicate among themselves using a composite data structure. The composite data structures can be arrays, structures, unions, etc. The parameters that are passed between the modules through a composite data structure may or not be fully used by the receiving module. Overview of Stamp Coupling Stamp coupling is a form of coupling in software engineering. The measure of dependencies that exists between two modules of a software program is called coupling. Depending on the measure of dependencies, coupling can be tight or loose. If the degree of dependencies in the program modules is higher, the coupling is said to be tight coupling. If the degree of dependencies is lesser in the program modules, the coupling is said to be loose. A software program is considered good software if it possesses loose coupling. Having loosely coupled modules will ensure that each module solves a definite purpose. A loosely coupled module will be least dependent over the other modules of the program. When many modules of a software program share and communicate Chegg One of the major applications of stamp coupling is that it is most commonly used in procedure- oriented and object-oriented software programming. Got a question on this topic? Find answers in our Expert Q&A What you'll leari Stamp Coupling Definition Overview of Stamp Coupling Examples of Stamp Coupling <6 Advantages and Disadvantages of Stamp Coupling Examples of Stamp Coupling Example 1 The stamp coupling concept can be explained well with the help of a pseudo code example. Given below are the pseudo codes for two modules, A and B, that belong to a same program. Pseudo code for module A Chegg process Ist_year _student _(current record) ELSE process 2nd_year _student _(current record) ENDIF Pseudo code for module B process_1st_year_student(current_record) increment (1st_year_student_count) If student_age >20 THEN increment (mature_1st_ year_student_count) ENDIF END In this example the (currentrecord) is a composite data structure that has the student information (both first and second year). If module A gets marks recorded of a first-year student, it passes the entire structure to module B, thereby establishing stamp coupling. Module B receives the (current record). The (current record) will have all the information for first year students like name, address, roll number, marks, age and blood group. In spite of receiving the entire structure (current record) many parameters in it, module B just increases the first-year student count and uses only one parameter, which is age of the students. Module B checks whether the age of a first-year student is greater than 20 and does not use the other parameters that were received from module A, thus making the stamp coupling concept evident. Example 2 In this example, let us consider a real time situation that could explain stamp coupling. Consider a person, Mr. Harry, who needs to send chocolates to his friend, Mr. Tom. Mr. Harry chooses a parcel service vendor to deliver the chocolates to Mr. Tom. The transporter shall accept only plastic box packages and the minimum weight of the plastic box must be 10 kilograms. These are the terms and conditions of the parcel service vendor. Now, Mr. Harry purchases the plastic box and fills it dark chocolate, milk chocolate and almond chocolates, ensuring that the weight of the plastic box weighs 10 kilograms. The transporter carries the plastic box and delivers it to Mr. Tom. Upon Chegg © In this example, the plastic box that is used to carry 10 kilograms of chocolate is the composite data structure. The plastic box in this example becomes the composite data structure because it has a stipulated format that the box must be plastic and it must weigh 10 kilograms. This can be similarly related in programming language terms. The composite data structure that can be used in programming languages are arrays, structures, unions, etc. © Mr. Harry and Mr. Tom are the two programming modules that get stamp coupled with each other. © Mr. Tom only needed milk chocolates and does not consume all the chocolates supplied. In stamp coupling, it is not compulsory that the receiving module must use all the parameters in the data structure. © Stamp coupling occurs when the data structure is passed between two modules and the concept becomes evident with this example. Advantages and Disadvantages of Stamp Coupling Although an entire composite data structure gets passed between modules to establish stamp coupling, this concept has several advantages and disadvantages. Advantages © Stamp coupling enables the programmer to pass an entire data structure from one module to another. © Stamp coupling reduces the usage of interfaces in a program as all the relevant data needed are passed through the data structure itself. Disadvantages © Since many parameters are passed between modules and only a few parameters are used by the receiver, stamp coupling creates bundles of unrelated data that remain together inside a data structure. © Bundling also increases the coupling between the modules, which is not advisable for a good software program. Chegg © Changes made on one module will have an impact on the dependent modules as well Module Coupling Control Coupling Pseudocode ‘Common Coupling ‘Communicational Cohesion Data Coupling Module Cohesion Logical Cohesion COMPANY LEGAL & POLICIES CHEGG PRODUCTS AND SERVICES CHEGG NETWORK CUSTOMER SERVICE = Chegg (© 2003-2022 Chegg Inc. All rights reserved.

You might also like