[
Lists Home |
Date Index |
Thread Index
]
Hello Mark,
Mark said:
> With REST, you turn a lightbulb on with PUT, because the request is
> attempting to explicitly set the state of a resource; the same PUT
> used for saving preferences, turning on the TV, or just "editing a
> file".
>
> Any task that can be coordinated with RPC, can be coordinated with
> REST in a manner more suitable for Internet scale distribution. If
> you're doing anything over the Internet with people that you haven't
> previously met and may not trust, RPC is the wrong technology.
>
Didier replies:
No problems Mark, show me - with your solution - how the calling program
made any economies of code in the following example:
Example (off course, this is a fictitious problem just for the sake of the
discussion):
We want to set a switch to ON from a remote location. The possible states
are ON, OFF, ERROR. The ERROR state is more precisely defined as:
- error_scheduling_task
- error_power too low
- error_circuit_malfunction
- error_already_set_to_on
- error_already_set_to_off.
All errors loged in a time-stamped log-file.
Ok let's take a simple procedural language now to resolve this problem
if set_switch(ON) != OK then
{
start_log(time());
switch error
{
case error_scheduling_task: log("error_scheduling_task");
case error_power too low: log("error_power too low");
case error_circuit_malfunction: log("error_circuit_malfunction");
case error_already_set_to_on: log("error_already_set_to_on");
case error_already_set_to_off: log("error_already_set_to_off");
}
end_log();
}
else
....
Do not forget that you have to log in a local file someting like:
-----------------------------------------------
time: 12 feb 2002; 22:34:22
error_circuit_malfunction
-----------------------------------------------
Based on the assurance of your reply, you have surely something good to
propose. I am anxious to expand my knowledge.
cheers
Didier PH Martin
|