16 March 2009
1 Function Overloading or Method Overloading in JavaScript
Function Overloading or Method Overloading in JavaScript
Though JavaScript is an object oriented language, it is not at all supporting function overloading or method overloading. If you had written more than one function with the same function name, the last one will override all the former. That is, you cannot implement function overloading or method overloading in JavaScript. There is an interesting factor regarding this. Let us consider a situation
You had defined a function with one input parameter, but in the function call you are not passing anything, just calling that function. Even now it will not throw any JavaScript error message; it will simply execute that function.
No matter whether your function definition is with or without input parameter, the function will be simply executed without throwing any JavaScript error. Number of input parameter is immaterial in case of the JavaScript function calls, only function name or the method name matters.
Let’s take a look, what will happen if you try for function overloading in JavaScript.
You are defining a function, say funKnight with no input parameter, and then you are defining the same function with different numbers of input parameters and keeping different alert messages for each definition. Then just try to call this function from anywhere of your page, you can see that irrespective of the number of input parameters (zero or more than zero) you passed while calling the function, the last defined one will be executed. And you will be getting the last definition’s alert message. You can try with the code which I had given below. <html> <head> <script language="JavaScript"> function funKnight(first) { alert("FunKnightfirst"); } function funKnight(first,second) { alert("FunKnightfirst,Second"); } function funKnight(first2) { alert("FunKnightfirst2"); } function funKnight() { alert("Simple-FunKnight"); } </script> </head> <body> <input type="Button" name="inputButton" value="Click here" onClick="funKnight()"> </body> </html>
I had tried this code (method overloading or function overloading) with all the leading browsers such as Internet explorer 7.0 and lower versions, Mozilla Firefox 3.0.7 and lower versions, Google chrome and Opera; I could not implement function overloading anywhere. The last definition did simply override every other. Let’s conclude, till the date Browsers are not supporting function overloading (Method overloading) for JavaScript
11 March 2009
0 Thick client and Thin client programs difference
As a developer you may have a question about the advantages and disadvantages of thin client as well as thick client programs. If you are an online application developer somewhere you would have been feel the following questions in you mind at least once.
What are the advantages/disadvantages of developing solution as thick client?
What are the advantages/disadvantages of developing solution as thin client?
Here you go……
Desktop application (Thick client applications)
Advantages of thick client applications
1) Performance - Application Response to user's request will be faster
2) Cost development/deployment is less
3) Extremely rich GUI is possible
4) Offline working possible (with low cost)
5) Accessing local resources/hardware is simple/easy
Disadvantages of thick client applications
1) High Operation or Maintenance Cost - Each release may need a reinstallation or patch upgrade to all the clients.
2) Overall more computing resources required (when the resources of all the client machines put together)
3) More Energy cost - overall more energy utilized
4) Less secured as the program is distributed to all the clients
5) Depending upon the increase in application resource utilization for each release/version, there might be a need to upgrade all the client hardware.
6) Each OS might need a different build (even in some cases of swing application)
Web based application (Thin Client applications)
Now a days with RIAs most of the desktop applications can be developed in web based application (while cost of development being higher).
Advantages of thin client applications
1) Low Operating/Maintenance cost
2) Overall low computing resources required
3) Less Energy Cost - Overall less energy is utilized
4) More secured
5) More Portable - deploy once run anywhere
6) In case of RIA - can have almost all of the features in desktop application
Disadvantages of thin client applications
1) Cost development/deployment is high
2) Difficult to develop extremely rich UI
3) Offline working is costly or impossible
4) There might be a performance issue - in case of more network intensive calls to server.