More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  udooz!PhotosProfileFriendsMore Tools Explore the Spaces community

udooz!

Always Computing
Updated 5/28/2007
December 26

Humax v0.2

You may aware that I have released version 0.2 of Humax.  In this version, I have implemented the AOP programming support.  As of my actual plan, I have planned to implement the following things also:

·         Asynchronous Programming

·         Packaging script

Though I have implemented the AOP concept two months before, I had no time to write the tutorials, due to my sister marriage.  It took two weeks to complete the tutorial section for Humax v0.2.  I had planned to provide lot of pictorial representation in the tutorial section, but the time did not allow me further.

The version 0.2, by the grace of God, has received massive response.  I would like to do benchmarking a web application which uses Humax AOP against normal class-hierarchy model.

I invite people to give their positive and negative feedbacks on Humax.  The main objective of Humax is yet to achieve, to make Humax as an enterprise web framework in very near feature.

I invite people to create new design patterns and best practices based on Humax.  With your support, I will try to provide best on Humax.

Happy Web.

July 31

Humax and JavaScript

I’ve started to think on writing a new framework for client side web development after writing series of articles on JavaScript in Web 2.0.  The intention is to break barrier between the client and server side integration.

Numerous mature technologies/concepts are available under commercial or GPL to provide seamless integration between JavaScript and server side technology.  And of course, these tools have features for developing rich internet applications.

The justifications for developing Humax framework are:

·         A framework which enables you to develop RIA applications in a simple and elegant way.

·         Minimal learning curve.

·         Minimal integration means that it simplifies and tries to provide a unified platform for developing web applications.

The primary difference I’ve focused are the necessary level of abstraction and programmatic approach as like you are working in .NET and Java form application development.

I shall update the roadmap and feedback/feature list later.

I was started the development in end-June 2007 and because of the other stuffs in my leisure time did not allow me to release this as early.

You can download the version 0.1 beta from http://sourceforge.net/projects/humax

Tools of the Trade

I would like to share the tools I have used for the development of Humax v0.1.

Aptana IDE

Though it is not a visual editor, I am using this IDE for writing client side script even for my other works also.  The code profile and dynamic type redefinition features of this IDE provide you full-fledged intelli-sense in JavaScript file.  The JavaScript file skeleton window enables you to manage and navigate the JavaScript files more easily.  It supports JSDoc, provides tooltip syntax for your class and normal HTML/JavaScript elements.

What else you want?  I do not find any other IDE like this in the case of JavaScript.

JSDoc

This tool generates javadoc-style documentation from well-formed JavaScript source files.  It is my favorite document generation tool for JavaScript and I have used this for Humax API reference documentation.

JsUnit and scriptaculous-js

I was bit confused which tool I need to use for unit testing.  In early days of development, I was used “scriptaculous-js”.  It is very simple and does not require more settings to start write and test the “unit test”.  And after a while I am also started using JsUnit. 

July 20

Microsoft Real World SOA Kit

Yesterday I have received the “Real World SOA” kit from Microsoft India.  The kit was covered by a cute blue with orange color bordered box with the caption “Microsoft presents Real World SOA – SOA that leverages your existing IT infrastructure”.

After opening the box, I saw a letter from Karun Thareja, Sr. Product Manager in Microsoft India regarding the specialty of the kit.  The kit contains two white papers, one leaflet about BizTalk 2006 and one “Understanding SOA with Web Services” book.

It was surprised for me that other than the above the kit does not contain trial or demo software, feature products leaflet.  The letter by Karun Thareja conveys a clear message that Microsoft is seriously thinking about your IT infrastructure for SOA and of course the feature of its products.

I started to read the whitepaper on “Enabling Real World SOA through the Microsoft Platform”.  Though it was published on December 2006, it briefly explains SOA, its important and the line of products from Microsoft for SOA.  I was pretty impressed the way the whitepaper started.   I’ve read lot of SOA papers from various companies, some of them are not clear about SOA even though they have released tools for SOA.  Some of them presenting SOA in such a way to show it as a complex one as like as rocket science.  This white paper explains SOA and its benefits in a simple manner and helping the people to know where to start and how to start their SOA implementation.  One fine thing I’ve found that Microsoft  recommends to start SOA implementation with “Middle out” strategy with one business need at a time, instead of going with “Top-down” or “Bottom-up” approach.

I am yet to read another one whitepaper “Understanding BizTalk Server 2006” by David Chapell – Chappell & Associates at August 2005.  But hope that it will be good.

Finally, without any explanation, everybody knows the major intention of this kit is “Microsoft BizTalk”.  Why not?

May 28

Discipline in Object Orientation – [JavaScript – The Platform for Web 2.0 Part III]

As per our "Anything on…" slogan, there are numerous ways we can define properties and methods for a class. This flexibility is more helpful in the implementation of bulky script animation, drag n drop, etc. But for a normal UI validation and business entity manipulation we have to follow a discipline. This will enable us to maintain and enhance a JavaScript code in long-time manner.

Firstly, let us see the different ways to define a class.

Object Declaration

Way 1

See the code snippet 1.

function Point(x, y)

{

this.x = x;

this.y = y;

this.toString = function(){return "(" + this.x + "," + this.y + ")";}

}

var point = new Point(10, 5);

alert(point.toString()); //shows (10,5)

Code Snippet 1

Figure 1 explains the nature of this approach.

