Hello there freaks & geeks. Here comes my question again, thanks for helping!.
Lets suppose i have an object Foo, which method foo() does about 100 lines.
foo() { ... qwert yuiop asdfg zxcvb nmhjk ... }
If a developer wants to add some code to foo(), it can be easily done with inheritance, composing or a Decorator Pattern.
But in the case he wants to modify "one line" in the middle of the code (changing a property value, invoking a method before something...), whats the best way to do it?
foo2() { ... qwert yuiop ASDFG zxcvb nmhjk ... }
The goal is to let the original developer to define a behavior without worriying about what others will modify/change.
The new developer should be able to change the object/method/property without retyping the code.
Inserting breaks or predefining steps with callbacks/listeners or dividing the code into smaller pieces is not the desired option, cause it involves the first developer, which is sleeping. :P
What about a commit environment where the changes made to the object need a commit to apply? foo() does normal, then foo2 just change the desired properties and make commit.
Any other alternatives?
Thanks!