By polterguy
via ajaxwidgets.com
Published: Sep 14 2007 / 08:27
Wow guys, I really had to scratch my eyes HARD to believe what Somasegar was writing about before I could believe it...
By polterguy
via ajaxwidgets.com
Published: Sep 14 2007 / 08:27
Comments
lem z replied ago:
Dude, you have to learn to control your outbursts of anger and think your points through before you make fool out of yourself publicly.
... enhanced support for client side JS localization:
here's one for you:
totalDiv.innerHTML = $.localize(calculateTotal());
do I need to say more here? okay
whenDiv.innerHTML = $.localize(figureOutDayOfWeek());
what? some more?
whenDiv.innerHTML = $.parseLocalizedDate(input.value).month;
Currently for all of these you have to either write your own or hit the server to get a simple conversion.
... on the subject of exposed APIs...
Security my friend... You don't expose your $.makeAdmin(me) to the public. Once you have make those APIs available to a trusted client, need I point out all convenient features of it?
polterguy replied ago:
Let me show you some alternatives;
totalDiv.Text = calculateTotal().ToString(System.Threading.Thread.CurrentUICulture);
whenDiv.Text = someDateTimeObject.ToString("DD");
whenDiv.Text = DateTime.Parse(input.Text).ToString("MMM");
Now if you cannot see the advantage of doing those samples in THAT way instead of your scheduled way I don't think it's possible to keep arguing with you. And regarding "hitting the server" how are you going to call a WebServer without managing to go to the Server...?
BUSINESS LOGIC ON THE SERVER and GUI AND NOTHING ELSE THEN GUI on the Client...!!!!!!!!!!!
Thomas Hansen
lem z replied ago:
Did you just change the syntax of my pseudo code? None of those a calls you have in your example are possible with plain vanilla JS.
Exposing APIs to JS has nothing to do with putting business logic into it. If I have a check box next to a user name to make him a moderator and I click it, you have three options:
1. resubmit entire page
2. hit your own AJAX handler which will call membership API
3. hit membership API directly
The whole business logic argument is pretty much mute in the real world where most of the applications are developed by teams consisting fewer than 3 people and best practices are often set aside in favor of timely delivery and convenience. Nobody is forcing you to use it, the API is there if you need it and helps you avoid writing stupid proxy calls.
polterguy replied ago:
I did far more than just changing your syntax, I moved the entire execution into the server instead of having them execute on the client...
Regarding your checkbox you have a fourth option, raising an Event which is being caught 100% typed on the server-side in your OnCheckedChanged Event Handler. In fact let me show you an example; http://ajaxwidgets.com/AllControlsSamples/CheckBoxList.aspx
My whole idea is that Ajax must be a 100% transparent mechanism where the only difference is in the rendering of the controls and page and if that can't be achieved you're basically having business logic on the client...
lem z replied ago:
Your "raising Event" is covered by my #2 point - hitting your own AJAX handler which wraps existing APIs.
polterguy replied ago:
Ehhh....
NO!
Voters For This Link (9)
Voters Against This Link (9)