CSCI 3327 Visual Basic Chapter 1: Introduction to Visual Basic UTPA – Fall 2011 This set of slides is revised from lecture slides of Prof. John Abraham. -- Xiang Lian
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 Find the differences between structural programing and object-oriented programing Become aware of the .NET Framework for 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)
Programming Languages Machine language Assembly language High-level language
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)
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
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.
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.
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.
Object Technology in 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
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
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>
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.
What are Web Services? Applications that run on a web server and communicate with other applications The basic platform of Web services is XML + HTTP
What is .NET built on? Windows Servers: SQL Application Center Commerce Server Mobile Information Server Exchange Server BizTalk Server Internet Security Host Integration
.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
Common Language Runtime Execution Engine of .NET Manages the execution of programs and provides core services: Code compilation Memory allocation Thread management Garbage collection
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.
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
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
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
Concepts of Object-Oriented Programming Objects Classes Data Abstraction and Encapsulation Inheritance Polymorphism
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