Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Previous article   Next article back to categoryVBA articles

OOPS Visual Basic Did It Again

Sat 27th June 2009

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 https://www.stl-training.co.uk

Original article appears here:
https://www.stl-training.co.uk/article-449-oops-visual-basic-did-it-again.html

Back to article list

Publication Guidelines

  • You have permission to publish this article for free providing the "About the Author" box is included in its entirety.
  • Do not post/reprint this article in any site or publication that contains hate, violence, porn, warez, or supports illegal activity.
  • Do not use this article in violation of the US CAN-SPAM Act. If sent by email, this article must be delivered to opt-in subscribers only.
  • If you publish this article in a format that supports linking, please ensure that all URLs and email addresses are active links, without the rel='nofollow' tag.
  • Software Training London Ltd. owns this article. Please respect the author's copyright and above publication guidelines.
  • If you do not agree to these terms, please do not use this article.

VBA courses in London and UK wide.

» Next available dates

 

Training courses

 

London's widest choice in
dates, venues, and prices

Public Schedule:

Buy now / Live dates

On-site / Closed company:

Get quote

Testimonials

More testimonials

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.85 secs.