CSCI 3327 Visual Basic Chapter 1: Introduction to Visual Basic

24
CSCI 3327 Visual Basic CSCI 3327 Visual Basic Chapter 1: Chapter 1: Introduction to Visual Introduction to Visual Basic Basic UTPA – Fall 2011

description

CSCI 3327 Visual Basic Chapter 1: Introduction to Visual Basic. UTPA – Fall 2011. Demo. Objectives. In this chapter, you will Recall basic components in a computer system Learn the evolution of programming language Learn the history of Visual Basic - PowerPoint PPT Presentation

Transcript of CSCI 3327 Visual Basic Chapter 1: Introduction to Visual Basic

Page 1: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

CSCI 3327 Visual Basic CSCI 3327 Visual Basic Chapter 1: Introduction to Visual Chapter 1: Introduction to Visual

BasicBasic

UTPA – Fall 2011

Page 2: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Demo

2

Page 3: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Objectives

• In this chapter, you will– Recall basic components in a computer system

– Learn the evolution of programming language

– Learn the history of Visual Basic

– Find the differences between structural programing and object-oriented programing

– Become aware of the .NET Framework for Visual Basic

3

Page 4: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

CSCI 1380: Elements of a Computer System

• Hardware– CPU

–Main memory

– Secondary storage

– Input / Output devices

• Software– System programs

– Application programs (e.g. Visual Basic)

4

Page 5: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Programming Languages

• Machine language

• Assembly language

• High-level language

5

Page 6: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

History of Visual Basic

• BASIC (Beginner's All-purpose Symbolic Instruction Code)– 1960, Profs Kemeny and Kurtz– 1970s, Bill Gates implemented BASIC on several

early PCs– Late 1980s ~ early 1990s, Microsoft developed

Microsoft Windows graphical user interface (GUI)• Basic Visual Basic • Visual Basic is created in Integrated Development

Environment (IDE)

6

Page 7: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Milestones

• Structured Programming Disciplined approach to creating clear, correct and easy to modify programs. Pascal 1971– Procedural Programming

• Object Technology Packaging Scheme for creating meaningful software units

7

Page 8: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Object Technology

• We humans are very good in recognizing and working with objects, such as a pen, a dog, or a human being.

• We learned to categorize them in such a way that make sense to us. We may categorize them as animate object, inanimate objects, pets, friends, etc.

8

Page 9: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Object Technology (cont'd)

• We some times classify objects based on their attributes, for example, green apples or red apples, fat or slim people, etc.

• If you think about it each object has many attributes. If I ask you list the attributes of an orange, you probably could list many things such as color, shape, weight, smell, etc.

9

Page 10: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Object Technology (cont'd)

• In addition to attributes, all objects exhibit behaviors.

• A dog eats, barks, wags its tail, plays, and begs. A dog exhibits many more other behaviors than this short list.

• Another thing we need to remember about objects is that objects interact between each other.

10

Page 11: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Object Technology in Visual Basic

• Visual Basic– Object-oriented • E.g. forms, labels, buttons, radios, checkboxes, etc.

– Properties of objects• E.g. background color of forms

– Event-driven• Behaviors events of objects

• E.g. clicks

11

Page 12: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

XML (eXtensible Markup Language)

• HTML has fixed tags which is a limitation

• XML is definable

• Separation of data from description of data (data independence)

• XML can be used by any software or language

12

Page 13: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

ARTICLE.XML file• <?xml version = "1.0"?>• <!-- Article structured with XML -->• <article>• <title>Simple XML</title>• <date>December 6, 2001</date>• <author>• <firstName>John</firstName>• <lastName>Doe</lastName>• </author>• <summary>XML is pretty easy.</summary>• <content>In this chapter, we present a wide variety of examples that use

XML.• </content>• </article>

Page 14: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

What is .NET?

• .NET is an Internet and Web based infrastructure

• .NET delivers software as Web Services – XML based.

• .NET will run in any browser on any platform

• .NET framework is the infrastructure for the new Microsoft .NET Platform.

14

Page 15: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

• Applications that run on a web server and communicate with other applications

• The basic platform of Web services is XML + HTTP

15

What are Web Services?

Page 16: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

What is .NET built on?

• Windows Servers:– SQL– Application Center– Commerce Server–Mobile Information Server– Exchange Server– BizTalk Server– Internet Security– Host Integration

16

Page 17: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

.NET Framework

• A software platform• Language-neutral• Designed for cross-language compatibility– Applications written in VB may reference a DLL

file written in any other language

• 2 components:– Common Language Runtime (CLR)– Class Libraries

17

Page 18: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Common Language Runtime

• Execution Engine of .NET• Manages the execution of programs and

provides core services:– Code compilation–Memory allocation– Thread management– Garbage collection

18

Page 19: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Common Language Runtime (cont'd)

• Output of .Net compilation contains a special type of code called Microsoft Intermediate Language (MSIL); it is not executable–MSIL is independent of any specific CPU.

– CLR translates MSIL to executable code when the program is executed

– Executable code is produced using JIT (just-in-time) compiler. The native code produced by JIT is specific for the CPU.

19

Page 20: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Class Libraries

• Designed to integrate with the common language runtime

• This library gives the program access to runtime environment

• The class library consists of lots of prewritten code that all the applications created in VB .NET and Visual Studio .NET will use

• The code in Visual Basic for all the elements like forms, and controls actually comes from the class library

20

Page 21: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Reasons Why Developers Build Applications Using the .NET Framework• Improved Reliability• Increased Performance• Developer Productivity• Powerful Security• Integration with Existing Systems• Ease of Deployment• Mobility Support• XML Service Support• Support for over 20 Programming Languages• Flexible Data Access

21

Page 22: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Visual Basic (VB)

• Forms designer • In-place menu editor• Automatic control anchoring and docking• Integrated Development Environment (IDE)• Create Web applications using the shared Web

forms designer• Full object-oriented constructs - inheritance,

encapsulation, and polymorphism

22

Page 23: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

Concepts of Object-Oriented Programming

• Objects

• Classes

• Data Abstraction and Encapsulation

• Inheritance

• Polymorphism

23

Page 24: CSCI  3327 Visual Basic  Chapter 1: Introduction to Visual Basic

VB Object-Oriented Approach

• Emphasis on data rather than procedure• Programs are divided into Objects• Data is hidden and cannot be accessed by external

functions• Objects can communicate with each other through

functions– E.g. click event of a button

• New data and functions can be easily added whenever necessary

• Follows bottom-up approach

24