07.10.2019

Difference Between Coupling And Cohesion In Software Engineering Pdf

Software development is time-consuming and expensive. Under the best circumstances, one goes from an idea to requirements, design, coding, testing, deployment, and then a maintenance phase.

Coupling is a computer program, which is meant for the maintenance of the cohesion, coupling is inversely proportional to cohesion. When coupling and cohesion is combined then it acts as support. The difference between CouplingAndCohesion is a distinction on a process of change, not a static analysis of code's quality. (Apparently was part of 'CIS 311 - Software Engineering' course -- (gone since at least 2003-06-22) but may not be part of lecture.

This is, more or less, the classic software development model. Of course, changing requirements can throw off this entire process.

Difference Between Coupling And Cohesion In Software Engineering Pdf Tutorials Point

EHR vendors are experiencing this first-hand due to changing MU requirements. The threat of obsolescence due to changes in computing technology may also result in new requirements that alter software development cycles.Consider how much computing has changed since 2000. In 2000, the Internet was just beginning to come into its own, and LAN-based client/server was still the next big thing. Creating a complex web application such as a content management system was expensive, and the tools to do so were not that great. Java was five years old, Rails was four years in the future, and.Net was still two years away.

AndDifference Between Coupling And Cohesion In Software Engineering Pdf

Look at how much things have changed in just 12 years. Mobile computing is a fact of life; anybody with a web hosting account can launch a content management system-based website; and the cloud and multi-processing are coming to the forefront of software development.In previous posts, I have discussed basic software design principles that help to address the problem of change. Concepts such as essentially acknowledge change as a constant that must be addressed via development practices and software architecture/design choices. Happily, developing a web application while studying object-oriented analysis and design (OOA&D) has allowed me to see the practical value of these design principles. Cohesion and coupling are my latest discoveries.Couplingis defined as the degree of interdependence between two or more classes, modules, or components. Tight coupling is bad, and loose coupling is good. This will make more sense with an example.Let’s say we have a clinical research application that contains a patient information collection form.

On this form is a field for the SSN. Whenever a patient enrolls in a study, the form checks the SNN to see whether: 1) it is a valid SSN (i.e., fits the pattern 0), and 2) the patient has been a subject in prior studies.

In the current version of the application, when the cursor leaves the SSN field, the following procedure runs.Procedure SSN CheckBeginIf isNumber(LeftThreeChars)ThenResult=0ElseResult =1If isNumber(MiddleTwoChars)ThenResult=0ElseResult =1If isNumber(RightThreeChars)ThenResult=0ElseResult =1If Result=0ThenCount = “SELECT SSNFROM patientsWHERE SocNum=SSN”ElsePrint “This is not a valid SSN”EndThis procedure checks whether each part of the SSN is a number, and if everything is okay, it searches for the SNN in the patients table and returns 1 if the patient has been in a prior study. This type of code is easy (and tempting) to write in form-based development environments.

Difference between coupling and cohesion in software engineering pdf

Why is it bad? The Count query makes a direct call to the database. As a result, the SSN text field is tied directly to the database, exhibiting tight coupling. With one form, this is not a huge problem. However, if the application has multiple forms and more than one requires SSN verification, it might become a headache if the form changes, the database changes, or the query is altered.

Any of these situations could prove to be costly and messy because developers would have to find every place in the application where a SSN check occurred, change the programming code, and test the final application.Cohesionis defined as the degree to which all elements of a module, class, or component work together as a functional unit. High cohesion is good, and low cohesion is bad. The ideal situation is one where a module, class, or component provides only one function or, at most, a very closely related set of functions. Looking at the above procedure, we see that it performs two functions. It validates SSNs, and it performs a database query. These are completely unrelated actions and, thus, the procedure exhibits low cohesion.Improving the DesignMoving unrelated functions into their own units (i.e., module, class, or component) would be a good first-step in improving the design.

One solution would be creating a data access module then placing all database queries for the entire application in one location. Consequently, forms would no longer have to know anything about the database–or even that it exists. Next, we could do the same with validation. Since any real-world application is likely to require validation for a range of form fields (e.g., birthdates, duplicate names, vital signs, etc.) it makes sense to have one component that handles validation as well.Here is the SSN Check procedure after Validation and Data Access modules have been created.Procedure SSN CheckBeginResult =Validate (SSN)If Result=0ThenCount=Databaselookup(SSN)ElsePrint “This is not a valid SSN”EndThe new version of the SSN Check procedure merely passes information to functions in the Validation and Data Access modules. This procedure is now oblivious as to how validation is performed as well as how SSN numbers are stored. Further, new functions can be added to either module without affecting the SSN Check procedure.

The form is now loosely coupled to the database, and the two new components are highly cohesive, each providing a single or closely-related set of functions.