Public keyword as your enemy …

If you’re class library developer developing types that will be used by other developers, you have a huge responsibility.

You’re trying to design the types which will be used by wide variety of applications. Remember that you don’t know which code is calling you. It’s not feasible to anticipate every situation in which your type will be used, so every public class, method or whatever you have in code makes the contract which means:

– lot of external code lines invoking that

– the need backward compatibility

– validation for any invalid input

– the need for documentation

– and even more

To simplify, that just means the public keyword is producing the cost. If you could deliver the same functionality with smaller cost (less public keywords in your code), then it is better for you…

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s