Auto Implemented Properties in .Net Framework 4.0 (Visual Basic 10)

A lot of buzz has been created by Microsoft about .Net Framework 4.0. As a VB developer, I also looking into VB10 features. In fact I was presented in one of the local Technet/MSDN event recently. Nowadays, productivity always a key to most software development team. I came across this feature known as “auto implemented” feature in VB10 that really  reduce 83% of the code compare with existing properties code in VB.net

Existing properties code

 

Auto implemented properties code in .Net 4.0

However, personally I feel that this feature has drive negative effect to certain developers especially the junior developer. It is because it doesn’t promote one of the Object Oriented Programming (OOP) practice – Encapsulation

If we want to implement Encapsulation in the Company properties, only the traditional way allows

For readers, please use the auto-implemented properties carefully. Make sure the new features of .Net 4.0 doesn’t affect your good practice of OOP.

For those properties that receive value directly. It should be fine. Anyway you still can use back the traditional properties code.

Advertisements

Leave a comment

Filed under Uncategorized

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