When will C have an object model?

T

Tech07

| When will C have an object model?

It doesn't need one.

I think it does.
Applications may need one, but languages don't.

New language examples disprove that.
If you application needs one, choose a language that has one.

I do (C++), but was maybe looking for a "clean slate" object model and C
looks like a prime candidate to build one on.
 
T

Tech07

Wolfgang Draxinger said:
And even then you can choose any language you like. You'll just have a
little more work to do, implementing all the object system's backend
stuff.

Or use a ready to use object system. For C there is GObject. (Please no
debates, GObject works and does it's job very well. In my experience GNOME
is a lot more stable than KDE, and I'm saying this as a mainly-KDE user).

GPL/LGPL code is not an option for me.
 
T

Tech07

Eric Sosman said:
When the National Hockey League schedules games in Hell.

Anyone here on the standard committee that could summarize what that band of
bros thinks about it?
 
T

Tech07

Herbert Rosenau said:
C++ is not really object oriented. On that I miss real classes, class
factories instead of renamed structs.

You likes to program object oriented? Really object oriented, not ony
C with renamed structs (classes)?

Then look for CORBA.

That would be component-based programming rather than object-oriented.
 
T

Tech07

Default User said:
CORBA? How is that a C object model?

It's not: he's confusing component-based programming with object-oriented
programming. The former is at a higher level (communication between
components in disparate systems, distributed objects etc.) while the latter
is classes/objects/polymorphism etc, at the language level. The former is
inter-language and inter-system while the latter is intra-language.
COM/DCOM/CORBA/DCE are examples of the former while the C++ object model is
one example of the latter.
 
M

Michael Tsang

Herbert said:
C++ is not really object oriented. On that I miss real classes, class
factories instead of renamed structs.

You likes to program object oriented? Really object oriented, not ony
C with renamed structs (classes)?

Then look for CORBA.

In C++, class == struct. Do you know what is a class? From wikipedia:

Class
Defines the abstract characteristics of a thing (object), including the
thing's characteristics (its attributes, fields or properties) and the
thing's behaviors (the things it can do, or methods, operations or
features). One might say that a class is a blueprint or factory that
describes the nature of something. For example, the class Dog would consist
of traits shared by all dogs, such as breed and fur color (characteristics),
and the ability to bark and sit (behaviors). Classes provide modularity and
structure in an object-oriented computer program. A class should typically
be recognizable to a non-programmer familiar with the problem domain,
meaning that the characteristics of the class should make sense in context.
Also, the code for a class should be relatively self-contained (generally
using encapsulation). Collectively, the properties and methods defined by a
class are called members.

In C++, you can really put all these inside a class, therefore, it is a
class. For example:

typedef int32_t Color;
class Dog{
public:
Color color;
void bark();
void sit();
};
 
N

Nick Keighley

Herbert Rosenau wrote:



In C++, class == struct. Do you know what is a class? From wikipedia:

Class
Defines the abstract characteristics of a thing (object), including the
thing's characteristics (its attributes, fields or properties) and the
thing's behaviors (the things it can do, or methods, operations or
features). One might say that a class is a blueprint or factory that
describes the nature of something. For example, the class Dog would consist
of traits shared by all dogs, such as breed and fur color (characteristics),
and the ability to bark and sit (behaviors). Classes provide modularity and
structure in an object-oriented computer program. A class should typically
be recognizable to a non-programmer familiar with the problem domain,

I think that's stretching things a bit. There's loads of stuff in
an OO design that a domain expert wouldn't know about. Unless you're
going to invent a new domain expert for each implementaion technology.

With that sort of reasoning procedural progam could easily have the
same
sort of property.

I'll accept that the Domain specific part of the program will consist
of Domain classes that the domain expert will recognise.
 
G

Guest

