Dear monks,

Often when writing code, i try to encapsulate the code in a class, library, package (depending on the language used) so that it can be reused if necessary.

Doing so i often find myself thinking about the same issues over and over again :

  • How much functionality should the library encapsulate ?
    Is it better to make ALL the functions that are related to a common goal available to the application programmer OR should i mask these behind 1 or 2 method calls ? The former will allow for greater flexibility (maybe unnecessary) , the latter will greatly simplify its usage. Or should i do both and really complicate things ?
  • Who is responsible for error handling and error resolving ?
    Should the library trap any foreseeable error and deal with it OR should this be left to the application programmer ?

    If there is a standard to writing libraries as to what you should expose and what not then i'ld like to hear about it...

    Jorg

    "Do or do not, there is no try" -- Yoda


    In reply to How to write library code by jorg

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.