• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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...
 
reply
    Bookmark Topic Watch Topic
  • New Topic