Programming by Contract

Results 1 to 2 of 2

Thread: Programming by Contract

  1. #1
    SPG Guest

    Default Programming by Contract

    One of the practices heavily emphasized by "The Pragmatic Programmer" ( is programming by contract -- essentially pre-filtering the information your routines accept to ensure that the information is valid for the routine. Now, when using VB intrinsic functions such as &#039inStr&#039, I see that it gives me a limited set of options for what the function will accept. Admittedly, I can override this any time I desire -- but the point is that it&#039s a nice little guardrail for developers with toolTips-enhanced IDEs.<BR><BR>So the question is: How do I get the limited ToolTips selection list on my functions&#039 parameters?<BR><BR>Thx, SPG

  2. #2
    Join Date
    Dec 1969

    Default RE: Programming by Contract

    Not sure if this is what you&#039re looking for, but this code mimics the INSTR function:<BR><BR>Public Enum mpCompare<BR> mpBinary = 0<BR> mpRegular = 1<BR>End Enum<BR><BR>Private Sub Party(Optional Start As Variant, Optional String1 As Variant, Optional String2 As Variant, Optional Compare As mpCompare = mpBinary)<BR><BR>End Sub<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts