Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » AJAX the easy way

This thread is locked; no one can reply to it. rss feed Print
 1   2 
AJAX the easy way
Michael Jensen
Member #2,870
October 2002
avatar

It's just easier. :o

easier = faster development times for me.

I can make an entire site with almost no code (the ide will even write stored procs for you if you need it to -- also expression web, another great m$ product, will write some server side ASP.NET code too IIRC...)

Matthew Leverton
Supreme Loser
January 1999
avatar

I really don't think the comparison to STL is meaningful here. When I program in PHP, I don't care how the array is handled. When I program in .NET, I don't care how its array is handled either.

There is nothing hard about doing AJAX. The trouble with .NET programmers is they wait for Microsoft to solve their tasks and the minute they are outside the comfort zone of look and click, they are in trouble. They often end up just slopping crap together that "works" but is as optimal as driving from Chicago to New York via Los Angeles.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

easier = faster development times for me.

To give a more literal example of what Matthew just said, you end up with pages redirecting the client 2-3 times per page view because you stick a server post-back control in where a link should go, and then your pages require javascript for no good reason. If you're really bad, you will lay out your page using absolute positioning (I think VS 2003 had this called a "Web Panel" or something, but VS 2005 doesn't do it), completely destroying any trace of accessibility.

Oh, and then when your application requirements change and instead of fixing the problem at its root you simply add some code somewhere intermediate in the process, maybe add some code in a later event to cope with code in a previous one or something.

It's really easy to write really bad code if you don't know what's going on.

P.S. I don't mean to imply that "you" (or any one person) would make all of these mistakes. They are just the worst things that I have seen in my .NET development lifetime.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Matthew Leverton
Supreme Loser
January 1999
avatar

I had to dash off earlier, so I couldn't complete my previous post. Give a newbie the STL. Don't explain how it works to him. He might just very well take the std::vector and start inserting elements into the middle of it. If he'd ever taken a data structures course, he'd realize a std::list is a way better choice.

When I use std::vector, I understand how it's implemented. I know what's going on behind the scenes. In fact, I could write my own vector class. I have no need though, because I couldn't add anything to the supplied one.

The AJAX in .NET is an extremely high level component that is overlaying a lot of lower level stuff. Do people actually know whats happening? If not, be prepared for some horrible performance. If a programmer can easily write his own AJAX-RPC and understands how the Microsoft component works, then I have no problem with its use.

In other words, if you truly understand your tools, then go for it. But I question how good a high-level AJAX solution can work for general purpose, useful scenarios without an unnecessary performance loss occurring

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

If a programmer can easily write his own AJAX-RPC and understands how the Microsoft component works, then I have no problem with its use.

Excellent way to phrase it.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Francois Lamini
Member #7,791
September 2006
avatar

I use AJAX to kill those silverfish that try to eat my cerial. I found two of them in my captain crunch yesterday.

Francois

CGamesPlay
Member #2,559
July 2002
avatar

You really shouldn't put it on your food... it's highly caustic.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

HoHo
Member #4,534
April 2004
avatar

Quote:

I use AJAX to kill those silverfish that try to eat my cerial

I usually use it to clean windows and other surfaces
.
http://ajax.jp/images/usa.jpg

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

amarillion
Member #940
January 2001
avatar

I prefer STL and I'm more a fan of PSV :D

gnolam
Member #2,030
March 2002
avatar

Jamie Rieger said:

So Ajax ties the poor cow to his tent pole and tortures it to death. He slaughters all the other animals as well. The next morning the madness passes and he finds himself sitting dazed and drenched in blood amidst an absolute tornado of outraged cow parts. His stunned family and friends ask him, “What the fuck did you just do?!”

“It’s not what you think,” he tries to explain. “I thought I was murdering people!

