Now I want to discuss How Different Technology like Flex3,Java,JavaScript handled object and xml,one by one i am discussing below.
Flex:
************
In Flex object are handled dynamically,means there is concept of dynamic classes in Flex,that means If I declare a class dynamic then we can add instance variable and method in that class on run time.For example:
Package com.examples
{
public dynamic class Example
{
function Example()
{
trace("Constructor");
}
}
}
If we subsequently instantiate an Example class, We add properties or methods to it outside the class definition. For example, the following code creates an instance of the Example class and adds a property named "value" to the instance and function to get the setted Value:
var ex:Example=new Example();
ex.value=10;
ex.getValue=function()//creating dynamic function With Example instance
{
Alert.show(this.value);
}
ex.getValue();//output:10
This behaviour is quite useful in practical programming.Like We get data from php,and we have to store in our flex,then we use the object that is dynamic like the following code.
public function getData(serverData):Object
{
var ob:Object=new Object();
ob.id=serverData.id;
ob.name=serverData.name;
ob.age=serverData.age;
return ob;
}
In my openion this is great advantage associated with Flex technology to handled object dynamically.I really fond of that.and calling setter and getter is also very easy,because there is set and get two keywords used for setter and getter.
Now I am highlighting second issue that is handling xml,this is quite easy in Flex.It is native datatype in Flex.This is good from code writing point of view,because we need only few lines to use xml in Flex like.
private function loadXML(evt:ResultEvent):void{
var xml:XML = new XML(evt.result);
}
Now all xml is get converted in xml variable,we can use it,store it for further use.But this is quite
performance hectic task,because any kind of xml get stored using this method,Whether it is of 100kb or 1 kb.So Space complexity get increased,After all user can not afford performance degradation Whether the code writing is painful for developer or not.
Java
***********************
In java or java driven technology like android,j2me or j2ee there is no concept of dynamism,So We should have to declare the prototype of our desired object,that concept is called Bean classes,Like if I have to declare some object having id and name then we should first declare the prototype that is Bean class for that.Like
//Bean Class
public Class BeanSample
{
private int id;
private String name;
public BeanSample()
{
}
public setName(String name)
{
this.name=name;
}
public String getName()
{
return this.name;
}
public setId(int id)
{
this.id=id;
}
public int getId()
{
return id;
}
}
If we have some data having id and name then we use like following code.
BeanSample b=new BeanSample();
b.setId(10);
b.setName("Ashwani");
ArrayList al=new ArrayList();
al.add(b);
This is quite pain staking process to create a bean classes for different structures of data,While in Flex it was handled internally.So here is praise for Flex compare to java.
Now dealing with xml in java is quite efficient according to performance point of view.There are different api for handling xml according to their complexity and structure like SAX(Simple Api for XML) ,DOM(Document object model),So it is responsibility of developer to choose best option to handle different XML,It's a quite fantastic when we had to parse xml and store in java driven technology.
JavaScript
*****************************
Actually there is no comparison of Javascript with above mentioned technology,they are full fleshed object oriented languages,while javascript has different field of implemented area,but In case of above two parameters It also support object dynamicity and XML handling is done by ajax,We have an option in ajax that we can do it synchronously or asynchronously.But we should have to do asynchronously because using this will not halt the UI and graphics.
The code for loading xml is:
var request=new XMLHttpRequest();
var path="http://localhost/Examples/1.php"
request.onreadystatechange=function(){
if (request.readyState==4){
if (request.status==200 || window.location.href.indexOf("http")==-1){
}}};
mygetrequest.open("GET", path , true);//the third parameter is true means this is asynchronous request,use false for synchronous request.
mygetrequest.send(null);
We can load xml,json,text anything using this code.normally we use DOM based XML parsing in
Javacript ajax way of parsing and loading XML.
Flex:
************
In Flex object are handled dynamically,means there is concept of dynamic classes in Flex,that means If I declare a class dynamic then we can add instance variable and method in that class on run time.For example:
Package com.examples
{
public dynamic class Example
{
function Example()
{
trace("Constructor");
}
}
}
If we subsequently instantiate an Example class, We add properties or methods to it outside the class definition. For example, the following code creates an instance of the Example class and adds a property named "value" to the instance and function to get the setted Value:
var ex:Example=new Example();
ex.value=10;
ex.getValue=function()//creating dynamic function With Example instance
{
Alert.show(this.value);
}
ex.getValue();//output:10
This behaviour is quite useful in practical programming.Like We get data from php,and we have to store in our flex,then we use the object that is dynamic like the following code.
public function getData(serverData):Object
{
var ob:Object=new Object();
ob.id=serverData.id;
ob.name=serverData.name;
ob.age=serverData.age;
return ob;
}
In my openion this is great advantage associated with Flex technology to handled object dynamically.I really fond of that.and calling setter and getter is also very easy,because there is set and get two keywords used for setter and getter.
Now I am highlighting second issue that is handling xml,this is quite easy in Flex.It is native datatype in Flex.This is good from code writing point of view,because we need only few lines to use xml in Flex like.
private function loadXML(evt:ResultEvent):void{
var xml:XML = new XML(evt.result);
}
Now all xml is get converted in xml variable,we can use it,store it for further use.But this is quite
performance hectic task,because any kind of xml get stored using this method,Whether it is of 100kb or 1 kb.So Space complexity get increased,After all user can not afford performance degradation Whether the code writing is painful for developer or not.
Java
***********************
In java or java driven technology like android,j2me or j2ee there is no concept of dynamism,So We should have to declare the prototype of our desired object,that concept is called Bean classes,Like if I have to declare some object having id and name then we should first declare the prototype that is Bean class for that.Like
//Bean Class
public Class BeanSample
{
private int id;
private String name;
public BeanSample()
{
}
public setName(String name)
{
this.name=name;
}
public String getName()
{
return this.name;
}
public setId(int id)
{
this.id=id;
}
public int getId()
{
return id;
}
}
If we have some data having id and name then we use like following code.
BeanSample b=new BeanSample();
b.setId(10);
b.setName("Ashwani");
ArrayList
al.add(b);
This is quite pain staking process to create a bean classes for different structures of data,While in Flex it was handled internally.So here is praise for Flex compare to java.
Now dealing with xml in java is quite efficient according to performance point of view.There are different api for handling xml according to their complexity and structure like SAX(Simple Api for XML) ,DOM(Document object model),So it is responsibility of developer to choose best option to handle different XML,It's a quite fantastic when we had to parse xml and store in java driven technology.
JavaScript
*****************************
Actually there is no comparison of Javascript with above mentioned technology,they are full fleshed object oriented languages,while javascript has different field of implemented area,but In case of above two parameters It also support object dynamicity and XML handling is done by ajax,We have an option in ajax that we can do it synchronously or asynchronously.But we should have to do asynchronously because using this will not halt the UI and graphics.
The code for loading xml is:
var request=new XMLHttpRequest();
var path="http://localhost/Examples/1.php"
request.onreadystatechange=function(){
if (request.readyState==4){
if (request.status==200 || window.location.href.indexOf("http")==-1){
}}};
mygetrequest.open("GET", path , true);//the third parameter is true means this is asynchronous request,use false for synchronous request.
mygetrequest.send(null);
We can load xml,json,text anything using this code.normally we use DOM based XML parsing in
Javacript ajax way of parsing and loading XML.
Keep it up good work..
ReplyDeleteGood to know you are trying to learn.