|
| |> (e-mail address removed) wrote:
|>
|>>
|>> | When will C have an object model?
|>>
|>> It doesn't need one. Applications may need one, but languages don't.
|>> If you application needs one, choose a language that has one.
|>
|> And even then you can choose any language you like. You'll just have a
|> little more work to do, implementing all the object system's backend
|> stuff.
|>
|> Or use a ready to use object system. For C there is GObject. (Please no
|> debates, GObject works and does it's job very well. In my experience GNOME
|> is a lot more stable than KDE, and I'm saying this as a mainly-KDE user).
|>
|>
|
| GPL/LGPL code is not an option for me.

Then develop and sell, or buy, some proprietary thing that does the same
role.
 
G

Guest

|
| |>
|> | When will C have an object model?
|>
|> It doesn't need one.
|
| I think it does.
|
|> Applications may need one, but languages don't.
|
| New language examples disprove that.

Note that I said that "languages don't". That's languages in general.
The fact that even one language exists that succeeds without it is the
proof of that statement. That some language has an OO model does not
prove anything. That some language NEEDS an OO model is characteristic
of that language, not languages in general.

As for applications, certainly many do need an OO model due to their size
and complexity. Very small applications can even find the opposite case,
where OO just gets in the way. There's also a range in the middle where
having or not having OO may not make much of a difference. Enterprise
management applications like CRM certainly are of the scale where OO is
needed ... if not something else that might do the job better if it were
to be invented.


|> If you application needs one, choose a language that has one.
|
| I do (C++), but was maybe looking for a "clean slate" object model and C
| looks like a prime candidate to build one on.

That would be inventing your own language. That would not be C. You can
make one that is very much like C, or is even a proper superset of C. You
might want to look at Objective-C before you try to re-invent the wheel.
It's the other OO language based on C.

C has a number of things I'd like to change which are unrelated to OO.
Such changes are mostly not practical, or are completely destructive, if
done at any new standardization. But if done as a new language, then it
would not matter. If I were making a new OO language, I'd go for these
changes, rather that being strictly tied to C. And that is for a compiled
to machine code scheme as C, Objective-C, and C++ are (unlike others that
produce some kind of metacode that gets converted or interpreted at run
time).

If you want to know what changes I would make to C, please don't ask in
this thread. Start another one specifically for that purpose.
 
T

Tech07

Nick said:
I think that's stretching things a bit. There's loads of stuff in
an OO design that a domain expert wouldn't know about. Unless you're
going to invent a new domain expert for each implementaion technology.

With that sort of reasoning procedural progam could easily have the
same
sort of property.

I'll accept that the Domain specific part of the program will consist
of Domain classes that the domain expert will recognise.

I don't like the way you use 'domain' to mean "application domain". I
distinguish between "problem domain" and "solution domain". It takes both
kinds of experts to get the job done or someone with expertise in both
domains.
 
B

Beej Jorgensen

Tech07 said:
I do (C++), but was maybe looking for a "clean slate" object model and C
looks like a prime candidate to build one on.

I only skimmed this book, but it looks promising:

Object-oriented Programming with Ansi-C
http://www.cs.rit.edu/~ats/books/ooc.pdf

The author spends the first part of the book implementing OO stuff in C,
and then puts together a preprocessor (a la Objective-C) to help with
syntax.

-Beej
 
T

Tech07

Beej said:
I only skimmed this book, but it looks promising:

Object-oriented Programming with Ansi-C
http://www.cs.rit.edu/~ats/books/ooc.pdf

I've read that, it's still on my desktop, but I don't think there's anything
in this day to glean from it. What did you see that looked promising?

Anyway, I think that some of the C++ object model techniques are good.
That's the standard that all others are compared to. I would use it and
clean it up and change a few things here and there. I wouldn't suggest such
drastic departure from the C++ techniques as are described in the
aforementioned pdf.
The author spends the first part of the book implementing OO stuff in
C, and then puts together a preprocessor (a la Objective-C) to help
with syntax.

The preprocessor is AWK-based.
 
T

Tech07

That some language has an OO model does not
prove anything.

That all significant languages do, does.
As for applications, certainly many do need an OO model due to their
size and complexity. Very small applications can even find the
opposite case, where OO just gets in the way.

Apparently you're a proponent of the language smorgasbord way of software
development: "use what language best fit..", yada, yada. No thanks.

Ah ha! See! :p
That would be inventing your own language.

"hello!". When someone says "C" and "object model" in the same sentence the
way I did, well: "It's not you father's C."
That would not be C. You
can make one that is very much like C, or is even a proper superset
of C.
You might want to look at Objective-C before you try to
re-invent the wheel. It's the other OO language based on C.

I rejected that a dozen years ago. (Don't ask me why, because once I say no
to something, I throw the analysis in the garbage, lest I forget my email
address or something).
C has a number of things I'd like to change which are unrelated to OO.
Such changes are mostly not practical, or are completely destructive,
if done at any new standardization. But if done as a new language,
then it would not matter. If I were making a new OO language, I'd go
for these changes, rather that being strictly tied to C.

Well I am developing my own language because I'm hardly enamoured with C++.
But this is a C newsgroup. And if C somehow in the near future featured what
I consider a better object model than C++, I might stop rolling my own. It
wouldn't be the first time I've abandoned a project for something new that
showed up.
 
T

Tech07

Thomas said:
Please explain your definition of "object model"

Well, I'm hardly someone who does definitions. Oh, I can sum it up quickly:
"Inside the C++ Object Model", a book by S. Lippman describes (tada!) the
C++ object model (well, cfront-style)! So the mechanics, as described in
that book, are one part of "object model" (as I have used the words). The
other part is what part of the whole domain of "OO" is selected to be
implemented, and the obvious patterns, techniques, etc. known to this day.
 
T

Tech07

Kaz said:
C isn't an extensible programming language.

Did you mean to say: "C is a stagnant language"?
So adding an object
system to C means that a new language is created (possibly one which
has significant backward compatibility).

What about C89, C99, etc.?? Just because it's like pulling teeth to get C to
change does not mean it can't or doesn't.
This has already happened, quite long ago, and the results were given
names like C++ and Objective C.

I use C++. I want something better. Maybe something in-between C and C++.
Maybe.
 
S

Seebs

I use C++. I want something better. Maybe something in-between C and C++.
Maybe.

I actually rather like Objective-C for the kinds of things where I want
objects but I still want to be writing C.

-s
 
T

Tech07

Malcolm said:
You can do object-oriented programming In C, but it is messy because
there is no syntactical support

Well my original post was all about those syntactical support mechanisms.
so things like inheritance have to be
scratched up from tables of function pointers.

Every so often someone comes up with some extensions to C, and an
object model is a common thing to add. C++ is the best-known example.

Kinda dated if you ask me, but maybe I've been in my research lab too long!
There will be other attempts, but none so far has been accepted into
the core language, and probably never will be.

Everyone has an opinion.
Opinion is moving against object-oriented programming.

Ah, more opinions.
 
T

Tech07

Kenny said:
Is it? I want to make it clear that I have no opinion on the subject,
nor any stake in the outcome. I am just curious.

But I will say this: The statement above looks like a political
statement - like you generally see in the political/religious (Yes, at
least in America, they are one in the same) groups.

It didn't sound political to me. It sounded like he had recently been
exposed to someone(s) saying/writing/whatever that. Maybe he's been reading
the trade rags: they are HIGH on opinion! But I think a lot of "opinions"
are just people thinking (as he did, I assume) and thinking is good!
 
T

Tech07

Malcolm said:
Stuff I've read. You used to read plenty of articles attacking C++,
but not object-oritented programming itself. Now I've notice far more
material attacking the very concept of object oriented programming.

Dijkstra said "Object-oriented programming is an exceptionally bad
idea which could only have originated in California"

The Wikipedia entry on "object-oriented programming" has a list of
critics.
I'd admit this isn't a very scientific survey, more an impression
about they way the wind is blowing.

But (!), you didn't offer the other direction or speed or whatever that the
"wind is blowing"! That would have given completion of your thought. If you
would have instead said something like: "Opinion is moving against OO
programming and toward functional programming", that could have been the
start of another thread, or topical to this one as in "wake up dude, OO is,
like, so passe now". (Couldn't resist throwing in a little humour).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top