But it’s too late. The Achaean children are already making up rhyming songs about what a dumbass he is, and his honor is fatally besmirched. Murdering his kings, commanders, fellows, and friends would have been one thing. The man lost a contest after all. But murdering sheep? Loooo-ser. Laughingstock. There’s nothing Ajax can do now but fall on his sword. He alone among the Greeks at Troy is given a simple burial. There is no funeral pyre for Aias.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

nonnus29
Member #2,606
August 2002
avatar

Quote:

You can cause user controls, etc to do invisible posts to the server without mucking each other up, make your datagrids etc not require post backs for things like "edit" -- a text box will just show up... --- all this WITHOUT changing any of your applications existing code...

When I read things like that portrayed as 'advantages' I just cringe. All that crap over the wire is death for a application with any real volume.

The unstated cost of using vis studio and the atlas stuff is the cost of training people to use it like I eluded to above. In addition to the cost of licensing it. The reason I don't use eclipse is because it's to complicated for the projects I work on.

So Pros:

1) super productive for those who know the tool
2) great for low volume sites
3) great for sites that require little design

Cons:

1) High cost of ownership
2) Training
3) Undiscplined use will result in poor code quality both performance and maintainability
4) Proprietary, EVIL. :P

ImLeftFooted
Member #3,935
October 2003
avatar

I'd rather just do it myself. Its funner that way and more flexible.

Neil Walker
Member #210
April 2000
avatar

Quote:

In other words, if you truly understand your tools, then go for it. But I question how good a high-level AJAX solution can work for general purpose, useful scenarios without an unnecessary performance loss occurring

I expect you're a XAML hater as well ;)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Matthew Leverton
Supreme Loser
January 1999
avatar

The reason I don't particularly find it (namely the screencast) impressive is that you can easily do things like this (in Javascript):

var t = new wTable(document.getElementById('data-grid'));
t.enableEdit([ 'int', 'int', 'string' ]);
t.onRowChange = function(id, fields)
{
  var rpc = RPC.create();
  for (var i in fields)
    rpc.addField(i, fields<i>);

  rpc.post('/rpc/update.rpc/foo/' + id);
};

Where wTable is a class I created that enables the user to double click a cell to edit its contents.

Then foo.rpc could look like:

<?php
  $dbo = DBO::get($req[0] /* model type */, $req[1] /* id */);
  if ($dbo->hasPermission(DBO::PERM_WRITE))
  {
    $dbo->setProperties($_POST);
    $dbo->update();
  }
?>

This is about 75% of what is needed to get a fully functional, automatic data updates across the site using a generic method. And any coder who is worth hiring can easily figure out what's going on and extend it to fit specific needs.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

All that crap over the wire is death for a application with any real volume.

A properly designed AJAX application should use less bandwidth than a static one :)

Quote:

So Pros:

Don't forget the debugger! Single greatest feature of VS. Also, don't assume that all applications coded in Visual Studio are foolishly made drag 'n' drop applications. Keep in mind sites like http://msn.com and http://microsoft.com are written using it.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Matthew Dalrymple
Member #7,922
October 2006
avatar

Drag and drop programming mmmm... sounds like the Alice of game programming.

=-----===-----===-----=
I like signatures that only the signer would understand. Inside jokes are always the best, because they exclude everyone else.

Michael Jensen
Member #2,870
October 2002
avatar

Quote:

you end up with pages redirecting the client 2-3 times per page view because you stick a server post-back control in where a link should go, and then your pages require javascript for no good reason.

and whoever "you" is, should get smacked for it...

Quote:

you will lay out your page using absolute positioning (I think VS 2003 had this called a "Web Panel" or something, but VS 2005 doesn't do it), completely destroying any trace of accessibility.

ditto.

Quote:

When I read things like that portrayed as 'advantages' I just cringe. All that crap over the wire is death for a application with any real volume.

Umm... all that crap would have to go over the wire, and more, without ajax... when you click the edit button in a classic asp.net application's datagrid, it posts the whole page back to the server and the server sends back rendered HTML for the FULL page -- not only does it hit the server harder, but MORE data is sent per click... With Ajax it only sends the data and the javascript client-side does all the work... infact it's not even xml data -- there's a smaller footprint data format they for with Atlas/Ajax .NET data to be passed back and fourth, they look sort of like .ini files... It's been since summer since I read about the format though, IIRC it looked something like this:

MyData { 
X=15
Y=23
Z="Hello World"
};

Quote:

4) Proprietary, EVIL.

