Rich Web Client Programming

What is the main problem in the development of rich web clients? The problem is that rich application
(no matter Windows Forms or Web Forms based) always relies on rich objects. Saying rich means well structured hierarchal classes and the means to manipulate these structures. Unfortunately noting exists on the client side to facilitate this task. We have Java script language - pretty adequate language that syntaxically allows to manipulate the structured data, but there is no mechanism to deliver these structures from the server to the client and back from the client to the server. At best we can use XML parser. But do we have to?

RWC solves these problems completely. Hence all the objects originate on the server, we create the objects (classes) of virtually any complexity on the server, initialize them, register them with RWCDF and then the framework will generate already initialized objects for the client.

After you finish your data manipulation on the client side , the objects get sent back to the server using traditional PostBack or [and ] synchronous/asynchronous AJAX. You can also invoke the methods directly on the server using background AJAX calls passing the objects (the classes) as parameters. For the efficient data manipulation we need collections as well. Without dynamic structures like ArrayList and Hashtable the implementation of any serious data manipulation engine is very time consuming.
For this purpose ArrayList and Hashtable are implemented and included into the framework
In other words the framework unifies the server and the client data manipulation. With this framework the programming of the web client is almost identical to the programming of the server side.

Framework Programming
The first logical step is to create the data structures that will serve our needs.

public class EmployeeAddress
{
   public string City;
   public string Country;
   public string Street;
   public string Phone; 
   public ArrayList PhotoAlbum = new ArrayList();
}

public class Employee
{
   public long somelong = 8598065;
   public double Salary = 787878.344;
   public float Scale = 8.66F;
   public string Name;
   public string SName;
   public string Title;
   public string Position;
   public int Age;
   public DateTime Date;
   public string PictureUrl;
   public EmployeeAddress Address;
   public bool Married = true;
   public ArrayList SomeDataCollection;

   public Employee
   {
      Address = new EmployeeAddress();
   }
}

Take a note that the instance of the EmployeeAddress class is the member of the Employee class.
Actually the depth of the nested classes is not limited.
Now we create the instances of Employee(s) and initialize them.

ArrayList MyEmployees = new ArrayList();
Employee emp = new Employee()
emp1.Name = "Bob";
emp1.SName = "Smith";
emp1.Title = "Mr";
emp1.Position = "waiter";
emp1.Date = new DateTime(2003, 2, 6);
emp1.Address.City = "London";
emp1.Address.Phone = "(043)8984 63535";
emp1.Age = 33;
emp1.PictureUrl = "BobSmith.jpg";

//add employee to ArrayList
MyEmployees.Add(emp);
//....then create more employees and also add them to ArrayList
MyEmployees.Add(emp1);

After that we need only to register the object (s) which we want to use on the client - in our case
it is ArrayList of Employee objects - MyEmployees.

Convertor.RegisterObject("MyObjectKey", MyEmployees);

The number of registered objects is not limited.
After that the object MyEmployees can be accsessed on the client as Javascript class ArrayList

var EmployeesArrList = _Get("MyObjectKey");

Get the first employee:

var emp = EmployeesArrList.GetAt(0);
alert(emp.SName + ", " + emp.Name + "," + emp.Title +
"," + emp.Position + "," + emp.Address.Street);

Same with other Employees.

The employees in the collection can be modified and sent back to the server via traditional PostBack or [and] Ajax.
You can invoke the method on the server with EmployeesArrList as parameter as well.

var Params = new Array();
Params.push(EmployeesArrList );
var Ret = r.Invoke("ReadEmployeesMethod", Params);

You can create the instance of the Employee (s) and initialize it :

var Emp1 = new Employee ();
Emp1.Name = "Peter";
Emp1.Age = 20;
.....

And so on ...
Add this employee to the collection

var EmpCollection = new ArrayList();
EmpCollection.Add(Emp1);

Add other employees and send this collection to the server [PostBack/Ajax]
On the server side the objects are received as the instances of the objects which have been previously registered.

Doesn't that resemble normal object oriented programming?

RWC  Live demo