Transcript Document

Visual Basic vs
JAVA
Namon Nuttayasakul
Myat Min
7/18/2015
1
Introduction

7/18/2015
Visual Basic is a software
development system developed by
Microsoft to support creating
programs for the Windows
operating systems
2
History of Visual Basic





7/18/2015
VB version 1 – a custom-control edition
VB version 2 – introduced the OOPS
VB version 3,4 – business orientation
VB version 5 – is a big breakthrough of OOPS
VB version 6 – the network version of VB.
3
VB as an OOPS



7/18/2015
OOPS (Object Oriented
Programming Systems)
Microsoft’s object Basic
Visual Basic for Application (VBA)
4
Object


7/18/2015
A data type with intelligence.
An example of object is
Spread Sheet
5
Creating an object in VB
General process to create object variable:

Create an object variable (Dim).

Allocate an object in memory with
New or CreateObject , and then
assign it to the object variable.
7/18/2015
6
Creating an object in VB
ObjectVariable
?
Create an object variable
Dim ObjName As Object
7/18/2015
7
Creating an object
ObjVariable
Object of type
myClass
Allocate an object in memory with New
Set ObjVariable = New myClass
7/18/2015
8
Three ways to create an object



Use Dim and New together
Dim objectName As New className
Using New
Public objectName As New ClassName
Using CreateObject
Set fso = CreateObject(“Scripting.FileSystemObject”)
7/18/2015
9
Object type


7/18/2015
Collection object
Class
10
Defining a New Class


7/18/2015
JAVA uses block of keyword “class
statement”
VB uses Class Module
11
Class
Declare property
module
Property Get : read –only
Property Let : write-only
Class module for Stack
Both : read-write
Stack object
Properties
Methods
Private m_Sam As Long
Push
Read-only
Count
sub
Public Property Get SamAccount() As Long
function
Sam = m_SamPop
End Property
?
Read-write
Public Property Let SamAccount(ByVal newVal As Long)
m_Sam = newVal
End Property
7/18/2015
Item
12
3 OOPS major features



7/18/2015
Encapsulation
Inheritance
Polymophysm
13
Encapsulation
Stack Object
Methods
Properties
Count
Push
Pop
?
Item
Hiding implementation
7/18/2015
14
Inheritance
Push
new code
Pop
Count
Item
Object
of
existing
class
New Object
7/18/2015
15
Polymorphism
ListBox.Property Let Visible
CompBox.Property Let Visible
Picture.Property Let Visible
Ctrl 1
Ctrl 2
Ctrl 3
Early Binding
Property Let Visible
item
Substiture any class
Property Let Visible
Is search for at run time,
In the list of procedures
Supported by item
Late Binding
7/18/2015
16
Conclusion
7/18/2015
FUNCTIONS
VB
JAVA
Complete object-oriented
No
Yes
Cross-platform compatible
No
Yes
Distributed
Yes
Yes
Ease to use
Easier Harder
Secure
Poorer better
17