VB and C# Developers: A Visibility Best Practice and a Quiz!

   Posted by: Davin Mickelson

Experienced .NET developers know there are five different visibility levels. As a best practice, you should always specify the visibility levels for all custom types and their members. If you decide not to set it or forget, the visibility level will default to a value based on three factors - what it is, the .NET language you are using, and its location.

Java developers aren't allowed to be lazy about this; they must specify the visibility for all types and members. Java does not include default visibility levels, per se. By not using a visibility modifier, Java developers are (in effect) assigning default package level visibility - similar to .NET's internal or Friend visibility levels. The big difference is that this is the only way they can assign this visibility level - by not assigning it at all!

Do you think you know all the default visibility levels for your .NET language? Let's take a quiz! I recommend you take the quiz for both languages because the answers will be different for C# and VB.

The following code examples were created by lazy VB/C# developers. None of the visibility levels were specified; they were defined using default values. What are they?

Here is the C# example:

class Greet
{
event EventHandler GreetCreated;

class Inner
{
class InnerChild { }
}

enum Honorific
{
Miss,
Mr,
Mrs,
Ms
}

string sName = string.Empty;

string Hello(string fullname, Honorific hon)
{
sName = fullname;
if (GreetCreated != null)
GreetCreated(this, new EventArgs());
return string.Format("Hello, {0}. {1}!", hon, sName);
}
}

Pick from the following five answers for the following questions:
A. public
B. protected internal
C. protected
D. internal
E. private

CS1. What is the visibility of the Greet class?
CS2. What is the visibility of the GreetCreated event?
CS3. What is the visibility of the Inner class?
CS4. What is the visibility of the InnerChild class?
CS5. What is the visibility of the Honorific enum?
CS6. What is the visibility of the sName field?
CS7. What is the visibility of the Hello method?

Here is the VB example:

Class Greet
Event GreetCreated()

Class Inner
Class InnerChild
End Class
End Class

Enum Honorific
Miss
Mr
Mrs
Ms
End Enum

Dim sName As String = String.Empty

Function Hello(ByVal fullname As String,
ByVal hon As Honorific) As String
sName = fullname
RaiseEvent GreetCreated()
Return String.Format("Hello, {0}. {1}!", hon, sName)
End Function
End Class

Pick from the following five answers for the following questions:
A. Public
B. Protected Friend
C. Protected
D. Friend
E. Private

VB1. What is the visibility of the Greet class?
VB2. What is the visibility of the GreetCreated event?
VB3. What is the visibility of the Inner class?
VB4. What is the visibility of the InnerChild class?
VB5. What is the visibility of the Honorific enum?
VB6. What is the visibility of the sName field?
VB7. What is the visibility of the Hello method?

Check your answers against the key at the bottom of this post.

If you answered all the questions correctly - good job! Kudos to you. You have all the default visibility settings memorized. Question: would everyone else on your development and support teams (now and in the future) pass this quiz just as easily?

If you didn't get 100%, trust me, you're not alone. This proves why setting explicit visibility should be required. By comparing the differences in default visibility between C# and VB, it seems quite obvious that it is especially important in VB. To make things worse, as you add new code files (for example, classes) to your projects, the starter code does not include any visibility settings in new code files.

Best Practice:
Always specify the visibility for all types and members that you declare.

Answer Key:
CS1. D, CS2. E, CS3. E, CS4. E, CS5. E, CS6. E, CS7. E
VB1. D, VB2. A, VB3. A, VB4. A, VB5. A, VB6. E, VB7. A

**NOTE: Please rate this post's usefulness by clicking on the number of stars it deserves below. Thank you!

Changes to the Microsoft Certification Program

   Posted by: Davin Mickelson

As always, Microsoft continues to improve their certification program to increase its legitimacy in the computer industry. They continue to offer new certification exams for the latest Microsoft technologies. They also retire older exams for unsupported products. An earned certification title may help a potential employee get a first interview. Microsoft's partners use their employees' certifications to prove their relevance to the partner program as well as to demonstrate their cutting edge skills to their customers.

Recently Microsoft has implemented some new changes, such as:
-    An updated certification transcript
-    Every certification title will have a serial number
-    Every certification title will have an "Inactive" date
-    Exam cost is increasing

The latest update you may have noticed while looking at your certification transcript (https://mcp.microsoft.com/mcp/) is that the page has been updated to now include color with a much nicer layout of the earned titles and passed exams. It it easier to read and is much more professional looking.

As well, Microsoft's latest step to increase the relevance of their certification program is by getting their certification program certified. Yes - Microsoft is working to make their certification program ISO/IEC 17024 compliant. Learn more about it here: http://www.iso.org/iso/pressrelease.htm?refid=Ref847

What does this mean to folks who are working on or have achieved Microsoft certifications? To be compliant with the ISO program, each earned designation must be assigned a certification number. This is fine; it seems to make the transcripts look more professional. However, it also requires each of the hard earned certifications to come with an "Inactive Date."

The Inactive date field is not a decertification date but rather a note to potential employers, partners, and customers that the certification title is still valid yet holds much less relevance in today's IT market. The Inactive date of a title is based on the Microsoft product life cycles and their support dates.

If two newer versions of a product (for example, Windows Server 2000, 2003, 2008) already exist, then it comes down to the mainstream and extended support ending dates. You can look up the support life cycle of any Microsoft product you may be certified in here: http://support.microsoft.com/lifecycle/

This new rule has become highly controversial amongst IT professionals. The word, Inactive, hardly seems to denote less significance but rather seems to indicate Decertification instead, which Microsoft promises that it certainly does not. Questions are raised such as, "Why study for hours and spend $125 to attempt and hopefully pass a Microsoft exam to only have that certification be marked as inactive in a few years?" As a certified professional myself, I'd like to see Microsoft pull out their thesaurus (Shift-F7 in Word) and come up with a better term. Interestingly, Microsoft will at least also allow us to decide which certification titles/exams to display on the transcript sharing site.

This brings us to the last update - the increased price. Starting July 1st, 2011, Microsoft is increasing their exam costs to $150.00 per attempt in the United States. In other countries, the increase will be higher or lower. I remember when Microsoft last increased the exam cost in the late '90s from $100 to $125 with their only reason being "All other companies are increasing their exam cost to $125 so I guess we will as well." Learn more here: http://www.microsoft.com/learning/cert-pricing/

So what do you think? Is Microsoft increasing the relevancy of their certifications by adding the Inactive date and by increasing exam costs? Would a potential employer read the term inactive as "a seasoned veteran" or someone who is "behind the times?" Will more or less people pursue certification? Please let us know what you think and thank you for reading. Good luck on your certifications goals.

Find Us
Contact Us 651-288-7000 1-800-866-9884
Home | Training | Curriculum | Course Finder | Schedule | Enroll | Twin Cities Java User Group | Consulting | Foundation | Jobs | About Us | Our Story | Press Room | Instructors | President | Map & Directions | Sitemap

Java Training | JSF / Struts / Spring / Hibernate Training | Java Power Tools Training | .NET 4.0 & Visual Studio 2010 Training | Microsoft Web Development Training | Prism / MVVM / MEF Training | .NET 3.5 and Visual Studio 2008 Training | .NET 2.0 and Visual Studio 2003 Training | Cloud Computing Training | Ajax / Web Services / XML Training | Groovy and Grails Training | SQL Server 2012 Training | SQL Server 2008 Training | SQL Server 2005 Training | Mobile Development Training | SharePoint 2010 Training | SharePoint 2007 Training | Agile, Process, Analysis & Design Training | Arch/Design Patterns Training | Microsoft Official Curriculum Training | Web Development Training | Ruby Training | Rational Application Developer (RAD) Training | WebSphere Application Server Training | WebSphere Portal Training | WebLogic Training | Boot Camp Training | Project Management Training | C / C++ Training | Metro / WinRT / Windows 8 Development Training | Retired

Intertech delivers training on-site and virtually serving cities including Phoenix, AZ | San Francisco, CA | Los Angeles, CA | San Diego, CA | San Jose, CA | Washington, DC | Chicago, IL | Orlando, FL | Boston, MA | Duluth, MN | Minneapolis St. Paul, MN | Rochester, MN | Raleigh-Durham, NC | New York, NY | Philadelphia, PA | Austin, TX | Dallas, TX | Houston, TX | Seattle, WA.