Return
to IFS 110 class Notes Menu!
Introduction
Visual Basic
Programming
Visual Basic
Programming System
- Visual Basic
Programming System - set
of tools and technologies
used by 3
million developers world-wide
to create software components and applications
- contains 5000 pages of user documentation
- several Internet discussion
groups
- World Wide Web sites
Programming a
Computer
- Program - series of precise
instructions
- memory - stores the
data and instructions
(that tell the computer what to do with data)
- machine cycle - instruction is
fetched, decoded, and executed
- fetched - retrieved from memory
and placed in control unit
- decoded - translated into
machine language (binary)
- executed - instruction
carried out
Programming a
Computer
- Parallel processing - computer with
more than one CPU
- Multitasking - computer moves back and forth
between programs in memory (processor can execute only
one instruction at a time)
- Computer programming - writing sets of instructions (code)
that make up a program
- 2000 programming
languages exist
Software
Applications
- Application software
packages - purchased
programs
- Applications - programs tell a computer
how to
accept instructions from the end user and how
to produce information in response
to those instructions
- Application
development - process of using a programming
language or development environment to build
software applications
User
Interface Design
- User interface - way a program
accepts instructions from user and presents results
- Graphical User
Interface (GUI)
- provides visual clues such as
small picture (icons)
- Designed for
Microsoft Windows -
application follow extensive set of requirements
- support use of long file names
- adherence to very detailed Windows
interface guidelines
User
Interface Design
- Designing a
graphical user interface
(basic
principles)
- application should always be under
the users control
- present choices that allow the user
to initiate and control the applications events
- user should be able to customize
application
- form should follow
function - interface
should be designed to provide
direct ways to accomplish tasks, not be glamorous
or trendy
User
Interface Design
- Designing a
graphical user interface
(basic
principles continued)
- use concepts and metaphors
that users are familiar with to make
interface parallel real-world experience
- follow basic graphic design
principles and should be consistent visually and functionally
- functional consistency
- user initiates same
set of events in the same
way throughout the use of application
- user should always receive immediate
feedback (hourglass, animated
image, auditory feedback (Chimes))
User
Interface Design
- Designing a
graphical user interface
(basic
principles continued)
- application should attempt to prevent
users from making mistakes, rather than
allowing mistakes and then pointing them out to the user
- user should never be
told that they made a mistake
- told politely why a
function cannot be carried out or prompted to
reenter data
- error dialogs - messages
conveyed in dialog boxes (way to provide positive
rather than negative feedback)
Program
Development Life Cycle
- Methodology - organized
plan that
breaks the process of building software
application into a series of tasks
- Program Development
life cycle (PDLC) - outline of each of the steps
used to build software applications
- used to guide programmers
through development of an application
Program
Development Life Cycle (6 Steps)
- Analyze problem - program
specs, partition - description
of inputs, processing, outputs, user interface
- Design Program - organize
partitions - pseudocode, flowcharts, structure charts,
event
diagrams
- Code Program - programming
language
- internal documentation comments
- Test and debug - run with
data,
remove errors
- Formalize Solution -
review, revise
documentation, complete end-user documentation
- Maintain Program -
education and support
to users, correct errors, provide
user-requested enhancements
Structured
Programming
- Structured
programming - methodology
used to facilitate translating the
problem into specific program instructions
- each module
identified is broken into a number
of smaller and more precise instruction
sets (procedures)
- hierarchy chart - common way to represent this subdivision
of activities visually (see FIGURE 1 page VB1.8)
- Flowchart - design tool used to
represent the logic in a solution algorithm graphically
Control
Structures
- Control Structure -
series of instructions
that control the logical
order in which the program instructions are executed
- Sequence - logical order
follows physical
order of statements
- Selection - choices made between
two modules based on a data
value
- case control
structure - selection
of more than two alternatives
- Repetition - (looping) statements
repeated
- Nested control
structures - control
structures contained within other control
structures
Object-Oriented
Programming
- Object-oriented
programming (OOP) and object-oriented design (OOD) (more recent
methodology than structured programming)
- Object-oriented
programming - has
evolved as a way to better isolate logically
related portions of an application than is
possible in structured design
- Benefit: easier to
develop, debug,
and maintain applications (becoming
more complex)
Object-Oriented
Design
- Object-Oriented
Design - represents
logical plan of a program as a set
of interactions among objects
and operations
- Object - anything real or
abstract,
about which you store both data
and operations that manipulate
the data
- examples of objects: -
invoice, organization,
computer screen, or airplane
- an object may be composed of other
objects
Class,
Subclass, SuperClass
- A Class -
is an implementation that can be used
to create multiple objects with the same attributes and
behavior
- An object is an instance
of a class
- A Ford Mustang is an instance
of the class cars
- each class can
have one or more levels called subclasses or one or one or more higher levels called
superclasses
- Fire Truck is a subclass
of Truck, Motor
Vehicle is a superclass
of Truck
- Hierarchy - relationship among
classes, subclasses and superclasses
(Figure
8 VB 1.13)
Object-Oriented
Design
- Attributes - identifying
characteristics
of individual objects (name, weight, color)
- Operation - activity that reads or
manipulates
the data of an object
- Method - code that may be
executed
to perform a service
or operation
- Object Structure
Diagram - used to
provide a visual representation of an object,
its attributes, and its methods
(Figures 9 +
10 VB 1.13)
Messages
Object Oriented Programming
- For an object to do something it must be
sent
a message (Request for Service)
- Event in OOP terminology
2
Parts of Message
- Name of object
to which the message is being sent
- Name of the operation
(service) that will be performed
- Method in OOP terminology
Event-Driven
Programming
- Event diagrams - used to represent the
relationships
among events and operations
(figure 11
VB 1.14)
- nothing happens unless a message is
sent (an event occurs)
- This relationship is a key feature of
OOP, and programs that are constructed in this way are
said to be event-driven
- OOP is not just a different set of
tools
and methods from structured
programming. It is a different
philosophy for how computer programs
are assembled
Encapsulation
- Encapsulation - capability of an
object
to have data (properties) and functionality
(methods) available to user without having
to understand the implementation
within the object
- Structured
programming separates data
from procedures
- In object-oriented world, an object contains
functions as well as their
associated data
- Information hiding - process of
hiding implementation
details of object from user
Encapsulation
allows objects to be modified without requiring the applications
that use them also to be modified
Inheritance
- Inheritance - means that a descendent class (subclass)
that differs from its superclass
in only one way contains just the code
or data necessary to explain
the difference
- its status as
a subclass is enough to give
it access to all the superclasss
functions and data
- Subclassing - provides a
way for programmers
to define a class
as an extension of another
class without copying
the definition
Polymorphism
- Polymorphism - allows an
instruction
to be given to an object in a generalized
rather than specific detailed command
- same command will get different, but
predictable, results depending on the object that
receives the command
Rapid
Application Development (RAD)
- Rapid application
development - refers to
the use of prebuilt objects to make
program development much faster
- Advantages: shorter
development
life cycles, easier
maintenance, capability to reuse components for other projects
- all members of development team need
not be proficient in an object-oriented programming
language (separate
task of creating objects from the
task of assembling objects into
applications)
What is
Visual Basic 6 ?
ActiveX
Technology
- ActiveX technology - allows
creation, integration,
and reuse of software components
called controls
- ActiveX controls - are
reusable software components that can be integrated
into a large number of different software products
- 2000 ActiveX
controls currently available
- ActiveX Documents -
applications delivered dynamically over Internet
or intranets with browsers
like Internet Explorer or Netscape
4 Editions of
Visual Basic 6
- Control Creation - allows developers to build
or customize ActiveX
controls, or assemble
multiple existing controls into new
controls
cannot be
used to develop stand-alone applications, free to download
from Microsoft Web site
- Learning
- Professional
- Enterprise
In addition to including control creation
capability, the Learning, Professional,
and Enterprise editions each offer
progressively more application development and project
management features
2 Additional
Editions of VB 6
- Application Edition (VBA) - included within
Excel, Access, and many other Windows
applications
- use VBA to customize
and extend capabilities
of those applications
- Scripting Edition (VBScript) is a
subset of Visual
Basic used for Internet programming
Is Visual
Basic Object Oriented ?
- Visual programming
languages - languages
where you create entire program
by visual means
- Visual Basic only interface created visually,
program is still mostly coded
- Visual Basic is not a
visual
programming language in the strict
sense
- Strengths: easy to
put
the basics of interface
in place, can develop the functionality
of application a little at a time
Visual Basic
Characteristics
- Visual Basic well-suited to
prototyping
- Prototyping - process where
developers iterate between refining the specifications
and building working models
of the system
- Visual Basic is event-driven and
object-based
- does not meet all
requirements to be object-oriented
- implements subclassing
through something called aggregation
and containment rather than through inheritance
- create applications by assembling
components
Visual Basic
Characteristics
- Visual Basic - has set of
predefined objects
- allows for user-defined objects
- objects have attributes called properties
- Controls - visual elements
common to Windows applications (check boxes,
option buttons, list boxes)
- Forms - windows that
contain
an applications controls
- Controls and forms are objects that have
properties, methods, and events
- Events - messages or
requests
for service
- Procedures - operations or
services
- includes methods, functions,
and subroutines
Creating
Applications in VB
(3 Step Process)
- Creating the Interface
- Setting Properties
- Writing Code
- Although Visual Basic has a number of built-in methods
and functions, you still must write
many of the procedures that glue
together the components
- Approach to coding
procedures in VB uses the constructs
and control structures of structured programming
Learning Tool
- Visual Basic is a powerful
tool for learning programming and application development, because it
requires
an understanding of the concepts and
techniques of both structured programming and object-oriented programming
Introduction
Visual Basic
Programming
END
Return
to IFS 110 class Notes Menu!