Timeline for What is the right understanding for cohesion and coupling?
Current License: CC BY-SA 4.0
18 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 11, 2024 at 9:08 | vote | accept | SuperJumbo | ||
| Mar 10, 2024 at 23:08 | comment | added | candied_orange | @SuperJumbo it's considered bad form to make changes to the question that invalidate answers. | |
| Mar 10, 2024 at 11:22 | comment | added | SuperJumbo | Funnily enough I thought the examples were about business logic, but it's really about noticing the SQL/ConfigurationManager deps isn't it - the business logic is already a module of it's own and could easily be tested. It's the other stuff that's not modularised which at the moment isn't readily reusable. Maybe the example would make a better point if the business processing were also inline to begin with... | |
| Mar 10, 2024 at 10:35 | history | edited | SuperJumbo | CC BY-SA 4.0 | The first code snippet was incorrect |
| Mar 9, 2024 at 22:48 | comment | added | Steve | @BenCottrell, I find as well that the structure may be wrong if manual tests and debugging are found to be unduly difficult. Other branches of engineering have their inspection ports for taking gas samples and pressure readings, and their test points for applying electrical multimeters. A common error in software design is "stovepiping", where there are too few interception points which allow different parts or stages to be verified separately. This impairs "testability", whether those tests ultimately be manual or automatic. | |
| Mar 9, 2024 at 22:09 | answer | added | Filip Milovanović | timeline score: 2 | |
| Mar 9, 2024 at 21:01 | history | became hot network question | |||
| Mar 9, 2024 at 20:26 | answer | added | candied_orange | timeline score: 2 | |
| Mar 9, 2024 at 18:36 | comment | added | Ben Cottrell | I think one of the most useful questions to ask when thinking about the structure of code would be "How easily can I write automated tests for this?". If developers are having a hard time writing good tests, then it almost certainly means the structure of that code is wrong somehow. On the other hand, if developers are having a really easy time writing good tests, then refactoring is unnecessary. Your users and stakeholders do care about a working, robust, effective solution; which is where tests are important. They don't care about the structure of its source code. | |
| Mar 9, 2024 at 18:11 | comment | added | Ben Cottrell | Cohesion and Coupling are context-dependent. Furthermore, they are are not goals nor objectives in themselves; merely a means to an end. Your end goals are always important; the methods you choose to get there far less so. Ultimately you should focus on delivering solutions that you and your users/stakeholders have sufficient confidence in. With that in mind, the question here is really irrelevant; Focus your effort on testing instead; as the quality and coverage of your tests are a far more clear-cut and effective way of ensuring your code is maintainable for future programmers. | |
| Mar 9, 2024 at 16:57 | review | Close votes | |||
| Mar 14, 2024 at 3:08 | |||||
| Mar 9, 2024 at 15:17 | comment | added | Bert | Your refactored code still instantiates a DataServer2 object and is therefore tightly coupled. There are different types of dependencies. Data sources (file system, network, data base etc.) are one type of dependency where it's valuable to decouple from, replacing it by an interface for which you can inject a concrete implementation. This helps with testing but of course also allows to replace it with little effort later in production. | |
| Mar 9, 2024 at 13:59 | answer | added | Steve | timeline score: 2 | |
| Mar 9, 2024 at 11:45 | answer | added | Ewan | timeline score: -1 | |
| Mar 9, 2024 at 11:43 | answer | added | Kilian Foth | timeline score: 2 | |
| Mar 9, 2024 at 11:37 | history | edited | Kilian Foth | CC BY-SA 4.0 | added 1 character in body |
| S Mar 9, 2024 at 11:30 | review | First questions | |||
| Mar 9, 2024 at 11:52 | |||||
| S Mar 9, 2024 at 11:30 | history | asked | SuperJumbo | CC BY-SA 4.0 |