I'll use C# as an example, but it should apply globally. Say I have a string value that should be one of a few constants, but I also want the client to set which string value to use so:
private int foo;
private string bar;
public int Foo {
get { return foo; }
set
{
foo = value;
bar = getStringValueFromDatabase(value);
}
}
public string Bar { get { return bar; } }
I use this technique quite a lot and want to know if it's considered as any formal concept.
Foo
andBar
methods or classes? I'm not very familiar with C#.