Excuse me? Isn't all of the source openly avilable? Including the javascript source? And M$ even endorses the usage of their Ajax javascript in non ASP.NET applications...

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

IIRC it looked something like this:

Whoa, are you absolutely sure it didn't look like this?({ X: 15, Y: 23, Z: "Hello World" });If so, it actually makes sense ;)

How well does Atlas degrade?

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Michael Jensen
Member #2,870
October 2002
avatar

it could be like that; again, my memory is vague and rusty about the actual file format and I've not touched it -- only seen it once or twice during this last summer during an atlas presentation... -- I remember it generally looked something like that, and kicks xml in the nuts when it comes to file size.

degrade? you'll have to explain that term, I'm just a lowly high-level programmer.

edit:
I also remember a binary format for web services (as opposed to xml format) -- a presenter wrote a program that was basically a web service and a consumer -- he did something to the web service to put it into binary mode or some such (I wasn't paying a lot of attention, but it was as simple as just changing a property somewhere), it only took 300 - 500 milliseconds to send the data -- the same data in xml took about 20 seconds (all localhost to localhost) -- it wasn't a real bench mark or anything, just a proof of concept that one was faster than the other...

The binary format is proprietary obviously, since everyone expects a web-service to be xml -- but if you're just writing a web service to be consumed by a .NET desktop app, then you're ok...

It'd be really cool if Asp.Net Ajax could handle binary web data between ASP.NET and the javascript client... (For reducing the amount of data sent over the wire.) and I wouldn't be suprised if the Ajax team has plans to do it at some point.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

degrade? you'll have to explain that term, I'm just a lowly high-level programmer.

You test your websites in browsers without JavaScript support, right?

Quote:

just a proof of concept that one was faster than the other...

In my most recent application, I decided to serialize using XML after consideration: the XML serialization was easier to code, but bandwidth for this application was the top priority. I looked at the XML code and found that using a binary format wouldn't save much bandwidth at all, because the entire XML document fits into a single packet, anyways. I say this just to point out that blanket conclusions never work (haha, get it? I said "never").

Quote:

It'd be really cool if Asp.Net Ajax could handle binary web data between ASP.NET and the javascript client...

I can't speak for ASP.NET's implementation, but JavaScript and XML both support it, so it's easily possible. Just something simple like this:<?xml version="1.0"?><data><![CDATA[/*File data inserted*/]]></data>Adds a constant overhead of 46 bytes, plus any occurrence of "]]>" in the binary data must be replaced with "]]>]]><![CDATA[".

[append]
Of course, I think all browsers support receiving content that isn't XML (including the misnamed "XmlHttpRequest"), so you don't even need to wrap in XML.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Michael Jensen
Member #2,870
October 2002
avatar

Quote:

You test your websites in browsers without JavaScript support, right?

Is that what you meant?

We test our public websites on machine's without javascript, we usually also put a little caution for them in a noscript tag that they should upgrade their browsers or turn it back on.

Because we don't give public access to areas of our sites that use dynamic technology (mostly employee only stuff) we simply require that they have Javascript turned on.

Quote:

because the entire XML document fits into a single packet, anyways.

-- He was sending something pretty small, like 4 or 5 integer values, and a string of text -- also it recv'd a string of text from the client upon request before sending anything (most clients have slower upload than download speeds) -- he generated some absurd number of requests, and the binary beat xml hands down -- of course this wasn't a true bench mark, for all we know it could have been that binary data was just a lot quicker to pack/unpack, and the network load was only increased slightly.

 1   2 


Go to: