views:

73

answers:

3

My boss regards himself as a OOP Guru where as I consider him as a hobbyist programmer. He handles our Sage development, adding custom requirements to our clients Sage installations. He recently has got very excited by reflection, he is reflecting on Sage's assemblies in code and changing private members and event handlers. I thought this was not a good idea but he shot me down stating that Sage thought he was amazing that he could do it. I believed that this was bad practice because it was inefficient and because if they change their implementation at any point our code could collapse. I mean usually a developer has made something private for a reason right?

What's the general rule regarding this?

Many Thanks and apologies if this seems like a stupid question.

Paul

+3  A: 

You are right. If you depend on implementation details of 3rd party library, you better be ready to rewrite everything when 3rd party library is updated and for the unexpected side effects when you change some private variable with some "innocent" value.

The answer is do it only if you 100% sure in what you are doing and you a ready to face the consequences.

Alex Reitbort
+2  A: 

You shouldn't modify existing assemblies - the results are likely to be unknown and definately not supported by the assembly vendor. Also, such changes will lose the assembly signing that guarentees the assembly is the version shipped by the vendor.

Basically, anything could happen, so unless you're willing to do very rigorous testing, with no vendor support to fall back on, stay well away!

thecoop
+1  A: 

Each new version of an assembly can have a completely different implementation. A software update from Sage could completely invalidate your Boss's code, and would require completely redevelopment to re-establish the same functionality.

For a real example: StringBuilder in .NET 3.5 used a string internally, in .NET 4 it uses a char[] see this recent question.)

Richard
Thanks for th reply and the link to the other post, learnt something else today :)
Paulie Waulie