Re: Why is scanf such a nightmare to use?
- From: "BGB / cr88192" <cr88192@xxxxxxxxxxx>
- Date: Mon, 6 Sep 2010 15:16:07 -0700
"James Dow Allen" <jdallen2000@xxxxxxxxx> wrote in message
On Sep 2, 10:31 pm, Malcolm McLean <malcolm.mcle...@xxxxxxxxxxxxxx>
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
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
.... 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
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...
- Prev by Date: Re: Bitwise Operator Effects on Padding Bits
- Next by Date: Re: Bitwise Operator Effects on Padding Bits
- Previous by thread: Re: Why is scanf such a nightmare to use?
- Next by thread: Re: Why is scanf such a nightmare to use?