JavaScript
  Home arrow JavaScript arrow Object-Oriented JavaScript: Building Real-...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Object-Oriented JavaScript: Building Real-World Examples
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 76
    2005-12-12

    Table of Contents:
  • Object-Oriented JavaScript: Building Real-World Examples
  • The first hands-on example: building object-based pop-up windows
  • Object-oriented AJAX: creating http requester objects
  • A final example: building quick and dirty form validating objects

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Object-Oriented JavaScript: Building Real-World Examples


    (Page 1 of 4 )

    In the first two parts of this series, we've explored the most important points related to object-oriented JavaScript. In this final part, we go through the development of some practical examples for creating helpful objects that can be used in different JavaScript applications.

    Introduction

    Welcome to the last installment of the series “Object-oriented JavaScript.” In three parts, this series introduces the core concepts for working with user-defined object in JavaScript, and shows how to use them, particularly in large applications, where a bunch of reusable objects can very often yield better results than using conventional JavaScript functions.

    In order to refresh the concepts deployed during the previous articles, let’s reflect briefly on some of the most important points regarding the usage of user-defined objects in the JavaScript terrain. For obvious reasons, the first tutorial went through the key points for defining constructor functions and object instantiation, as well as for declaring properties and methods. Also, a few additional object-based features were conveniently illustrated, by taking a brief look at the “constructor” property and “Functions” objects, and their appropriate implementation through hands-on examples.

    Going one step further in the learning curve, in the second tutorial I explained the use of the “prototype” property, which, as you may have realized, is extremely helpful for applying inheritance between objects. It allows the definition of base constructor functions, followed by the derivation of as many objects as required from the corresponding functions. In fact, the most remarkable aspect of using the “prototype” property is the ability to encapsulate as much functionality as possible in base (or parent) objects, and then create child objects that eventually will override or annex properties and methods inherited from the base constructor functions. Pretty nice, right? If you were thinking that only full-fledged programming languages were capable of offering inheritance capabilities, this is really good news.

    Having walked a long way through the nitty-gritty of user-created objects in JavaScript, the question is: what’s next? Well, in this final tutorial I’ll develop some real-world examples that obviously will include custom objects, so you can have a pretty clear idea of how to implement them in modern Web applications. The journey will begin building in pop-up window constructors, as well as http requester objects, and end up developing form validating objects, which you can easily introduce in your scripts. Sounds good enough to you? All right, let’s get started.

    More JavaScript Articles
    More By Alejandro Gervasio


       · This last tutorial shows some examples of how to create user-defined objects in...
       · [quote]The first improvement that comes to my mind is the addition of a “host”...
       · Hello Daniel,Thank you for commenting on my article. And, yes, you're correct on...
     

    JAVASCRIPT ARTICLES

    - Building Dynamic Shadows with JavaScript and...
    - Active Client Pages: Chrys`s Approach
    - The Script Approach to Active Client Pages: ...
    - Principles of Active Client Pages: the Scrip...
    - Active Client Pages: the Script Approach
    - Building an RTF-capable Form with the Ext JS...
    - Creating a Multi-Tabbed Online Form with the...
    - jQuery Overview
    - Constructing a Multi-Column Online Form with...
    - Grouping Field Sets on Dynamic Web Forms wit...
    - Building Dynamic Web Forms with the Ext JS F...
    - More on JavaScript Array Objects
    - Methods of the DOM Location Object
    - The DOM Location Object Properties
    - Handling Remote Files with JavaScript Click ...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT