Re: The wisdom of the object mentors (Was: Searching OO Associations with RDBMS Persistence Models)

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sat, 03 Jun 2006 00:02:12 GMT
Message-ID: <8k4gg.16719$A26.384517_at_ursa-nb00s0.nbnet.nb.ca>


Mikito Harakiri wrote:

> Robert Martin wrote:
> 

>>Could you show me how you would construct a credit request packet from
>>a customer record and send it to the credit service, and then process
>>the response? Just for the sake of argument we'll keep the packet
>>simple. The request packet is just a simple SSN encoded in BCD in five
>>bytes. The response is two bytes that contain a binary number whose
>>value ranges from 0-999. You send the request to port 884 of
>>124.132.4.23, and it will reply within 2 seconds. If it doesn't reply
>>within 2 seconds you need to retry. After the third attempt, you need
>>to declare an error in the current transaction and create a log file
>>entry. Given a valid reply, you set a flag in the customer record to
>>ACCEPTED if the returned value is > 500, otherwise you set the flat to
>>REJECTED.
It looks like the self-aggrandizing ignorant directed the question to me. I added him to my twit-filter ages ago. The solution offered by Mikito is not what I would suggest and doesn't reflect the post to which Martin replied.

Assuming:

1. The SSN is in ssn_var.
2. The customer relvar has a candidate key ssn.
3. The request relvar physically maps to a channel to 124.132.4.23:884

I might propose:

Repeat up to 3 times

	insert into request tuple( ssn_var ),
	wait seconds(2)

until ( result = unwrap ( response )){}
else log_and_abort("The error details");

update customer
set flag = case when result > 500 then ACCEPTED else REJECTED end case where ssn = ssn_var; Received on Sat Jun 03 2006 - 02:02:12 CEST

Original text of this message