What if globals make sense?

Posted by Greg on Programmers See other posts from Programmers or by Greg
Published on 2012-07-09T23:40:14Z Indexed on 2012/07/10 3:22 UTC
Read the original article Hit count: 243

I've got a value that many objects need. For example, a financial application with different investments as objects, and most of them need the current interest rate.

I was hoping to encapsulate my "financial environment" as an object, with the interest rate as a property. But, sibling objects that need that value can't get to it.

So how do I share values among many objects without over-coupling my design? Obviously I'm thinking about this wrong.

© Programmers or respective owner

Related posts about object-oriented

Related posts about beginner-programmer