An Overview of Visual Basic .NET 1

Transcription

An Overview of Visual Basic .NET 1
An Overview of Visual Basic .NET
Overview-An Overview of Visual Basic .NET
1
Overview Objectives
 This overview contains basic definitions and
background information, including:
 A brief history of programming languages
 An introduction to the terminology used in
object-oriented programming languages
 A Visual Basic demonstration
 Information on using the tutorials effectively
Overview-An Overview of Visual Basic .NET
2
A Brief History
of Programming Languages
 Computers still rely on human beings to give
them directions
 These directions are called programs, and the
people who write the programs are called
programmers
 Just as human beings communicate with each
other through the use of languages such as
English, Spanish, Hindi, and Chinese,
programmers use a variety of special languages,
called programming languages, to communicate
with the computer
Overview-An Overview of Visual Basic .NET
3
Machine Languages
 Within a computer, data are represented by
microscopic electronic switches that can be either off
or on
 The off switch is designated by a 0
 The on switch is designated by a 1
 Instructions written in 0s and 1s are called machine
language or machine code
 Each type of machine has its own language
 Machine languages represent the only way to
communicate directly with the computer
Overview-An Overview of Visual Basic .NET
4
Assembly Languages
• Slightly more advanced programming
languages are called assembly languages
• Assembly languages simplify the
programmer’s job by allowing the
programmer to use mnemonics in place of
the 0s and 1s in the program
• Mnemonics are memory aids—in this case,
alphabetic abbreviations for instructions
Overview-An Overview of Visual Basic .NET
5
Assembly Languages
 For example, the mnemonic MOV is used to move data from
one area of the computer’s memory to another
 Programs written in an assembly language require an
assembler
 The assembler is also a program
 It converts the assembly instructions into machine code—the 0s
and 1s the computer can understand
Overview-An Overview of Visual Basic .NET
6
High-Level Languages
 High-level languages
 Allow the programmer to use instructions that more
closely resemble the English language
 Represent the next major development in programming
languages
 Programs written in a high-level language require either an
interpreter or a compiler to convert the English-like
instructions into the 0s and 1s the computer can
understand
Overview-An Overview of Visual Basic .NET
7
High-Level Languages
 Like assemblers, both interpreters and compilers
are separate programs
 An interpreter translates the high-level
instructions into machine code, line by line, as
the program is running
 A compiler translates the entire program into
machine code before running the program
Overview-An Overview of Visual Basic .NET
8
Procedure-Oriented
High-Level Languages
 In procedure-oriented high-level languages, the
emphasis of a program is on how to
accomplish a task
 The programmer must instruct the computer
every step of the way, from the start of the task
to its completion
 The programmer determines and controls the
order in which the computer processes the
instructions
Overview-An Overview of Visual Basic .NET
9
Procedure-Oriented
High-Level Languages
 Examples include:
 COBOL
 BASIC (Beginner’s All-Purpose Symbolic Instruction Code)
 C
 Procedure-oriented high-level languages are a vast
improvement over machine and assembly languages
 Some of the procedure-oriented high-level
languages—for example, the BASIC language—do
not require a great amount of technical expertise to
write simple programs
Overview-An Overview of Visual Basic .NET
10
The Introduction of Windows
 Windows software provides an easy-to-use
graphical user interface (GUI)
 The GUI is common to all applications written
for the Windows environment
 Although the standard interface found in all
Windows applications makes the user’s life
much easier, it complicates the programmer’s
life a great deal
Overview-An Overview of Visual Basic .NET
11
The Introduction of Windows
 Programmers found themselves spending countless
hours writing instructions to create the buttons, scroll
bars, dialog boxes, and menus needed in all Windows
applications
 Tasks that used to take a few lines of program code
now needed pages
 Because programming Windows applications required
a great amount of expertise, it appeared that the
beginning of the Windows environment meant the end
of the do-it-yourself, nonprofessional programmer
Overview-An Overview of Visual Basic .NET
12
Object-Oriented/Event-Driven
High-Level Languages
 The object-oriented/event-driven high-level
