The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. January 07, 2009, 07:27:27 PM

Login with username, password and session length


Pages: 1 [2]
  Print  
Author Topic: The Argument Against Ajax  (Read 4251 times)
m0nkeymafia
Expert
****
Offline Offline

Posts: 236


Check it!


View Profile
« Reply #15 on: May 21, 2007, 04:13:39 AM »

Great post perk, I have a curve ball or two to throw in the mix though

JS validation:
I believe JS validation should be a supplement to server end, in that its there merely to catch simple mistakes.  The core and grunt should be done on the server.  Why? Because it means some punk cant turn off his javascript and bypass your security measures. Any ajax requests should only be done because the validation you require cannot be done simply in JS.  And when you submit the form it should still be validated server side.  It is the only way to prevent dodgeyness.

Perk I think you under-estimate the power of XML within the AJAX framework.
Say for example you have an XML document, created dynamically server side, that lists all online members, their nick names, IP addresses and what not.

What I would do is create a number XSL stylesheets to parse the document into various xhtml fragments.  For example with this one XML document [and call to the server] you could list all members online.  Sort by username, ascending, descending, ip address, blah blah [you can sort them with about 1-2 lines of JS once you wrote the XSL].  You can also count how many people are online, how many people are online with attribute A being true.

The power this gives you is amazing, seriously.  If you do ajax, then learn XSL, its possibly the best thing ive learnt in the past year.  With the example I gave, it means you can change any part of the display process without changing the backend.  XSL is also extremely maintainable, much more so than JS and of course its functionality doesnt vary between browsers, so you have less hassle that way.

Oh and PHP has an XSL parser too, so the XSL stylesheets you write for ajax will parse exactly the same in PHP...oh yes...OH YES...so this means that if someone has JS turned off, with literally no extra leg work you can output the content with php [page refresh required obviously].  So not only do you have an extremely flexible framework, highly maintainable, which looks cool and is faster than doing it any other way.  You also cater for people with JS turned off [or incompatible browsers] with no extra cost to you.

So guys...XSL? Do it? DOOO IT 
« Last Edit: May 21, 2007, 04:22:27 AM by m0nkeymafia » Logged

I am Tyler Durden
thedarkness
Global Moderator
Lifer
*****
Offline Offline

Posts: 581



View Profile
« Reply #16 on: May 21, 2007, 05:14:38 AM »

How are you working out reliably that the browser has javascript disabled? Thanks for the skinny on XSL, well worth a look.

Cheers,
td
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #17 on: May 21, 2007, 08:32:28 AM »


Server: My process writes to a file this exactly: [number completed] | [number to do] so it’s like 50|100. Since it is the only process that can wirte to this file

How are you assuring this perk, semaphore maybe? How would you achieve this using APC?
Hey TD -

Sorry man, I thought for sure I had responded to that... the file I write is named from the sessionID. But you are correct, and in fact that's where my new stuff is going, that it's all kept in a variable in APC doing the same for more speedieness.
To your oether point though, I am worried about cache pollution and fragmentation. Gonna have to watch that for quite a while and see if it pisses me off at all.

/p
Logged

If I can't be Mr. Root then I don't want to play.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #18 on: May 21, 2007, 08:37:21 AM »

JS validation:
I believe JS validation should be a supplement to server end, in that its there merely to catch simple mistakes.  The core and grunt should be done on the server.  Why? Because it means some punk cant turn off his javascript and bypass your security measures. Any ajax requests should only be done because the validation you require cannot be done simply in JS.  And when you submit the form it should still be validated server side.  It is the only way to prevent dodgeyness.
Absolutely correct MM, and I'm not throwing server side away... I am simply going the 100% opposite direction of people that ONLY put validation on the server. Taking just a few extra steps on the client keeps a lot of traffic down... of course, you'll still get boneheads trying to break you ergo you must protect your service, but if you have a lot of real traffic and can completely cleanse the form data before it goes upstream it means a lighter load on the server.


Perk I think you under-estimate the power of XML within the AJAX framework.
Say for example you have an XML document, created dynamically server side, that lists all online members, their nick names, IP addresses and what not.

What I would do is create a number XSL stylesheets to parse the document into various xhtml fragments.  For example with this one XML document [and call to the server] you could list all members online.  Sort by username, ascending, descending, ip address, blah blah [you can sort them with about 1-2 lines of JS once you wrote the XSL].  You can also count how many people are online, how many people are online with attribute A being true.

The power this gives you is amazing, seriously.  If you do ajax, then learn XSL, its possibly the best thing ive learnt in the past year.  With the example I gave, it means you can change any part of the display process without changing the backend.  XSL is also extremely maintainable, much more so than JS and of course its functionality doesnt vary between browsers, so you have less hassle that way.
[ clip ]
So guys...XSL? Do it? DOOO IT 
Really important part of that puzzle MM: If you know XSL. I do not and have yet had the time to even look at it. From what I read, you are 100% correct that I'ma bonehead for not putting it in my toolbox... perhaps you could help us out here because I am certain that I'm not the minority... Howz about you monkey around a bit with a quick tutorial to kick off a board...?
Logged

If I can't be Mr. Root then I don't want to play.
m0nkeymafia
Expert
****
Offline Offline

Posts: 236


Check it!


View Profile
« Reply #19 on: May 22, 2007, 02:11:47 AM »

No probs perk ill whip one up
P.s. im not sure how im comin across, i like to rock the boat in terms of techniques, but not having a "pop" if you get me Wink
Logged

I am Tyler Durden
thedarkness
Global Moderator
Lifer
*****
Offline Offline

Posts: 581



View Profile
« Reply #20 on: May 22, 2007, 04:24:01 PM »

lol, you'll find most of us are not very "delicate". We spend a lot of our time in "flame fest alley"  ROFLMAO  ROFLMAO

Cheers,
td
Logged

"I want to be the guy my dog thinks I am."
 - Unknown
nutballs
Administrator
Lifer
*****
Online Online

Posts: 3525


View Profile
« Reply #21 on: May 22, 2007, 04:33:19 PM »

In order to be able to rock a boat, there must be a boat. the problem with this group is we tend to blow up our own boats, and sink them, so we gave up on boats. I personally have just gone the jesus route, and learned to walk on water. but thats me.

though im guessing there is eventually going to be a bunch of tender softies sooner or later on here.
Logged
m0nkeymafia
Expert
****
Offline Offline

Posts: 236


Check it!


View Profile
« Reply #22 on: May 23, 2007, 03:26:56 AM »

What you mean you cant already walk on water?
j00 sux0r
Logged

I am Tyler Durden
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #23 on: May 23, 2007, 09:57:19 AM »

My personal solve is simply to spend more time with the little man in the boat.

Nice chap, prone to being excitable. Can be a little cold at first, but really warms up if you just spend a little time with him. Very likely to let you spend more time in the boat if you get him on your side.

Yikes... cold shower time.
/p
Logged

If I can't be Mr. Root then I don't want to play.
m0nkeymafia
Expert
****
Offline Offline

Posts: 236


Check it!


View Profile
« Reply #24 on: May 23, 2007, 10:23:51 AM »

Perk sounds like you had some good times with that man in that boat  ROFLMAO
Logged

I am Tyler Durden
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #25 on: May 23, 2007, 11:02:10 AM »

Story of my life pal  Wink

Frightening, talking about that stuff and looking at your avatar thought actually  ROFLMAO
Logged

If I can't be Mr. Root then I don't want to play.
Pages: 1 [2]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!