A class named "Point" is defined with two properties (x and y) and a method "toString()". All the definitions are bundled within "Point" constructor. But technically, there are two issues with this approach; both make this approach as not optimal:

  • Each instance of Point class will have its own copy of members (x, y and 'toString()'). It is feasible for "field" declarations, but harmful for "method" declaration. Each instances has their own copy of code for "toString()".
  • The arguments of above constructor (x and y) are global to all members. Yes, toString() can access the arguments "x" and "y". Is it optimal?

Way 2

As we know that "new" operator in JavaScript enables us to create instance of a class. The function followed by "new" means that it acts as a constructor for the class. The declaration and initialization are happened in the same place as like code snippet 1. Also, JavaScript does the more work. The lifecycle of an object creation is depicted in figure 2.

  1. Point class is declared and defined.
  2. An object of Point is created.
  3. JavaScript, creates "prototype" object with "constructor" property refers the Point constructor and add this as a property of point instance.
  4. If we defined Point as specified in code snippet 2, all the prototype specific members are initialized and added to point instance's prototype member.

In figure 2, upto point 3, there is no different between way 1 and way 2. After instantiating Point with "new", JavaScript add an object "prototype" to the instance "point" as property. By default, "prototype" object has a property named "constructor". Whenever, prorotype is initiated, it assigns the corresponding object's constructor function to its "constructor" property.

If we define the Point class properties and methods in its prototype object, then it can be sharable. That is, each instance has separate "property" values and share same function point. See code snippet 2.

Point = function(x, y)

{

this.x = x;

this.y = y;

};                 

        

Point.prototype.toString = function()

{

return "(" + this.x + "," + this.y + ")";

}

Code Snippet 2

We can refactor code snippet 2 to create more discipline in the next article.

May 21

JavaScript – The Platform for Web 2.0 – Part II

The next feature in JavaScript nowadays acts a protocol between web client and server. We know that there are two types of web development technologies available in the market.

  1. Pure server side technology. (ASP.NET, Servlet)
  2. Mixed mode technology. (PHP)

The first one raises necessary level of abstraction between client and server side processing. Second one mixed with actual HTML page. Both have pros and cons. Most consumers wants the first one because of its abstraction and separation between UI rendering and UI processing. And it allows us to do object-design. Also, it provides more flexibility to interact with business services of a particular application.

How do the client and this server side talks with each other? Till pre-Ajax, we did by passing a string of HTML/CSV/Plain text/XML. The more general and gentle approach is XML. But based on customer's SLA (Service Level Agreement), the developers selected the feasible one. In any approach, we need a to and fro converter on both server and client. In server, the result of a process (generally business entities or value objects) is converted to anyone of the above approach. In client, based on the approach we need to write JavaScript code to parse these values. We cannot fully say this approach is MVC's (Model-View-Controller) baby because the OO is missing here.

Then now, is there any Ajax implementation to resolve this? Solution is available. But it is not an invention of Ajax. It is a feature of JavaScript. What is that?

In JavaScript specification, it is called as object literals.

Let us take one example. NJS Shopper is an online application for a grocery shop. After a customer placed list of items and paid online, the system finally shows him what are all items he ordered and price for these. The application server returns these information as a business entity named "OrderDetails". The figure 1 shows the details of this entity.

Figure 1

I am not going to explain the business details of the above. Before going further on how can we implement a protocol to speak both server and client in "object" context, let us see what Object Literals is?

Object Literals

We can create a JavaScript object (again object, not class) using object literals. All the members of an object can be declared as name-value pair with color separated. Each members are separated by commas and enclosed within {} as like arrays. For example,

var orderDetails = {orderID:19092, customerName:"Sheik", netAmount:2184.00};

Unlike C++/C#/Java, in JavaScript, we can create an object without any class declaration. One more proof of "Anything can be defined…" slogan.

Now think that, instead of passing HTML, XML or plain text from server to client, we can create object literals at server side and send it to client. Then, JavaScript can process the object literals. At server side, we have to write a converter for the above entity to JavaScript object literals. For example, here I've written a very basic server side code snippet for OrderDetails excluding orders field in ASP.NET 2.0.

StringBuilder orderDetailsBuilder = new StringBuilder();

 

orderDetailsBuilder.Append("{");

orderDetailsBuilder.AppendFormat("orderID:'{0}', customerName:'{1}', netAmount:{2}}}",

orderDetails.OrderID, orderDetails.CustomerName, orderDetails.NetAmount);

Response.Write(orderDetailsBuilder.ToString());

Response.End();

Caution: In .NET, using reflection we can generate object literals more general and in abstract manner. The above code snippet is just for example.

The following code snippet shows that how to handle the returned object.

var asyncReq = new ActiveXObject("Msxml2.XMLHTTP");

asyncReq.onreadystatechange = function()

{

    if (asyncReq.readyState == 4)

    {

        if (asyncReq.status == 200)

        {

          var resultString = asyncReq.responseText;

          var orderDetails = eval("(" + resultString +")");

          alert("Customer: " + orderDetails.customerName +

              " Order ID: " + orderDetails.orderID +

              " Net Amount: " + orderDetails.netAmount);

         }

    }

};

asyncReq.open("GET", "Default.aspx?a1=od", true);

asyncReq.send(null);

In AJAX period, this is called as JSON – JavaScript On Notation, a best protocol for server to client transmission.

View more entries
 
by 
by