delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/14/14:57:18

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Z-buffering for Allegro (long)
Date: Sat, 13 Sep 1997 17:04:14 +0100
Organization: None
Distribution: world
Message-ID: <ye0vjeA+lrG0EwO1@talula.demon.co.uk>
References: <34145012 DOT D39BD118 AT xs4all DOT nl>
<hiPrcABThHG0EwOz AT talula DOT demon DOT co DOT uk> <5vccuo$6ht AT freenet-news DOT carleton DOT ca>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 56
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Paul Derbyshire writes:
>I suspect the need now is for Allegro to go OO. Yep, Object-oriented, C++.

I beg to differ. You are equating a design methodology with a
programming language, but the two are really quite different things. You
can write object oriented code in any language, just as you can write
straight procedural code in C++...

I think that object based design is usually a good thing, and I tend to
think along those lines no matter what language I am using, but it isn't
a magic wand that you can wave about to cure all your problems :-)
Making something good is a lot more complicated than that, and getting
too enthusiastic about one particular way of thinking tends to blind you
to all the other interesting possibilities...

In the case of Allegro, while I agree that C++ is in many ways a better
language than C, I think that changing language would be big mistake.
For one thing, it would cause a good three or four months of
concentrated work, when the whole goal of this exercise is to _reduce_
my workload. For another, we would end up with a new API that was
totally incompatible with all the existing Allegro programs, and we
would remove the possibility of Allegro being used with any language
other than C++ (it is easy to call C functions from asm, Pascal,
Fortran, etc, and Peter Monks even wrote a wrapper for using Allegro in
Eiffel programs: that would be almost impossible if it was all written
in C++). Designing a good library is very different to writing
application code: I think one of the most important goals is to make it
useable for the widest possible number of different tasks, which means
always aiming at the lowest common denominator. In the case of
programming language, that is C, not C++...

But maybe most importantly, is Allegro not already quite object oriented
enough? Just compare a typical bit of code:

    BITMAP *bmp = create_bitmap(320, 200);
    clear(bmp);
    putpixel(bmp, 10, 10, 2);
    destroy_bitmap(bmp);

with a C++ implementation of the same:

    BITMAP *bmp = new BITMAP(320, 200);
    bmp->clear();
    bmp->putpixel(10, 10, 2);
    delete bmp;

To me, it seems that the change is just a matter of syntactic sugar, and
in fact the BITMAP object is being used in identical ways in both
languages. Allegro already has objects, constructors, destructors, etc,
so why go to all the trouble of a complete rewrite just to change the
way in which they are called?


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019