Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

Tutorials

Java Server Pages

JAXB

Java Beans

JDBC

MySQL

Java Servlets

Struts

Bioinformatics

Java Code Examples

Interview Questions

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting

Linux

Beginner Guide to Linux Server

Frameworks

Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers

Softwares

Adware & Spyware Remover

Open Source Softwares

 JavaScript Object Oriented Feature

                         

In this article you learn the basics of JavaScript and create your first JavaScript program.

What is Object Oriented Feature
The ASP.NET and Visual Studio 7.0 are making important contributions to improvement of the web development experience. Unfortunately, this is also a tendency created among developers to limit their interaction with JavaScript. it is Clearly JavaScript is valuable for adding client-side functionality to the web pages. However the ASP.NET programming models suggest that developers produce page layout while emitting client-side JavaScript from ASP.NET controls. As a consequence, this model tends to limit JavaScript to procedural adjuncts. This is rather unfortunate because it severely limits the power of an object-oriented scripting language that developers can be use to write rich and reusable client-side components. JavaScript  object oriented will be presented in a series of  three type article. The first installments provided background on  JavaScript supports the main principles of object-oriented programming. The second  part demonstrates how JavaScript constructs can be used to build a class inheritance framework and write scripts supporting in JavaScript class hierarchy. The third and final installment  to use the JavaScript class framework to build object-oriented client-side abstractions of ASP.NET user controls.

There are Some reasons of way JavaScript Object Oriented Capability are not utilized:
There are tendency of client-side operations to be discrete favorite procedures. 
The ASP.NET programming model are controls suggests limiting JavaScript to the functional adjuncts. 
Legacy JavaScript lacked key features such as exception handling and inner functions and JavaScript its supported for object- oriented programming .  
 

 Example:

<html>
<head>
<Script language="JavaScript">
function MyClass()
{
this.myData = 10; 
this.myString = "my frist program";
}
var myClassObj1 = new MyClass();
var myClassObj2 = new MyClass();
myClassObj1.myData = 20;
myClassObj1.myString = "Obj1: my second program";
myClassObj2.myData = 30;
myClassObj2.myString = "Obj2: last program"; 
alert( myClassObj1.myData ); 
alert( myClassObj1.myString ); 
alert( myClassObj2.myData ); 
alert( myClassObj2.myString ); 
</script>
</head>
</body>
</html>

Object-Oriented Programming
The Object Oriented programming is a computer programming paradigm. Object Oriented programming is that computer program may be seen as comprising a collection of individual units and objects, that is on each other, as opposed to a traditional view in which a program may be seen as a collection of functions or procedures, or simply as a list of instructions to the computer. Each object is capable of receiving messages, processing data, and sending messages to other objects. The Object-oriented programming is claimed to promote greater flexibility and maintains in programming, and is widely popular in large-scale software engineering. Further the more proponents of OOP claim that Object-Oriented programming  is easier to learn  those new to computer programming than previous approaches and that the OOP approach is often simpler to develop and to maintain, lending itself to more direct analysis or coding, and understanding of complex situations and procedures than other programming methods.

Object:
The Object an instance of a class and object is the run-time manifestation of a particular exemplar of a class. The class of dogs which contains breed types, an acceptable exemplar would only be the subclass 'collie'; "Lassie" would then be an object in that subclass. Each object has own data, though the code within a class a subclass or an object  may be shared for economy. Thus, object-oriented languages must allow code to be reentrant. 

Encapsulation
The Object-Oriented program using the myclass as defined permits accessibility of its internal data representation as well as this methods and variable names global in scope increasing the risk of name collisions. The Object-Oriented program Encapsulation supports data hiding and the concept of viewing objects as self-contained entities providing services to consumers. The principle of information hiding is the hiding of  The design decisions in a computer program that are most likely to change, thus protecting other parts of the program from change if the design decision is changed. Protecting is a design decision involves providing a stable interface which shields the remainder of the program from the implementation . Encapsulation is a  modern programming languages of  the principle of information hiding itself in a number of ways, including encapsulation and polymorphism.

Example:   

<html>
<head>
<Script language="JavaScript">
function MyClass()
{
var m_data = 15;
var m_text = "indian";
this.SetData = SetData;
this.SetText = SetText;
this.ShowData = DisplayData;
this.ShowText = DisplayText; 
function DisplayData()
{
alert( m_data );
}
function DisplayText()
{
alert( m_text );
return;
}
function SetData( myVal ) 
{
m_data = myVal;
}
function SetText( myText ) 
{
m_text = myText;
}
}
var Obj1 = new MyClass();
var Obj2 = new MyClass();
Obj1.SetData( 30 );
Obj1.SetText( "Obj1: my cuntry" );
Obj2.SetData( 60 );
Obj2.SetText( "Obj2: my first javaScript progarm" );
Obj1.ShowData(); 
Obj1.ShowText(); 
Obj2.ShowData(); 
Obj2.ShowText(); 
</script>
</head>
</body>
</html>

 

 

                         

Useful Links
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.