languages simplified the task of programming
applications for Windows
 In object-oriented/event-driven languages, the
emphasis of a program is on the objects included
in the user interface (such as scroll bars and
buttons) and the events (such as scrolling and
clicking) that occur when those objects are used
 The object-oriented method allows the
programmer to use familiar objects to solve
problems
Overview-An Overview of Visual Basic .NET
13
Object-Oriented/Event-Driven
High-Level Languages
 The ability to use objects that model things found in
the real world makes problem solving much easier
 Visual Basic .NET is an object-oriented/event-driven
programming language that is easy enough for a
nonprogrammer to use, yet sophisticated enough to
be used by professional programmers
 With Visual Basic it takes just a few clicks of the
mouse to include standard Windows objects such as
buttons, list boxes, scroll bars, and icons in your
Windows application
Overview-An Overview of Visual Basic .NET
14
OOP Terminology
 OOP is an acronym for object-oriented
programming
 It means that you are using an object-oriented
language to create a program that contains one or
more objects
 OOD is an acronym for object-oriented design
 Like top-down design, which is used to plan
procedure-oriented programs, OOD is also a
design methodology, but it is used to plan objectoriented programs
 OOD divides a problem into one or more objects
Overview-An Overview of Visual Basic .NET
15
OOP Terminology
 An object is anything that can be seen, touched,
or used
 The objects used in an object-oriented program
can take on many different forms
 Objects include menus, radio buttons, and buttons
included in most Windows programs
 An object also can represent something
encountered in real life
 Every object has attributes and behaviors
Overview-An Overview of Visual Basic .NET
16
Object
An Object:
 Is Anything that can be seen or touched
 Has attributes that describe it
 Has behaviors that the object can either
perform or have performed on it
Overview-An Overview of Visual Basic .NET
17
OOP Terminology
 The attributes are the characteristics that
describe the object
 An object’s behaviors, on the other hand, are the
operations (actions) that the object is capable of
performing
 A class is a pattern or blueprint used to create an
object
 Every object used in an object-oriented program
comes from a class
Overview-An Overview of Visual Basic .NET
18
OOP Terminology
 A class contains—or, in OOP terms, it
encapsulates—all of the attributes and behaviors
that describe the object the class creates
 Objects created from a class are referred to as
instances of the class, and are said to be
“instantiated” from the class
 Abstraction refers to the hiding of the internal
details of an object from the user
 Hiding the internal details helps prevent the user
from making inadvertent changes to the object
Overview-An Overview of Visual Basic .NET
19
Inheritance
 Allows you to create one class from
another class
 The new class is called the derived class
 The original class is called the base class
Overview-An Overview of Visual Basic .NET
20
OOP Terminology
 Attributes and behaviors that are not hidden are
said to be exposed to the user
 Anther OOP term, inheritance, refers to the fact
that you can create one class from another class
 The new class, called the derived class, inherits
the attributes and behaviors of the original class,
called the base class
 Polymorphism is the object-oriented feature that
allows the same instruction to be carried out
differently depending on the object
Overview-An Overview of Visual Basic .NET
21
Monthly Payment Application
Overview-An Overview of Visual Basic .NET
22
Using the Tutorials Effectively
 The tutorials in this book will help you learn
about Microsoft Visual Basic .NET, the newest
version of the Visual Basic programming
language
 At the end of Lesson C in each tutorial you will
find one or more Debugging exercises
 In programming, the term debugging refers to the
process of finding and fixing any errors in a
program
Overview-An Overview of Visual Basic .NET
23
Using the Tutorials Effectively
 Hands-on at your computer
 Step-by-step approach
 Help? notes identify common problems and explain how to
get back on track
 Tip notes provide additional information about a procedure
 Each tutorial is divided into three lessons
 To review and reinforce a lesson’s concepts
 Summary
 Questions
 Exercises
Overview-An Overview of Visual Basic .NET
24