Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - OOP | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
paraplayer

Snifit
Level: 22

Posts: 54/280
EXP: 57271
For next: 1079

Since: 06-06-05

Since last post: 44 days
Last activity: 44 days
Posted on 06-12-05 10:32 AM Link | Quote
Well i just now found out that C is not object oriented C++ is.

then i realized i have no clue what the definition of object oriented programming means.
besides that fact, that backwards its poo, what does it mean?
rg_

Goomba
Level: 8

Posts: 5/26
EXP: 1964
For next: 223

Since: 03-27-05

Since last post: 21 hours
Last activity: 12 hours
Posted on 06-12-05 11:19 AM Link | Quote
Do you have no clue what the definition is or do you know the definition but don't understand it?

If it's the former read up on http://en.wikipedia.org/wiki/Object-oriented_programming

If it's the latter ask more specific questions, there are entire books about that subject.
paraplayer

Snifit
Level: 22

Posts: 63/280
EXP: 57271
For next: 1079

Since: 06-06-05

Since last post: 44 days
Last activity: 44 days
Posted on 06-12-05 11:27 AM Link | Quote
the wikipedia answered my question thanks for the link.
Dish

Spiny
Level: 38

Posts: 430/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 06-12-05 07:39 PM Link | Quote
Object Orientation is a programming style -- not a language feature. You can do OOP in pretty much any language (including C). The reason C++ is called an "OOP language" is because it was designed with OOP in mind and makes some things easier to work with in that respect -- but I really hate calling it that because ANY language can be an OOP language. Hell I can write object oriented code in 6502.
Ramsus

Octoballoon
Level: 19

Posts: 91/162
EXP: 34651
For next: 1126

Since: 01-24-05
From: United States

Since last post: 39 days
Last activity: 71 days
Posted on 06-13-05 01:04 AM Link | Quote
Effective OO design does require certain features built into the language, otherwise it becomes nothing more than another way to organize functions and data. If you want to learn OO programming, take a week or two and learnJava.

From there, look into design patterns and commonality and variability analysis.

Oh, and Disch, how's about we not call Lisp a functional programming language while we're at it? After all, you can use functional programming techniques in C and assembly, albeit much less effectively.

But then again, Lisp is really powerful as a functional programming language because the functions are a type of data (originally they were lists), so you can write macros that generate more code. The language is designed around the "paradigm" itself, which is why we call it functional.

Try implementing OO design patterns in C and assembly, but it'll be ugly as hell. In fact, it'd be easier (and more efficient, since at least a C++ compiler usually knows how to optimize OO code because the features are built in) to just code things in a structured manner.

That's why we don't consider C an Object Oriented language.

Or do you just consider Object Oriented Programming to be nothing more than another way of functions acting on data? If so, you have the same short-sighted view that so many early C++ texts had on it.
Dish

Spiny
Level: 38

Posts: 431/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 06-13-05 01:37 AM Link | Quote
Originally posted by Ramsus
Try implementing OO design patterns in C and assembly, but it'll be ugly as hell.


C example of OO function calls:

MYSTRUCT object;
MyStruct_Function( &object );


C++ example of OO function calls:

MYCLASS object;
object.Function();


C example of inheritance:

typedef struct CHILDSTRUCT
{
PARENTSTRUCT parent;
int otherstuff;
};



C++ example of inheritance:

class CHILDCLASS : public PARENTCLASS
{
int otherstuff;
};



C example of virtual functions (aka function pointers)

typedef struct CHILDSTRUCT
{
void (*VirtualFunction)(void);
};


C++ example of virtual functions

class CHILDCLASS
{
virtual void VirtualFunction(void);
};


If you call that "ugly as hell" -- then you and I have vastly different opinions of what ugly code is.

The ONLY things C++ really changes in this area are:

1) Automation associated with the this pointer (so when in member functions you can just access them without any prefix -- whereas in C you'll have to do obj->varname for every member var).

2) Same as above, but includes the this pointer to include any and all parent classes. C++ can just do 'varname' rather than 'obj->parent.varname'. Exception of course when both the parent and child have a var with the same name -- in which case C++ has to do 'PARENT::varname' if it wants the parent version.

