trollish

Discussion in 'C Programming' started by RoS, Dec 17, 2007.

  1. RoS

    RoS Guest

    you are always too secure to be right

    one function that do 1000 operation is better than 1000 that have only
    one funcionality

    example a not bugged standard C sscanf is bettar than all the other
    for input all togheter and the str* too

    the same a unified way to do input-output: socket , files, pipes etc

    **all is easy** only people find a smart way for complicate it
    or for not document it or for reject it
    RoS, Dec 17, 2007
    #1
    1. Advertising

  2. [snips]

    On Mon, 17 Dec 2007 13:03:53 +0100, RoS wrote:

    > you are always too secure to be right
    >
    > one function that do 1000 operation is better than 1000 that have only
    > one funcionality


    Actually, exactly the opposite is true: it is better to have 1,000 that
    each do one job, than one that does 1,000 jobs.

    First, the huge 1,000-option function is likely to be much harder to port
    and to debug, making it less all-around useful.

    Second, it's going to tend to make things big: if I'm working on a small
    system, I get this huge function which does 900+ things I don't need,
    instead of getting a few small functions which do exactly what I need, and
    don't waste space otherwise.

    It also tends to make the code cleaner and more maintainable. As a simple
    example, if the function can be used to read both strings and single
    chars, and I use the "read single char" option, is that what I actually
    meant, or did I actually mean to read a string? If I'm calling
    get_string(), it's pretty obvious, and if I'm calling get_string but
    trying to store the result in a char, or I'm calling get_char() and trying
    to store the result via a pointer, chances are the compiler will warn,
    where a "multipurpose" function will tend to bypass most such warnings.
    Kelsey Bjarnason, Dec 21, 2007
    #2
    1. Advertising

  3. RoS

    RoS Guest

    In data Fri, 21 Dec 2007 04:54:06 -0800, Kelsey Bjarnason scrisse:
    >[snips]
    >On Mon, 17 Dec 2007 13:03:53 +0100, RoS wrote:
    >
    >> you are always too secure to be right
    >>
    >> one function that do 1000 operation is better than 1000 that have only
    >> one funcionality

    >
    >Actually, exactly the opposite is true: it is better to have 1,000 that
    >each do one job, than one that does 1,000 jobs.


    but for doing this you have to remember how work 1000 differents
    functions (*that always not follow the same rules*)
    for example
    the rule for errors
    the rule for the first argument
    the rule for the second argument etc etc

    >First, the huge 1,000-option function is likely to be much harder to port
    >and to debug, making it less all-around useful.


    it is false

    >Second, it's going to tend to make things big: if I'm working on a small
    >system, I get this huge function which does 900+ things I don't need,
    >instead of getting a few small functions which do exactly what I need, and
    >don't waste space otherwise.


    it is false (true only if you need a reduced functionality)

    >It also tends to make the code cleaner and more maintainable. As a simple


    this is false

    >example, if the function can be used to read both strings and single
    >chars, and I use the "read single char" option, is that what I actually
    >meant, or did I actually mean to read a string? If I'm calling
    >get_string(), it's pretty obvious, and if I'm calling get_string but
    >trying to store the result in a char, or I'm calling get_char() and trying
    >to store the result via a pointer, chances are the compiler will warn,
    >where a "multipurpose" function will tend to bypass most such warnings.


    i see the thing in this way, but it probably i make errors
    --
    Merry Christmas, Happy Hanukah, Happy New Year
    Joyeux Noel, Bonne Annee.
    RoS, Dec 23, 2007
    #3
  4. RoS said:

    > In data Fri, 21 Dec 2007 04:54:06 -0800, Kelsey Bjarnason scrisse:
    >>[snips]
    >>On Mon, 17 Dec 2007 13:03:53 +0100, RoS wrote:
    >>
    >>> you are always too secure to be right
    >>>
    >>> one function that do 1000 operation is better than 1000 that have only
    >>> one funcionality

    >>
    >>Actually, exactly the opposite is true: it is better to have 1,000 that
    >>each do one job, than one that does 1,000 jobs.

    >
    > but for doing this you have to remember how work 1000 differents
    > functions (*that always not follow the same rules*)


    The whole point of having functions is that you don't have to remember
    their internal workings all the time. On those occasions when you need to
    find out, however, it's easier to read a short function than a long one.
    At times of maintenance, it's easier to find and fix a problem or outdated
    code section in a short function than in a long one - and it's easier to
    get a short function working in the first place.

    <snip>

    > i see the thing in this way, but it probably i make errors


    Yes. Your view of code development is not one that will ever gain
    widespread acceptance amongst people who know what they're doing.

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
    Richard Heathfield, Dec 23, 2007
    #4
  5. RoS

    Richard Bos Guest

    Kelsey Bjarnason <> wrote:

    > On Mon, 17 Dec 2007 13:03:53 +0100, RoS wrote:
    >
    > > you are always too secure to be right
    > >
    > > one function that do 1000 operation is better than 1000 that have only
    > > one funcionality

    >
    > Actually, exactly the opposite is true:


    Why are you rtying to educate a piece of rock?

    Richard
    Richard Bos, Dec 24, 2007
    #5
  6. RoS

    Default User Guest

    Richard Bos wrote:

    > Kelsey Bjarnason <> wrote:


    > > Actually, exactly the opposite is true:

    >
    > Why are you rtying to educate a piece of rock?


    I agree with Richard. Killfile or ignore is the best solution for him,
    Kenny, various other trolls and nutters. You will not be able to
    logically convince them of anything.



    Brian
    Default User, Dec 24, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page