Object-Oriented Programming

Object-Oriented Programming OBJECT ORIENTED PROGRAMMING (L056) Object-Oriented Programming Concepts (A few basic concepts before you can begin writin...
Author: Cecilia McCoy
3 downloads 1 Views 110KB Size
Object-Oriented Programming OBJECT ORIENTED PROGRAMMING (L056)

Object-Oriented Programming Concepts (A few basic concepts before you can begin writing any code) •



Object-Oriented Programming (OOP) is a computer programming paradigm (style) OOP was introduced in the 1960's

The idea behind object-oriented programming is that a computer program is seen as a collection of individual objects (modularized functions). Each object may act with each other, as opposed to a traditional view in which a program may be seen as a list of steps by step (Top-Down) instructions to the computer. Each object is able to receive information (parameters), process this information (variables), and send/return information to other objects. Each object can be viewed as an independent engine (module) with a distinct role or responsibility.

Object-Based (Prototype-based) Programming Object-Based (Prototype-based) Programming is a style of objectoriented programming in which classes are not actually present. Behavior reuse (known as inheritance in class-based languages) is accomplished through a process of cloning existing objects. • •

JavaScript is Object-Based. JavaScript is based on the concept of prototypes (Cloning).

In JavaScript a new object is constructed by copying the behavior of an existing object (its prototype). JavaScript is perhaps the best-known prototype-based programming language. (VB languages VB, VBA, VBScript fall into this category VB.Net is a true OOP)

What Is JavaScript...?

A Client-Side language intended to be used for Web applications. A powerful part of DHTML

What JavaScript Is Not... •





It is not the only client side scripting language. o Pearl o VBScript

(Before the introduction of Ajax) It was not intended to communicate commands with a Web server. o It is a Client-Side language o Our applications will communicate with the server using ASP (we will discuss Ajax later)

It is not HTML o It does not use HTML tags It can be used within HTML Web pages It can write HTML tags It can be enbedded into HTMLtags o It does not abide by any of the general rules of the HTML language.







It is not Java o Java is a stand-alone programming language (compiled) o Java was developed by Sun Microsystems o Java can run on its own o JavaScript is its own language JavaScript is interpreted by a Browser and the interpreter must be enabled It is similar in syntax to Java JavaScript is small and portable JavaScript is implemented directly within HTML, like a macro within Microsoft Word It is not static - it is dynamic o JavaScript performs mathematics, stores variables, and dynamically displays content… It is not a 'true' Object Oriented language o JavaScript is not object-oriented in the full classical sense, but it does use objects and is considered to be object-based o It makes no real provisions for inheritance. o It is prototype-based (Object based - like Visual Basic)







JavaScript is not Java applets o Java applets are compiled into byte code format and are executed by the Java Virtual Machine JavaScript is not JSP (Java Server Pages) o JSP is a Java base technology similar to ASP JavaScript is not without issues o Navigation - User Inability or difficulty navigating using the keyboard. Optimized for the mouse Web pages that utilize scripting should be fully navigable using a keyboard o Lack of user control over some items JavaScript should not modify or override normal browser functionality in a way that may cause confusion o Altering or disabling the normal functionality of the user agent (browser) Web pages should be fully functional with JavaScript disabled - or Web pages should provide an accessible, nonJavaScript alternative

JavaScript can be used to increase accessibility Section 508 of the Rehabilitation Act (in the United States) - guidelines: Functionality and content of scripts be accessible to assistive technologies such as screen readers