Monday, August 16, 2010

Stuffing Code in Property (C#)

It is not very unusual to see lot of code manipulating different thing in Set/Get methods of a property. From my point of view it is not a good practice. My reasons are

1) Loosing Readability: Code must be readable for easy maintainability and extendability. If you hide some complex code behind the set/get method the programmer who is trying to figure out some bug may waste long time with out knowing about the hidden code.
2) Other programmers may call this functions with out knowing about the heavy process hide behind the set method. This can degrade the performance of the application.

No comments: