Software Architecture Prof. Dr. Bertrand Meyer. Lecture 6: Exception Handling. What is an exception?. “An abnormal event” Not a very precise definition Informally: something that you don’t want to happen…. Exception vocabulary. “ Raise ”, “trigger” or “throw” an exception
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Software ArchitectureProf. Dr. Bertrand Meyer
Lecture 6: Exception Handling
Fails, triggering an exception in r (r is recipient of exception).
In Eiffel & Spec#, will go away
A
B
P(A)
P(B)
Powerset
such that r () = and for any subsetsXandYof A,r (XY)=r (X)r (Y)
The set of relations from A to B is also written
A
B
For r AB XA
the setr (X)is called the image of Xbyr


The set of functions from A to B is written
B
A
The domain of a function fA B , written domainf,is the largest subset XAsuch that fX B



Convention:
For fA Band a A, we may write
f (a)
(as for a total function)
if we prove that a domainf
Routine call
r0
r1
r2
r3
r4
In Eiffel
attemptlocaleven: BOOLEANdoifeventhenalgorithm_2elsealgorithm_1endrescueeven := noteven; retryend
createx.make (…)
S1
x.f (…)
S2
x.g (…)
S3
x.f (…)
S4
deposits
(A2)
withdrawals
balance
Scheme 2:
controlled_execute([
agentaction1,
agentaction2 (...),
agentaction3 (...)
])
ifglitch then
warning(glitch_message)
end