Questions tagged [tightly-coupled-code]

44 questions
43
votes
7 answers

Game Objects Talking To Each Other

What is a good way of dealing with objects and having them talk to each other? Up until now all my games hobby/student have been small so this problem was generally solved in a rather ugly way, which lead to tight integration and circular…
user245019
30
votes
13 answers

Is it worth trying to write tests for the most tightly coupled site in the world?

Imagine that 90% of your job is merely to triage issues on a very massive, very broken website. Imagine that this website is written in the most tightly coupled, least cohesive PHP code you've ever seen, the type of code that would add the original…
Chris Bloom
  • 3,526
  • 1
  • 33
  • 47
9
votes
2 answers

Avoiding magic numbers without creating dependencies

I'm creating an error manager for an API I'm work on. The idea is that it provides a single store of error codes that can be returned from the API, ensuring that the same error in different calls is handled in the same way (e.g. required value…
Dan
  • 2,212
  • 20
  • 29
5
votes
1 answer

When is tight coupling essential or a good thing?

From all my readings and research on OO design/patterns/principles I've found that the general consensus is that loose coupling (and high cohesion) is the almost always the better design. I completely agree speaking from my past software project…
Nah
  • 331
  • 2
  • 9
4
votes
5 answers

Software testing for a bare-metal system

I am writing a project in C++ for an embedded system with no OS support; almost no library support. Very bare-metal. Hence, a fair amount of my code is tightly coupled(e.g., software triggered interrupts and the layer directly above them). Part of…
Paul Nathan
  • 39,638
  • 28
  • 112
  • 212
2
votes
5 answers

Help with debate on Separation of concerns (Data Access vs Business Logic)

I had a debate with my co-worker on whether certain logic belongs in the data access or business logic layer. The scenario is, the BLL needs some data to work with. That data primarily lives in the database. We want to cache that data (using…
2
votes
1 answer

Simulate a coupled ordinary differential equation

I want to write a program which turns a 2nd order differential equation into two ordinary differential equations but I don't know how I can do that in Python. I am getting lots of errors, please help in writing the code correctly. from…
2
votes
1 answer

Can tight coupling also include interface?

I am writing code to create a simple game, but I am not sure that this part is tightly coupled or not(high coupling): There is an interface called GameEngine in which it controls the flow of the game. And there is a class called GameEngineImpl that…
2
votes
1 answer

Is it acceptable for a class to have its properties used ONLY by the outside environment?

Sometimes we run into a problem where a class doesn't need to use its own properties. See approach A: struct Ball { double mass = 1; double x = 0; double y = 0; }; struct World { std::vector balls; void run_physics() { …
Liakos
  • 512
  • 5
  • 10
2
votes
1 answer

How to create a loose coupling between parts of a project?

Introduction: I come from a mechanical engineering background, but took a class in embedded software programming (on a lovely little robot) with the intention of improving some skills I had in programming already. However, the class was largely…
Sanchises
  • 847
  • 4
  • 22
2
votes
2 answers

loose coupling related to composition

After searching different forums related to tight coupling (when a group of classes are highly dependent on one another) Example1 class CustomerRepository { private readonly Database database; public…
Ali
  • 557
  • 1
  • 9
  • 30
2
votes
1 answer

using factory pattern and tight coupling

I'm thinking to use a factory pattern to create different objects. But I'm a bit confuse if creating objects inside another class via factory pattern make tightly coupled or not. For example: class CarFactory { public static function…
agthumoe
  • 119
  • 1
  • 11
2
votes
1 answer

Nsubstitute intercept hard dependency

I am unit testing legacy code and I am dealing with a class that instantiates another class. I believe this is testable using Microsoft Fakes, but am wondering if NSubstitute has the capability. I believe the answer is no, but need to be sure. …
Jon
  • 53
  • 7
1
vote
2 answers

Open sql connection in business service

Do you see it as tight coupling that my business service class opens a SqlConnection ? Actually a business service should not be aware of the concrete dataprovider?! public class UnitService: public void DeleteUnit(Unit unit) { …
Pascal
  • 12,265
  • 25
  • 103
  • 195
1
vote
2 answers

Tightly Coupled classes: what is better design in my situation

what is the better solution in my situation, how to design classes so they are not very coupled? I have an Library (API) which provides some functionality (for example, subscribe for streaming FX prices with subscribe method). I have an API client,…
vmg
  • 9,920
  • 13
  • 61
  • 90
1
2 3