alt
Advertisement
Sponsored links
Online Training
Career Series
Exforsys
Sponsored Links
Exforsys arrow Microsoft AJAX


Microsoft AJAX

In this chapter, you'll learn about OOP (Object-Oriented Programming) and how it relates to JavaScript. As an ASP.NET developer, you probably have some experience working with objects, and you may even be familiar with concepts such as inheritance.

However, unless you're already an experienced JavaScript programmer, you probably aren't familiar with the way JavaScript objects and functions really work. This knowledge is necessary in order to understand how the Microsoft AJAX Library works, and this chapter will teach you the necessary foundations. More specifically, you will learn:

  • What encapsulation, inheritance, and polymorphism mean
  • How JavaScript functions work
  • How to use anonymous functions and closures
  • How to read a class diagram, and implement it using JavaScript code
  • How to work with JavaScript prototypes
  • How the execution context and scope affect the output of JavaScript functions
  • How to implement inheritance using closures and prototypes
  • What JSON is, and what a JSON structure looks like

Microsoft AJAX Library Essentials - http://www.packtpub.com/ajax-csharp-essentials/book

Start Here
Microsoft AJAX Library Essentials: Client-side ASP.NET AJAX 1.0 Explained By Cristian Darie, Bogdan Brinzarea. A practical tutorial to enhancing the user experience of your ASP.NET web applications w...

Tutorial Index
  1. Object-Oriented JavaScript In this chapter, you'll learn about OOP (Object-Oriented Programming) and how it relates to JavaScript. As an ASP.NET developer, you probably have some experience working with objects, and you may even be familiar with concepts such as inheritance. However, unless you'r...
  1. Object-Oriented JavaScript Objects and classes are implemented differently in JavaScript than in languages such as C#, VB.NET, Java, or C++. However, when it comes to using them, you'll feel on familiar ground. You create objects using the new operator, and you call their methods, or access their f...
  1. JavaScript Functions A simple fact that was highlighted in the previous chapter, but that is often overlooked, is key to understanding how objects in JavaScript work: code that doesn't belong to a function is executed when it's read by the JavaScript interpreter, while code that belongs to a functi...
  1. Functions as Variables In JavaScript, functions are first-class objects. This means that a function is regarded as a data type whose values can be saved in local variables, passed as parameters, and so on. For example, when defining a function, you can assign it to a variable, and then call the fun...
  1. Anonymous Functions Anonymous functions can be created adhoc and used instead of a named function. Although this can hinder readability when the function is more complex, you can do this if you don't intend to reuse a function's code. In the following example we pass such an anonymous function to D...
  1. JavaScript Classes Not only can JavaScript functions contain other functions, but they can also be instantiated. This makes JavaScript functions a good candidate for implementing the concept of a class from traditional object-oriented programming. This is very helpful feature indeed, because JavaSc...
  1. C# and JavaScript Classes For the purpose of demonstrating a few more OOP-related concepts, we'll use another class. Our new class is named Table, and it has two public fields (rows, columns), and one method, getCellCount(). The getCellCount() method should return the number of rows multiplied by t...
  1. Thinking of Objects as Associative Arrays A key element in understanding JavaScript objects is understanding the notion of associative arrays, which are nothing more than collections of (key, value) pairs. As a .NET developer you have worked with associative arrays represented by classes such as Na...
  1. Creating Object Members on the Fly One major difference between OOP in C# and ASP.NET, and OOP in JavaScript, is that JavaScript allows creating object members "on the fly". This is true for objects and classes that you create yourself and also for JavaScript's own objects and types as well. Here's...
  1. JavaScript Execution Context In this section we'll take a peek under the hood of the JavaScript closures and the mechanisms that allow us to create classes, objects, and object members in JavaScript. For most cases, understanding these mechanisms isn't absolutely necessary for writing JavaScript co...
  1. Inheritance using Closures and Prototypes There are two significant techniques for implementing the OOP concept of inheritance with JavaScript code. The first technique uses closures, and the other technique makes use of a feature of the language named prototyping. Early implementations of the Mi...
  1. Inheritance using Prototypes Once again, prototyping can help us implement an OOP feature in a more elegant way than when using closures. Prototype-based inheritance makes use of the behavior of JavaScript prototypes. When accessing a member of a function, that member will be looked for in the fun...
  1. Introducing JSON In AJAX applications, client-server communication is usually packed in XML documents, or in the JSON (JavaScript Object Notation) format. Interestingly enough, JSON's popularity increased together with the AJAX phenomenon, although the AJAX acronym includes XML.

 

 
Exforsys Offers
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape