Archive for October, 2007
Here’s installment #6 of my VB.NET interview questions series.
Previous Installments: #1, #2, #3, #4 , #5
Feel free to add a comment with your answers. Try to answer them before looking at the comments or searching MSDN or Google for an extra challenge.
True Or False
1. Base-class constructors are not inherited by derived classes.
2. A class may only implement a single interface.
3. A checkbox may have either a square or circular appearance.
4. HttpSessionState can only store string values.
5. A page object’s IsPostBack property is used to determine if the page is being loaded due to a postback.
General VB.NET Questions
1. Should you throw exceptions in the Finally block? Why or why not?
2. How do you create a scrolling region on a form?
3. What are some differences between CType and DirectCast?
4. Should you use a "sp_" prefix on SQL Server stored procedures? Why or why not?
5. If you have an ASP.NET application with a Master Page how can you change meta data from child pages?
Tough General Interview Questions
1. How do you think your previous experience will help you perform your work here?
2. Would you say that you’re a competitive person? Why or why not?
3. Why did you decided to get a degree in [job candidates college major]?
4. Why do you want to work at [insert company name here]?
5. Give an example of how you applied creativity in your current/former job?
Open Ended Questions
1. Describe what you consider to be best practices for creating a testing environment.
2. You are given the task of developing an interface to a vendor’s web service. The documentation is very minimal for it and may be outdated. What approach would you take to developing this interface?
Have fun with these and let me know what you think about them by leaving a comment or answering the questions.
Share This Article:
These icons link to social bookmarking sites where readers can share and discover new web pages.
October 28th, 2007
One problem some programmers new to VB.NET and object oriented programming in general have is understanding interfaces and how they related to classes. In this article, we’ll take an introductory look at interfaces and some of the ways you can use them in your VB.NET applications.
What is an Interface?
To put it in simple terms, an interface is a definition of methods and properties. Sometimes this is referred to as a ‘contract’. If a class agrees to implement an interface it must implement all of the properties and methods defined.
One difference you’ll see in an interface vs. a class is that there is no code, only the templates, aka contracts, for the properties and methods. You’ll also notice that there is no access level defined. It’s always considered public.
Here’s an example interface:
Public Interface IPerson
Property ID() As Integer
Property FirstName() As String
Property LastName() As String
End Interface
This means that if a class implements the IPerson interface it will have to implement these routines. Here’s an example of a class implementing this interface:
Public Class Customer Implements IPerson
Protected _id As Integer
Protected _firstName As String Protected _middleName As String
Protected _lastName As String
Public Property ID() As Integer Implements IPerson.ID
Get
Return _id
End Get
Set(ByVal value As Integer)
_id = value
End Set
End Property
Public Property FirstName() As String Implements IPerson.FirstName
Get
Return _firstName
End Get
Set(ByVal value As String)
_firstName = value
End Set
End Property
Public Property MiddleName() As String
Get
Return _middleName
End Get
Set(ByVal value As String)
_middleName = value
End Set
End Property
Public Property LastName() As String Implements IPerson.LastName
Get
Return _lastName
End Get
Set(ByVal value As String)
_lastName = value
End Set
End PropertyEnd Class
As you can see, each of the properties above, except for MiddleName, has an Implements statement that defines how it will fulfill the Interface contract. The rule is that you can add to the interface inside the implementing class but you can’t take away.
Remember that implementing an interface isn’t the same as creating an instance of a class or creating a subclass. All you’re doing is defining how the external interface should look, not what goes on inside. People do get confused over that point.
Coding Interfaces
Interfaces can be very simple or complex. Most current OOP thought suggests that interfaces be limited to a single method. For example, you might have an IUpdate interface that defines a single Update function and you might have another interface called ICreate that defines a single Create function. You would then combine them into classes that needed to implement them, as in this example:
Public Interface ICreate
Function CreateNew(ByVal id As Integer) As Boolean
End Interface
Public Interface IUpdate
Function Update(ByVal id As Integer) As Boolean
End Interface
Public Class Customer
Implements IPerson, IUpdate, ICreate
As you can see, a class can implement multiple interfaces. Whether it’s better to design with a lot of different interfaces or to group them into logical sections is really up to your own needs. My own take is a bit of a compromise in that I keep them simple with just a few tightly related methods or properties but I don’t religiously limit each interface to a single item.
Another use for interfaces is in defining a common interface for a plug-in architecture as I mentioned in this previous article: How To Create Application Plug-ins In VB.NET. In this case, you will want to have a more complex interface design in most cases since your main app will need a stronger connection to the plug-in.
Do you have any questions about using Interfaces in VB.NET? Please feel free to leave a comment and ask about it.
Share This Article:
These icons link to social bookmarking sites where readers can share and discover new web pages.
October 23rd, 2007
Here’s installment #5 of my VB.NET interview questions series.
Previous Installments: VB.NET Interview Questions #1, VB.NET Interview Questions #2, VB.NET Interview Questions #3, VB.NET Interview Questions #4
Feel free to add a comment with your answers. Try to answer them before looking at the comments or searching MSDN or Google for an extra challenge.
True Or False
1. You can access variables declared in the Try block inside the corresponding Catch handler.
2. You don’t need to specify a default value for an optional parameter.
3. When updating a bound control, you should call a DataSet’s Clear method before calling the DataAdapter’s Fill method.
4. When a web form is ready for garbage collection the Unload event is raised.
5. The AdRotator control can be bound to a database table.
General VB.NET Questions
1. Explain the 3 basic tiers found in a well designed web application.
2. Explain the difference between TCP, UDP, and HTTP data transmissions.
3. When would you want to use "Attach To Process" to debug a .NET application?
4. Describe how you would go about validating a social security number entered by a user.
5. Describe methods you could use to avoid deadlock problems in a multithreaded application.
Tough General Interview Questions
1. What habits in other programmers do you find most annoying?
2. How much time do you devote on a monthly basis to improving your skills?
3. Do you see yourself in a management role in the future?
4. Why did you choose programmer as a career?
5. What do you think is important in determining how well you will function with a team of programmers?
Open Ended Questions
1. What criteria would you use to determine if a particular program should be written as a web based ASP.NET application or as a WinForms application?
2. If you needed to create custom web applications for each of a company’s clients that could be quickly brought online and modified as needed what are some of the things you would consider in your design?
Have fun with these and let me know what you think about them by leaving a comment or answering the questions.
Share This Article:
These icons link to social bookmarking sites where readers can share and discover new web pages.
October 21st, 2007
I’ve long said that many VB6 applications remind me of the Winchester Mystery House. This house, built by the heiress to the Winchester Rifle Company, is a sprawling mansion that had additions made to it essentially on the whim of the owner. Architecturally its a mess, but it still functions, much like a lot of VB6 programs you see with hundreds of forms and modules and with nooks and crannies that just don’t make any sense at all.
Here’s a video tour by the guys who did the Weird US series on the History Channel. It’s a fun video. Watch it and see if your VB6 app has something in common with this house.
Share This Article:
These icons link to social bookmarking sites where readers can share and discover new web pages.
October 20th, 2007
Trying to Keep Things Balanced
I’ve been working hard on my new "anything goes" speed blog, OpTempo, but I’m trying to keep the quality up here as well. I may not post quite as frequently here over the next few weeks, but I’ll make every post count. I’ll at least have one general programming article and two tutorial or code example articles a week plus my weekly VB.NET Interview Questions and Link Round-Up columns.
Most Popular Posts
Here are the 10 most popular posts of the week:
Coming Up Next Week
With any luck I’ll publish my follow-up article on coaching on Monday. I also have an overview article on Interfaces that someone requested just about ready as well. If you have a topic you would like for me to cover, let me know in a comment or email.
Share This Article:
These icons link to social bookmarking sites where readers can share and discover new web pages.
October 20th, 2007
Previous Posts