Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Okay so I am fully aware how spreadsheets manage cells, they build dependency graphs where when one cell changes it tells all the other cells that are dependent on it that it changed. So they can from there update.

How they update I think involves either re-evaluating the formulas stored as strings, or re-evaluating the abstract syntax tree which I think is stored differently and might be faster. Something like that.

What I'm looking to do is manage a few variables in my code so I don't have to update them in the correct way, which would be a nightmare. But I also want it much faster than spreadsheets. And since I'm not looking for any functionality as great as are in these spreadsheets, I just figured from that thought point that there has to be a way to have a very fast implementation of this functionality. Especially since I don't have to modify cells after compiling unless that would be an option.

I'm very new to programming so I have no idea. One example might be to have a code-generator that generates code that does this for me. But I have no clue what the generated code would look like. Specifically, how exactly would variables inform others that they need to update, and what do those variables do to update?

I'm looking for any kind of ideas. Programming is not my job but nonetheless I was hoping to have some kind of system like this that would greatly help me with some stuff. Of course I have been programming plenty lately so I can still program. I just don't have the full scope on things.

I'm looking for any kind of ideas, thank you very much in advance!

Also, please help me with the tags. I know C# and Java mainly and I'm hoping to implement this in either of those languages and I'm hoping this can stay in those tags. Forcing this into some kind of spreadsheet tag wouldn't be accurate.

share|improve this question
I am surprised you can understand the "Observer Pattern" and you are not a programmer! – NoChance Nov 4 '12 at 21:20
up vote 1 down vote accepted

Check out the Observer Pattern.

Some examples in here, and much more can be found with Google.

share|improve this answer
"oh" is pretty much my answer right now. That was simple enough. Thank you! – proGrammar Nov 4 '12 at 21:15
In C#, you don't need any Observer patterns, because it's directly in the language in the form of events. – svick Nov 6 '12 at 18:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.