What defines this process best

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply

What is this best defined as?

Script
0
No votes
Event
0
No votes
AJAX
0
No votes
RPC
2
100%
 
Total votes: 2

alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

What defines this process best

Post by alex.barylski »

Invocation from the outside world, no HTML returned or anything. Accepts GPC data and carries out an action on the datastore of choice.

For example:

http://www.domain.com/scripts/create_user.php

1) Script
2) Event
3) AJAX
4) RPC

Script would fine but this is part of an MVC architecture so that doesn't really jive. Event, is really either or, could return HTML might not. AJAX same thing but without a refresh.

For those reasons I'm leaning towards RPC (although strictly not RPC as the handler will typically be invoked using AJAX locally).

I suppose the process of sending a client request to a remote server is something of RPC, but still.

These are rough definitions I have provided, i'm not looking for indepth disscussion on what each actually are...I just want an opinion. :)
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

RPC meaning Remote Procedure Call, I would agree with your assessment...
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Note the HTTP spec only allows for actions to be performed using a POST request. GET should only return an existing resource from existing data. This is the recommended interpretation to reduce the risk of applications falling afoul of CSRF exploits.

Script is just a name for the server-side file - has nothing to do with the Request process itself. It could be loosely termed an event, since it evokes a remote action based on user activity from the browser. At the end of the day it would be a HTTP POST request + parameters which in web services terms is called a RESTful request - so it's not RPC because there's no defined method call interface. If the interface is the URI then you're back to REST.

Lastly, there is always a response. Even an empty body counts because headers are responses ;). A HTTP code must be returned to tell the browser something happened. For both REST and RPC there should be a body explaining to the requester if the expected action was successful or not.

In summary, if its POST + parameters it's no different to a form submission which is REStful. So the closest option on the list is Event since at a minimum it's reacting to user actions. If you want a cleaner name you need a use case to show the context and request method.
Post Reply