When designing an application, when do you know that your objects are tightly coupled? What are the symptomps of tightly coupled objects/codes?
When designing an application, when do you know that your objects are tightly coupled?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Lets take two objects A & B:
For the sake of simplicity lets asume that A has the following properties
Name: String
Age: Integer
DateOfBirth: DateTime
B has the following method:
CreateInstanceOfA(string Name, Integer Age, Datetime DateOfBirth) and returns an instance of A with its values initialized to the method arguments.
Now, suppose you add a new property to A:
StateCode: string
Now you have a problem. Do you update the CreateInstanceOfA to include the new property? If so, you have to change the code everywhere it’s referenced to include the new field. If your language of choice supports operator overloading you can add a new method. It may not break compilation, but you still have to update the code. Even worse, you would use the old method and would have to manually set the new property after creation.
Son A & B are really tightly coupled.
It’s not the best example but it’s a quick way of seeing the possible ramifications of a change in a design