Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training add this page to your favourites/bookmarksBookmark page

view a printable version of this pagePrintable version
Customer: Sign in
Delegate: Sign in
Trainer: Log in

OOPS Visual Basic Did It Again

All users of Microsoft applications have come to rely on the language and coding of Visual Basic. The smoothness and accuracy of the functions embedded within VBA have made it possible to access and analyse data quickly and efficiently across a whole suite of programs.

Visual Basic.NET improves on this efficiency still further because it is a completely object-oriented program (OOP), meaning that it focuses on the data itself rather than the specific function of a module. This allows much more 'behavioural' interaction between different objects and enables them to perform individual tasks. Think of it like an office where every employee has a specific job and function yet can relay messages to one another or delegate where necessary.

There is a particular set of terms for object oriented programs and these emphasise its
'human-ness,' as they are terms that we use in normal conversation when identifying things and their purposes.

Class is the fundamental building block of an OOP reducing an object to its most basic level. Within each class there are a number of more specific objects, so for example DAVID BECKHAM would be an object in the class FOOTBALLER.
Footballers have various abilities such as RUNNING and PASSING and within an object-oriented program these abilities would be known as methods. If a method is used in an OOP then it will generally only affect the object rather than the whole class so that only David Beckham would be passing the ball at a given time.

Where Visual Basic really benefits from being fully object oriented is when it comes to inheritance. Each class has a series of subclasses (in this instance the different positions in a football team; GOALKEEPER, DEFENDER, MIDFIELDER and STRIKER) that inherit particular methods from the parent class. The advantage of object-oriented systems is that the programmer need only apply the method (say, PASSING) to the parent class and the subclasses will automatically inherit it. This 'once-only' approach saves significant time and allows for extensive reuse of coding.

But that's not all. Subclasses can vary their traits to create more specific and appropriate methods and commands. For instance the method CROSSING could be added to the MIDFIELDER subclass, meaning that only MIDFIELDERS would have the ability to cross the ball. Based on inheritance there are myriad variations in how methods can be applied to classes and subclasses, all with relatively straightforward coding.

Don't worry if all these interactions sound overly complex and confusing as OOPs are also blessed with abstraction. This principle means that the programmer is able to pick and choose the most appropriate class or subclass to the problem at hand. So DAVID BECKHAM can be a MIDFIELDER when required to cross the ball and a FOOTBALLER or even plain old SPORTSMAN when necessary. Again this tool allows Visual Basic to run more directly and accurately especially when there are different levels of coding required.

The world of object-oriented programming is a fascinating and revolutionary one that is changing the way programs such as Visual Basic work. The theory may require a little time and help to get your head around but once you have a firm grasp of the way it operates whole new areas of programming will open up for you.

Author is a freelance copywriter. For more information on access visual basic, please visit http://www.microsofttraining.net


Original article appears here:
http://www.microsofttraining.net/article-449-oops-visual-basic-did-it-again.html


Back to article list

Distribution notes

PUBLICATION GUIDELINES


Rate this page:
3.1/5 (32 votes cast)
Institute of IT Training - Accredited Training Provider ILM
Microsoft Certified Partner
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider
McAfee Secure sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams
Association of Computer Trainers verified by visa, mastercard securecard