[Pharo-users] Defensive programming or not

Kasper Osterbye kasper.osterbye at gmail.com
Mon Sep 23 04:18:53 EDT 2019


Cheers all,

In trying to fix one of the issues in Pharo, I came to wonder about the
prefered style in in dealing with preconditions to methods in Pharo.

In the method Random>>nextInt: anInteger

   - There is a check if anInteger is negative
   - There is no check that anInteger is anInteger

When should I put a guard there, and throw an early warning, and when is it
part of the (often implicit pre-condition)?

Best,

Kasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190923/9d28a906/attachment.html>


More information about the Pharo-users mailing list