Re: Why is scanf such a nightmare to use?




"James Dow Allen" <jdallen2000@xxxxxxxxx> wrote in message
news:e1c8a41e-788b-4b84-830d-d109c0ff1932@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Sep 2, 10:31 pm, Malcolm McLean <malcolm.mcle...@xxxxxxxxxxxxxx>
wrote:
The more complicated a function the less flexible it is.

<--
Good point! But what about functions that become too
complicated *because* they're trying to be (too) flexible?
-->

this is called over-engineering...

flexibility by including every possible feature is a false sense of
flexibility, and at best means that eventually reaching its limits will
become catastrophic...

IMO, it is much better to split a problem into a large number of
minimalistic pieces, and then rebuild the solution from these pieces, every
piece with a simple and well defined task.

with this strategy, new functionality doesn't have to be designed into or
retrofitted onto the pieces, since if everything works right, then they will
adapt to the new functionality without noticing that anything has changed.


granted, there are drawbacks as well (namely, that this process tends to add
a lot to the total time and effort and produces code larger than idea and
possibly awkward to drag around), and so often it is better to compromise,
and implement "short-cut" solutions.

decomposing a problem too far can also be a case of over-engineering...


<--
Include me as one who's never mastered the complexities
of sscanf() and prefers the flexibility of friends
like strchr().
.... though until recently I used its BSD synonym, index().
:: whack in the side of the head ::
-->

I have often wrote special purpose functions operating directly on the
strings.
although, part of this was motivated by at one point operating in a
situation where no standard library was available (OS kernel development),
and all functionality had to be provided by writing it oneself...

this ended up becomming a basic part of the pattern...



.



Relevant Pages

  • Re: Pythons "only one way to do it" philosophy isnt good?
    ... Flexibility of function -- ... It is you who are in denial if you believe that syntax is ... as long as one is provided the required functionality. ... is that a programming language can't provide ...
    (comp.lang.python)
  • Re: Pythons "only one way to do it" philosophy isnt good?
    ... Flexibility of function -- being able ... Functionality is no good if it's too cumbersome to use. ... Scheme gives you first class continuations, which Python doesn't. ...
    (comp.lang.python)
  • Re: Calendar between dates in a query and/or report
    ... This gives you a great deal of flexibility and functionality. ... Duane Hookom ... MS Access MVP ...
    (microsoft.public.access.queries)
  • Re: Dependencies
    ... > powerful facility that enhances portupgrade's usefulness, flexibility and ... > functionality greatly, and the file's syntax is pretty much ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Determine the size of malloc
    ... Malcolm McLean wrote: ... poorly formatted and naive in almost all aspects of functionality. ... emailed the man my suggestions to improve but recieved no replies. ... Of course one shouldn't go for a complicated solution if one doesn't ...
    (comp.lang.c)