Results 1 to 8 of 8

Thread: Functions or subs?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Foxer's Avatar
    Join Date
    Oct 2001
    Location
    Australia
    Posts
    278

    Functions or subs?

    When writing vb.net classes, I'm told that the only "things" that should be accessed by "the public" are properties and methods.

    ie there shouldn't be any

    Public Sub MySub()

    declarations in a class. There might be private sub's within a VB class but the theory explained to me is that any public method should return a success/fail flag indicating that only public functions should be used (along with property set/get).

    Is this best practice?

    Do ppl use Public Subs? Is that considered bad form?


    Is it better form for every method to be in the form of a public sub with parameters (including error codes). If a sub needs to return anything, it does so via parameter or by setting a property that can be read after calling the actioning sub? If that were so, then Public Functions wouldn't be needed within a class?



    I bet someone will say "depends on the problem".

    Last edited by Foxer; Nov 5th, 2003 at 11:20 PM.
    Rate my response if I helped

    Go Hard Or Go Home


Posting Permissions

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



Click Here to Expand Forum to Full Width