490 likes | 742 Views
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 by Prof. John Kemeny and Thomas Kurtz. Visual Basic.NET. event driven visual programming language
E N D
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 by Prof. John Kemeny and Thomas Kurtz
Visual Basic.NET event driven visual programming language an object-oriented programming language designed by Microsoft
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
READABILITY Simplicity and Orthogonality
READABILITY Control Structure
READABILITY Data Types and Structure
READABILITY Syntax Design uses special words in forming compound statements primarily in control constructs (such as If/Then/Else)
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
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
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
WRITABILITY Expressivity
RELIABILITY Type Checking Exception Handling Restricted Aliasing
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
PORTABILITY can only be compiled and run through the .NET framework which only runs on windows
XML • eXtensible Markup Language • Markup: a text-based notation for describing data • A widely supported open technology for describingdata • The standard format for data exchanged betweenapplications over the Internet. • permits document authors to create markupfor virtually any type of information
XML • NOT replace HTML • Foundation for several next-generation Webtechnologies • XHTML, RSS (Blogs), Ajax, Web Services • can be used to create entirely new markup languages that describe specific types of data,including mathematical formulas, chemicalmolecular structures, music and recipes. • describes data in a way that human beingscan understand and computers can process.
XML • http://www.w3schools.com/xml/xml_validator.asp
XML Parser in the Browser • When a user loads an XML document in a browser, a parser parses the document, and the browseruses a style sheet to format the data for display
XML Elements • The root element of an XML document encompasses all its other elements • XML element names can be of any length and cancontain letters, digits, underscores, hyphens andperiods • XML element names must begin with either a letteror an underscore, and they should not begin with “xml” in any combination of uppercase andlowercase letters, as this is reserved for use in theXML standards
DOCUMENT TYPE DEFINITIONS • DTDs and schemas specify documents’ element typesand attributes, and their relationships to one another • DTDs and schemas enable an XML parser to verifywhether an XML document is valid (i.e., its elementscontain the proper attributes and appear in the propersequence) • 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
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 thenamespace • We declare a default namespace using keyword xmlns with a URI (Uniform Resource Identifier) asits value
W3C XML SCHEMA DOCUMENTS • which to define your XML document structure andlimitations. • XML schemas provide a set of basic types, such asinteger, 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, tocreate complex types of their own.
XSL AND XSLT • XSL is a style sheet language for XML documents. • XSL is more than a style sheet language. XSL consistsof 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 XMLdocument by adding an xml:stylesheet processinginstruction to the XML document
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
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.
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 XMLschema files
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.
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.
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.
JavaScript • Scripting language which is used to enhance thefunctionality and appearance of web pages. • All major web browsers contain JavaScript interpreters, which process the commands written in JavaScript.
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
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
JavaScript • Often, JavaScripts appear in the <head> section ofthe HTML document. The browser interprets thecontents of the <head> section first • The <script> tag indicates to the browser that thetext that follows is part of a script. Attribute typespecifies the scripting language used in thescript—such as text/javascript
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
JavaScript Statements <html> <head><title>My Page</title></head> <body> <script language="JavaScript"> document.write('This is my first JavaScript Page'); </script> </body> </html> Note the symbol for line continuation
HTML written inside JavaScript JavaScript Statements <html> <head><title>My Page</title></head> <body> <script language="JavaScript"> document.write('<h1>This is my first JavaScript Page</h1>'); </script> </body> </html>
JavaScript Statements <html> <head><title>My Page</title></head> <body> <p> <br /> <a href="myfile.html" onMouseover="window.alert('Hello');"> My Page</A> </p> </body> </html> JavaScript written inside HTML An Event
CHARACTERISTICS • Dynamically typed • Standard operator precedence • Overloaded operators • Reserved words
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
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
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 (alsoknown as the statement terminator), althoughnone is required by JavaScript • JavaScript is case sensitive • Not using the proper uppercase and lowercaseletters is a syntax error
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
WRITABILITY • Comments in JavaScript • <script> // a single line comment /* a multiline comment */ </script>
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
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)
COST • JavaScript is free and open-source