Presentation is loading. Please wait.

Presentation is loading. Please wait.

PROGRAMMING LANGUAGES VB.NET XML JavaScript. Visual Basic.NET evolved from BASIC (Beginner’s ALL Purpose Symbolic Instruction Code) developed in the mid-1960’s.

Similar presentations


Presentation on theme: "PROGRAMMING LANGUAGES VB.NET XML JavaScript. Visual Basic.NET evolved from BASIC (Beginner’s ALL Purpose Symbolic Instruction Code) developed in the mid-1960’s."— Presentation transcript:

1 PROGRAMMING LANGUAGES VB.NET XML JavaScript

2 Visual Basic.NET evolved from BASIC (Beginner’s ALL Purpose Symbolic Instruction Code) developed in the mid-1960’s by Prof. John Kemeny and Thomas Kurtz

3 Visual Basic.NET event driven visual programming language an object-oriented programming language designed by Microsoft

4 Visual Basic.NET Encapsulation Allows your program to treat objects as black boxes Polymorphism One object can have different forms depending on the situation Reuse By using containment and delegation

5 READABILITY Simplicity and Orthogonality AddHandlerAutoCBool AndAlsoByValCDec DoubleEndEvent ImplementsIntegerLike NextNotOverridableOptional RaiseEventRemoveHandlerSet ThenAddressOfAnsi CByteCDblCLng DimEachEnum GoToImportsInterface MyClassNotObject PropertyReadOnlyResume StructureThrowAlias CaseCCharChar DeclareDirectCastElse

6 READABILITY Control Structure If/thenDo Loop/Until If/Then/Else Do Loop/While CaseWhile Do While/LoopFor/Next Do Until/LoopFor Each/Next

7 READABILITY Data Types and Structure TypeSize in Bits Boolean16 Char16 Byte8 Date64 Decimal128 Short16 Integer32 Long64 Single32 Double64 Object32 String0-2000000000

8 READABILITY Syntax Design uses special words in forming compound statements primarily in control constructs (such as If/Then/Else)

9 WRITABILITY Simplicity and Orthogonality Control Structure Dim firstname = "Phil“ If firstname = "Bill" Then MsgBox "firstname is Bill" Else MsgBox "firstname is not Bill“ End If

10 WRITABILITY Data Types and Structure Syntax Design Dim value As Integer = Integer.Parse(Console.ReadLine()) Select Case value Case 1 Console.WriteLine("You typed one") MsgBox("You typed one") Case 2 Console.WriteLine("You typed two") MsgBox("You typed two") Case 5 Console.WriteLine("You typed five") MsgBox("You typed five") Case Else Console.WriteLine("You typed something else") MsgBox("You typed somethinig else") End Select

11 WRITABILITY Abstraction Public MaximumSpeed as _ Integer Public ModelName as String Public Sub Accelerate() 'Some code to make the car go End Sub Public Sub Stop() 'Some code to make the car stop End Sub

12 WRITABILITY Expressivity

13 RELIABILITY Type Checking Exception Handling Restricted Aliasing

14 COST Migrating from any other language to Visual Basic.NET could cost companies on the order of $43,000 per developer, research from the Gartner Group

15 PORTABILITY can only be compiled and run through the.NET framework which only runs on windows

16 XML eXtensible Markup Language Markup: a text-based notation for describing data A widely supported open technology for describing data The standard format for data exchanged between applications over the Internet. permits document authors to create markup for virtually any type of information

17 XML NOT replace HTML Foundation for several next-generation Web technologies XHTML, RSS (Blogs), Ajax, Web Services can be used to create entirely new markup languages that describe specific types of data, including mathematical formulas, chemical molecular structures, music and recipes. describes data in a way that human beings can understand and computers can process.

18 XML http://www.w3schools.com/xml/xml_validator.asp

19 XML Parser in the Browser When a user loads an XML document in a browser, a parser parses the document, and the browser uses a style sheet to format the data for display

20 XML Elements The root element of an XML document encompasses all its other elements XML element names can be of any length and can contain letters, digits, underscores, hyphens and periods XML element names must begin with either a letter or an underscore, and they should not begin with “xml” in any combination of uppercase and lowercase letters, as this is reserved for use in the XML standards

21 DOCUMENT TYPE DEFINITIONS DTDs and schemas specify documents’ element types and attributes, and their relationships to one another DTDs and schemas enable an XML parser to verify whether an XML document is valid (i.e., its elements contain the proper attributes and appear in the proper sequence) In a DTD, an ELEMENT element type declaration defines the rules for an element. An ATTLIST attribute-list declaration defines attributes for a particular element

22 NAMESPACES XML namespaces provide a means for document authors to prevent naming collisions Each namespace prefix is bound to a uniform resource identifier (URI) that uniquely identifies the namespace We declare a default namespace using keyword xmlns with a URI (Uniform Resource Identifier) as its value

23 W3C XML SCHEMA DOCUMENTS which to define your XML document structure and limitations. XML schemas provide a set of basic types, such as integer, byte, string and floating point numbers. XML schemas provide an Object Oriented approach. The author of an XML schema can use basic types, along with various operators and modifiers, to create complex types of their own.

24 XSL AND XSLT XSL is a style sheet language for XML documents. XSL is more than a style sheet language. XSL consists of two parts: XSLT – a language for transforming XML documents XPath – a language for navigating in XML documents XSL style sheets can be connected directly to an XML document by adding an xml:stylesheet processing instruction to the XML document

25 READBILITY XML is the first language that makes documents both human-readable and computer-manipulable It is the language of the intelligent document, a step ahead of conventional methods of document representation that rely on format rather than structure

