Re: [buildcheapeeg] BWView improvements

From: Jim Peters (jim_at_uazu.net)
Date: 2002-03-01 13:49:40


Doug Sutherland wrote:
> Well, I don't want to have wars over this, but if we
> do C++ it makes sense to do OO style modeling.

Yes, go for it !! I am not going to argue with anything that looks
usable !

> If you want to configure a device with a command-line
> string then you are considering that device to be a
> program, there is no programming interface (API).

You could look at my file.c thing as a 'class', and the instantiation
of a new object of that class is setup using a filename and a
format-spec. This weird format-spec includes the identity of the
particular sub-class, and results in an instance of the sub-class
(with a call-back routine 'read', which takes care of the
sub-class-specific stuff, and 'read_data' for the sub-class-specific
data).

In other situations, the weird format-spec could equally well be a
'hash' (i.e. associative array), or very nearly equivalently, a
command-line string. That is what I meant.

I think you could call this whole thing 'informal object-orientation',
as it does the same thing without the formal structure. I'm using a
format-spec string because it is completely open-ended. A particular
sub-class can require anything it likes in there, interpret it however
it wants. There is no need to have any code anywhere that even knows
about these extra facilities of the sub-class. It is purely between
whoever entered the format-spec and the particular sub-class
(i.e. format type) that gets to deal with it.

I think in traditional OO, you would need some code somewhere that
would understand the extra facility of some sub-class to be able to do
some extra thing, and call the appropriate 'set' function. Also, you
would need to name the sub-class in the source somewhere higher up
where it is instantiated, which I don't have to do.

Maybe my approach is too informal (maybe too Perl-inspired), but it
seems workable to me.

Anyway, as you say, there is no need for a war on this. If someone
can write good usable code in a pure OO style using C++, then no
problems, we'll use it.

> Your desire to have command-line control is a perfect example
> of why we need abstract interfaces. You want command line,
> others want GUI, and I want to do some alternative interfaces
> like infrared remote and voice control. So let's pick one
> function: you have brightness control in your program. If we
> separate WHAT gets done from HOW it gets done, everyone can
> be happy.
>
> setBrightness(int level)
> // code that actually changes the brightness

Don't worry -- I appreciate all this. I really like Java for how easy
it made coding object-oriented stuff. I have also fought long and
hard battles with C++ trying to get it to do things the way I want
them done. I even wrote a preprocessor that let me write C++ in a
Java style, even handling automatic compilation of other files like
javac does and not requiring separate header files. I never released
it, because C++ is so huge and complex, I only got it to cover the
relatively small part of C++ that I actually needed. I did actually
write an app (which I still use) using this mongrel language, before
dropping the idea (yet another unfinished project!).

As you might expect from a "clever" programmer like me (or "ex-clever
programmer, trying to give it up, honest!"), I have a much better
language that I have designed. It will truly revolutionise something,
somewhere, maybe never. This is a "Plan" (capital "P") if ever there
was one! However, in the mean time, and being realistic, I think I'll
just write code in the most suitable tool to hand, which means C.

Give me half a chance and I will abstract anything I touch to a
ridiculous degree, and the thing may never get off the ground. I'm
trying to stay close to ground level, just abstracting what is
necessary, in the interests of concrete results. I have no
self-control if I try and abstract the whole problem at once, because
I am a *dreamer* (Toltec terminology), and I can model the whole thing
in my head in endless detail. There are no limitations of time or
space in my head, which unfortunately is not true in the real world.

Look at the pyramid in my .sig (or on my web-site). This is the way
forwards for me, building from the ground up. (There may also be
other significant aspects behind my choice of this symbol that I
haven't understood yet). Dreaming the solution is a skill I have, but
I really need to stay concrete all the way if I am going to be of real
use to this project.

Many thanks for your understanding, all concerned!

Jim

-- 
Jim Peters (_)/=\~/_(_) jim_at_uazu.net
(_) /=\ ~/_ (_)
Uazú (_) /=\ ~/_ (_) http://
B'ham, UK (_) ____ /=\ ____ ~/_ ____ (_) uazu.net


This archive was generated by hypermail 2.1.4 : 2002-07-27 12:28:39 BST