Mail Archives: djgpp/2003/01/26/23:00:45
"Joe Fischer" <gravity1 AT shell1 DOT iglou DOT com> wrote in message
news:3e349961_3 AT news DOT iglou DOT com...
> In alt.msdos
>
> Mark Clements <usenet AT nokennel17spam DOT co DOT uk> wrote:
> :> Joe Fischer <gravity1 AT shell1 DOT iglou DOT com> (PATHTYPER) wrote:
> :> > I don't write the same routines a second time,
> :> > let alone over and over.
> :> > With the exception of part of the routine to
> :> > assign a filename and file variable and check the
> :> > existence of the file, I can't think of any routine
> :> > that I would use twice.
> :
> : As just one of many examples of functions I've written that get used
over
> : and over again, my CheckInputFile() function is used in pretty much any
> : program that requires filenames to be passed at the command line.
>
> That's great, if you do a lot of programming using files.
>
> : You pass
> : the value of the argument variable where the file is located (or empty
> : string if none) and a default extension (if applicable) and it will
expand
> : the filename and path, checking they exist, and prompt the user if there
are
> : any problems.
>
> There area lot of possibilities using DOS error
> checking, a BBS Sysop program called Qmove had some,
> and I added several more to one version of it.
> These types of programs are very useful, but
> some of use just like to play with graphics, display,
> and game programs. :-)
>
> : The trick to making modular programming useful is
> : to make your functions generic.
>
> I am grateful for any and all programs having
> considerable utility.
> But in my programming, my objective is to
> write _the_ program and make it work with a minimum
> of bugs, some of which are due to my stupidity and
> carelessness and some from the compiler and OS the
> program is run on.
> I have zero ambition to avoid having to write
> code, in fact, the reason I write is to have more
> to do to pass the time.
> I get a big rush when I finally get lucky
> and write something that works great and is a
> little bit different or useful, or fun.
This is not a program I was talking about, but a single function that I use
in many programs, and which could always be useful. You're writing a
program to display a JPEG? - here's how to parse the command line. You're
writing a game? Here's how to load a saved game or ini file from the
command line. The point I was making was not so much about the example
though, more that there are loads of things (particularly if you mostly work
in one area) which you will use over and over, so no point reinventing the
wheel every time (and of course, tried and tested code shouldn't have bugs
in it...)
The best feeling when programming is, as you say, writing good code that
works well, particularly first time (although probably even more
particularly after a night of tearing your hair out). The second best thing
though is coming up against a tricky problem that will surely take days, and
then realising that those well-designed functions from your previous project
just slot right in and voila - you've pretty much done it!
--
Mark Clements
(To reply, remove NOSPAM)
- Raw text -