26 WRITABILITY XML declaration: identifies the version of XML used. XML tags are case sensitive. Each start tag must have a matching end tag. Using a white space character in a XML element name is an error. XML element names should be meaningful to humans and should not use abbreviations.

27 WELL FORMED vs. VALID XML Well-formed XML documents Matching start tag and end tag Valid XML documents One that has been tested against a set of rules These rules are specified as either DTD or XML schema files

28 RELIABILITY XML provides a common syntax for messaging systems for the exchange of information between applications. If everyone uses the same syntax it makes writing these systems much faster and more reliable.

29 PORTABILITY XML is an open standard, there is a wide selection of tools for implementing it XML can be used on a wide variety of platforms and interpreted with a wide variety of tools.

30 COST enables a nonprogrammer to do things that would have previously required extensive knowledge of scripting languages or thousands of dollars worth of custom software text-based, so anybody can create an XML document with even the most primitive text processing tools.

31 JavaScript Scripting language which is used to enhance the functionality and appearance of web pages. All major web browsers contain JavaScript interpreters, which process the commands written in JavaScript.

32 JavaScript JavaScript allows for interactivity Browser/page manipulation Reacting to user actions A type of programming language Easy to learn Developed by Netscape Standardized by European Computer Manufacturers Association (ECMA) www.ecma-international.org/publications/ standards/ECMA-262.HTM

33 How JavaScript works Embedded within HTML page View source Executes on client Fast, no connection needed once loaded Simple programming statements combined with HTML tags Interpreted (not compiled) No special tools required

34 JavaScript compared to Java JavaScriptJava Interpreted (not compiled) by client.Compiled bytecodes downloaded from server, executed on client. Object-based. No distinction between types of objects. Inheritance is through the prototype mechanism and properties and methods can be added to any object dynamically. Object-oriented. Objects are divided into classes and instances with all inheritance through the class hierarchy. Classes and instances cannot have properties or methods added dynamically. Code integrated with, and embedded in, HTML. Applets distinct from HTML (accessed from HTML pages). Variable data types not declared (loose typing). Variable data types must be declared (strong typing). Dynamic binding. Object references checked at runtime. Static binding. Object references must exist at compile-time.

35 JavaScript Often, JavaScripts appear in the section of the HTML document. The browser interprets the contents of the section first The tag indicates to the browser that the text that follows is part of a script. Attribute type specifies the scripting language used in the script—such as text/javascript

36 CONTROL STRUCTURES Sequential execution Statements execute in the order they are written Transfer of control Next statement to execute may not be the next one in sequence Three control structures Sequence structure Selection structure if if…else switch Repetition structure while do…while for for…in

37 JavaScript Keywords breakcasecatchcontinuedefault deletedoelsefinallyfor functionifininstanceofnew returnswitchthisthrowtry typeofvarvoidwhilewith Keywords that are reserved but not currently used by JavaScript abstractbooleanbytecharclass constdebuggerdoubleenumexport extendsfinalfloatgotoimplements importintinterfacelongnative packageprivateprotectedpublicshort staticsupersynchronizedthrowstransient volatile

38 JavaScript Statements My Page document.write('This is my first  JavaScript Page'); Note the symbol for line continuation

39 JavaScript Statements My Page document.write(' This is my first  JavaScript Page '); HTML written inside JavaScript

40 JavaScript Statements My Page <a href="myfile.html" onMouseover="window.alert('Hello');"> My Page JavaScript written inside HTML An Event

41 CHARACTERISTICS Dynamically typed Standard operator precedence Overloaded operators Reserved words

42 CHARACTERISTICS Strings are very common data types Rich set of methods available Arrays have dynamic length Array elements have dynamic type Arrays are passed by reference Array elements are passed by value

43 EXAMPLES Division with / is not integer division Modulus (%) is not an integer operator 5 / 2 yields 2.5 5.1 / 2.1 yields 2.4285714285714284 5 % 2 yields 1 5.1 % 2.1 yields 0.8999999999999995

44 WRITABILITY Browser contains a complete set of objects that allow script programmers to access and manipulate every element of an HTML document Every statement should end with a semicolon (also known as the statement terminator), although none is required by JavaScript JavaScript is case sensitive Not using the proper uppercase and lowercase letters is a syntax error

45 WRITABILITY A variable name can be any valid identifier consisting of letters, digits, underscores ( _ ) and dollar signs ($) that does not begin with a digit and is not a reserved JavaScript keyword. JavaScript does not require variables to have a type before they can be used in a script A variable in JavaScript can contain a value of any data type, and in many situations, JavaScript automatically converts between values of different types for you JavaScript is referred to as a loosely typed language

46 WRITABILITY Comments in JavaScript // a single line comment /* a multiline comment */

47 RELIABILITY From a core language standpoint, it is a reliable language for small applications. From a browser implementation standpoint, it is not so reliable because different browsers behave differently. Garbage Collection JavaScript knows when a program no longer needs a variable or object Automatically cleans up the memory

48 PORTABILITY As long as there is support for it, Javascript will work on all browsers and all Operating Systems window.navigator Has information about the current browser Properties include appName (Netscape or Microsoft Internet Explorer) appVersion userAgent appCodeName (not useful) platform (operating system) language (e.g., en or fr)

49 COST JavaScript is free and open-source


Download ppt "PROGRAMMING LANGUAGES VB.NET XML JavaScript. Visual Basic.NET evolved from BASIC (Beginner’s ALL Purpose Symbolic Instruction Code) developed in the mid-1960’s."

Similar presentations


Ads by Google