120 likes | 244 Views
Visual Basic (VB) is a Rapid Application Development (RAD) programming language that simplifies the creation of graphical user interfaces (GUIs). In VB, developers work within an Integrated Development Environment (IDE) where they can write, test, and debug their programs. The core concepts include forms, controls, properties, methods, and events. Objects are instances of classes, encapsulating specific attributes. Understanding object-oriented principles and using self-documenting code practices, such as Hungarian notation, enhances clarity and maintainability in programming.
E N D
Visual Basic Starter Vocabulary
IDE • Integrated Development Environment • A setting in which programs are written, tested, debugged, etc. • You could write a C program in Notepad, compile and run by typing instructions at a command prompt • But “integrated” means the various aspects are all put together
VB is RAD • Visual Basic (VB) is considered a Rapid Applications Development (RAD) programming language since it makes the development of a Graphical User Interface (GUI) relatively simple • When you start to program in Visual Basic (VB), you are provided with a form
Form • Like a window • A container (surface) for “controls” • A form is an object; it has • Properties • Methods • Events • Actually the form you see is an object, but first a form is a class, then one “instantiates” an object of that class
Classes and Objects • A class is an abstract category of or template for objects • It collects the characteristics (properties) and actions (methods) common to the objects that belong to it • An object is a specific member of the class • When a specific object is made from the abstract class template, it is said to be an instantiation of the class • Initially the instantiations will be automatically done for us, but eventually we will have to do some of them for ourselves.
Example • Dog would be a class • It has properties, like breed, height, weight, etc. • It has methods, like barks, eats, runs, etc. • Lassie is an object • Lassie has specific properties • Her breed is Collie; her height is 36 inches; her weight is 90 pounds; etc. • The collection of specific properties is also referred to as the state of the object
Property • A property is like a variable; however, altering or accessing its value is usually done indirectly using a “guard” method. • The CommandButton object has • Height • Width • Position (left and top) • Caption • Etc.
Controls • Basic interface objects instantiated on a form. For example: • buttons • scroll bars • radio buttons • menus • Controls are not necessarily visible • E.g. timer
Event • A program detects that some action (an event) took place • The event may be initiated by • The user (e.g. a click) • The program (e.g. a timer) • The system (e.g. out of memory) • If the execution of a program (what is done, when it is done, etc.) depends on events, then the programming is said to be event-driven.
Method • Just as properties are variables tied to an object, methods are functions or procedures tied to an object • Methods are executed when an object receives a message (a “call” plus any arguments) • VB provides the shell of methods associated with certain events and objects (the click of a command button), but you can also make your own
Self-documentation • Documentation is the part of a program that has no effect on its execution but is meant to make the code more understandable to another programmer or yourself at a later date • Using variable names like “interest” so the variable name is directly associated with its purpose in the program
Hungarian Notation • It is a useful practice in VB to start the name of control objects with standard prefixes followed by a self-documenting name • For example, a Button that leads to printing when clicked might be called btnPrint • A good habit is to include some capital letters when naming variables • This is an example of Hungarian notation developed by Dr. Charles Simonyi