Questions tagged [cohesion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
2 answers
123 views

Performance hit after non-functional refactoring

I was asked to refactor some C++ code recently for the purposes of increasing unit testing coverage. The problem was that the code was tightly coupled on one compilation unit, so we had the equivalent ...
user avatar
1 vote
2 answers
113 views

How to maintain cohesion, loose coupling, and SRP when building a reporting tool?

I'm building a reporting tool with three core layers: Extract data from a database Transform this data to compute business metrics Display these metrics in a report (a heavily formatted Excel export ...
user avatar
  • 119
2 votes
0 answers
100 views

Cohesion and coupling possible combination in software

I know what we mean by cohesion and coupling in software. And generally the best practice is to achieve high cohesion with low coupling. It seems to me though that they are inter-related. I.e. you ...
user avatar
  • 297
1 vote
1 answer
180 views

Avoiding coupling through code sharing

I have been working on an application which consists of several cohesive services, Customer, Invoice, PurchaseOrder, Highlight, the application is deployed within a mono repo and each service is ...
user avatar
  • 113
0 votes
2 answers
155 views

About coupling and cohesion

At the end of this discussion about coupling and cohesion https://www.youtube.com/watch?v=hd0v72pD1MI some renowned programmers agreed in the general thought that to achieve high cohesion you have to ...
user avatar
-2 votes
1 answer
107 views

Achieving loose coupling

My scenario involves the following classes: I have three types of Peer that creates a RegistryType instance because its methods are needed. Same for Identity class. Each PeerType need 0 or all the ...
user avatar
-1 votes
1 answer
160 views

New frontend for legacy code

How would you engineer this: You have a legacy application that is a big ball of mud and a monolith. This application is "impossible" to change to look good on mobile devices. The management ...
user avatar
  • 59
2 votes
2 answers
129 views

Use old legacy application code from new application

If you have a big legacy application (big ball of mud), lets call it MudApp. If you then create a new application to make us of new technology and to make a new good looking frontend because that was ...
user avatar
  • 59
1 vote
4 answers
260 views

Is there multiple definitions for responsibility of class?

In the book UML 2 and the Unified Process from Arlow and Neustadt has been told: Analysis classes should have 3 to 5 responsibilities But as you know we have the SRP that tells us something else!! ...
user avatar
-4 votes
1 answer
684 views

What is informational cohesion?

I try to understand what cohesion means when designing modules. Myers states in his book "Composite structured design": An informational-strength module has the following definition: It ...
user avatar
5 votes
1 answer
2k views

Concept of functional cohesion

I made some research to better understand the concept of functional cohesion. Myers in his book "Composite structured design" has written about functional cohesion: A functional-strength module is ...
user avatar
0 votes
1 answer
51 views

Directed Graphs

Conisder the following piece of code : cin >> a >> b; int x,y,z; x=0; y=1; z=1; if (a > b){ x = a*b; while (10 > a){ y=y+z; a=a+5; } else { x=x+b; } Its Directed graph is shown ...
user avatar
2 votes
0 answers
145 views

Packages, a controller class, and coupling vs cohesion

So I'm building my first application, in Python, and some issues have cropped up because of the lack of interfaces (I.e. explicit type declaration) My design involves several homebrew packages, and I'...
user avatar
5 votes
1 answer
757 views

Tight class cohesion metric, all or just public methods?

I am researching cohesion topic and found out that some claim TCC metric should only include public methods, some other sources claim all methods. Would it be wrong to use either approach? Why private ...
user avatar
  • 4,878
1 vote
1 answer
85 views

How to implement a large algorithm with mostly unrelated steps while maintaining cohesion

I want to implement something similar to the algorithm described here. I don't even know if "algorithm" is the right word, since many of the steps are considered to be algorithms themselves. What I've ...
user avatar
0 votes
1 answer
112 views

Packages : opposing forces of reusability and developability

In choosing the classes to group together into packages, we must consider the opposing forces involved in reusability and developability. Balancing these forces with the needs of the application ...
user avatar
  • 1,673
2 votes
6 answers
501 views

Object Design & Cohesion - Issue & potential refactoring

Abstract I have been trying to get my head around the cohesiveness of some functionality in our code base. I’ve approached this design in different ways, and lately I’m convinced that I took the ...
user avatar
  • 133
4 votes
1 answer
1k views

What is the evidence that an API has exceeded its orthogonality in the context of types?

Wikipedia defines software orthogonality as: orthogonality in a programming language means that a relatively small set of primitive constructs can be combined in a relatively small number of ways ...
user avatar
  • 4,761
10 votes
6 answers
3k views

Fields vs method arguments [closed]

I just started writing some new class and it occurred to me that I was adding a lot of method arguments that are not strictly needed. This is following a habit to avoid having state in classes that is ...
user avatar
6 votes
2 answers
1k views

Does increasing the number of classes increase code complexity? [duplicate]

To illustrate the question, let's say we have two programmers of comparable skill that both solve the same problem. The code they turn out has roughly the same lines of code, but one programmer uses 5 ...
user avatar
  • 1,603
3 votes
3 answers
2k views

Programming by Intention, Depth-First or Breadth-First?

Say I have the following graph of dependencies between procedures/functions/methods: o / \ v e / \ / \ r f l w That is, function o first calls function v, and then ...
user avatar
  • 6,834
4 votes
7 answers
4k views

What's the opposite of cohesive?

I was talking with my architect about some concerns with a particular approach that may result in very low level of cohesion in a set of classes. However, I couldn't think of the word that represents ...
user avatar
11 votes
3 answers
9k views

What is logical cohesion, and why is it bad or undesirable?

From the c2wiki page on coupling & cohesion: Cohesion (interdependency within module) strength/level names : (from worse to better, high cohesion is good) Coincidental Cohesion : (...
user avatar
6 votes
3 answers
5k views

Low Coupling: Single Responsibility Principle vs Cohesion

I've read several articles on SRP and cohesion, and they seem to contradict each other as far as low coupling is concerned. Articles on cohesion argue that putting closely related responsibilities ...
user avatar
  • 1,091
36 votes
9 answers
10k views

How to determine if a class meets the single responsibility principle?

The Single Responsibility Principle is based on the high cohesion principle. The difference between the two is that a highly cohesive classes features a set of responsibilities that are strongly ...
user avatar
  • 1,091