3) Automatically calling ctor/dtor member functions upon object creation/destruction

4) Automatically filling in virtual function pointers upon object creation


And yes -- I'll agree -- all those things make OOP easier and more convienient (which I actually mentioned in my previous post). However they are not necessary for OO design. Labelling C as a "non-OOP language" or some variant is completely misleading -- because it Can be Object Oriented. Almost any language can. It all depends on how you use the language. Some languages may have features to make it easier (and in fact -- one could very easily argue that C's structs are such a feature), but that doesn't the languages which lack those features are not as capable.

The features of the language do not even dictate how you code. It's very easy to make non-OO code in both C++ and Java. Because it's like I said: OOP is a programming style -- it's not a language feature.


Or do you just consider Object Oriented Programming to be nothing more than another way of functions acting on data? If so, you have the same short-sighted view that so many early C++ texts had on it.


Honestly, I fail to see where the line is drawn which determines which languages are OOP and which are not. As far as I can tell, if a language uses the 'class' keyword it's OOP, and if it doesn't it's not . That's really the only sense I can make out of the current labels.


(edited by Disch on 06-12-05 08:38 AM)
Ramsus

Octoballoon
Level: 19

Posts: 93/162
EXP: 34651
For next: 1126

Since: 01-24-05
From: United States

Since last post: 39 days
Last activity: 71 days
Posted on 06-13-05 02:06 AM Link | Quote
Right, so it doesn't matter that you're doing twice as much typing to use a paradigm that your language doesn't provide abstractions for.

And by ugly, I mean more difficult to manage and change and longer to type. Can you honestly say that using OO techniques in C, you can reduce code duplication as much as you can in C++?

Besides, you never touched Object Oriented design patterns, merely how to implement a simple inheritance model in C. I've seen that a million times with projects like GTK+.

When you start getting into the really abstract stuff, you'll end up with a lot more code than you need. That's what I consider ugly.
Dish

Spiny
Level: 38

Posts: 432/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 06-13-05 02:18 AM Link | Quote
I'm at a loss for a reply. I don't necessarily disagree with anything you just said -- but it doesn't seem like you disagreed with anything I said either. Perhaps we're just arguing different points?

I don't like labelling languages as Object Oriented or Procedural -- since it's really up to the coder to determine one or the other -- the language used is irrelevant. That's all I'm saying.

Yes I agree OOP is easier on C++. I never said it wasn't (in fact I said it was in every reply). I don't agree that C++ can be only used for OOP -- or that C cannot be used for OOP (which is what calling a language OOP or not implies).

C++ was designed with more OOP concepts in mind -- however considering everything C++ does can be easily mimiced in C, it's not really fair to say C wasn't designed with OOP concepts in mind -- because it was kinda. Perhaps it doesn't rely as heavily on OOP as C++ -- but where do you draw the line?
Ramsus

Octoballoon
Level: 19

Posts: 94/162
EXP: 34651
For next: 1126

Since: 01-24-05
From: United States

Since last post: 39 days
Last activity: 71 days
Posted on 06-13-05 04:03 AM Link | Quote
I guess we have different ideas of how descriptions like "Object-Oriented" and "Procedural" apply to languages. I don't see them as limiting in describing the language and what it can't do, but merely making it clear what types of methods and abstractions the language is designed around (as well as how most programmers choose to use that language, which is important in team development).

So that's where we really disagree.

Although I will admit, I don't like using Object-Oriented design in C, since I do think there are usually better ways of using the flexibility C provides to write shorter, cleaner code.

And I would consider C++ more multi-paradigm than anything. It's a procedural, object-oriented, semi-functional language with generics. In this case, I can see where you're coming from. My idea of an Object Oriented language is something more like Smalltalk or Java anyway.

Basically, when using OO design starts providing a significant gain in code reusability and design over other paradigms, while allowing you to make use of OO design patterns, without having strange quirks or requiring lots of unnecessary code, I consider the language in use an OO language.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - OOP | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.007 seconds.