• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

examples for tight coupling.... plz

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Can you please give me a few tips or examples on what coding may cause tight coupling...

What should I be looking at to tell if a design is loosely or tightly coupled?


Also,




What makes the lines marked T, to be factors that casuse these classes to be tightly coupled?
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,

here we don't have only tight coupling but also bad encapsulation.

The adjusted/salesRate variables in the second class are public. So the first class can access it directly (first T).
What is really bad (tight) coupling, is that the classes interact too closely. The second class sets its salesRate variable using the doColorado method of the first class where the same salesRate variable is used.

Generally the classes should know of each other as little as possible, therefore all this access modifiers.




Something else, Vishwa nath.K, there is a certain policy about user names in the Java Ranch, see:
http://www.javaranch.com/name.jsp

On this page is also a link, where you can change your user name, so please do this.



Yours,
Bu.
 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks.

But I still have only a vague understanding with respect to the why we say
salesRate=new DoTaxes().doColarado();

causes tight coupling.

Can you explain that a bit more...
 
this llama doesn't want your drama, he just wants this tiny ad for his mama
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic