Re: Euphoria Object Oriented Programming

new topic     » goto parent     » topic index » view thread      » older message » newer message

Ricardo M. Forno wrote:
> It is hard to explain it in detail. However:
> 
> Inheritance: If class B inherits from class A, then the behavior of a class
> B
>  object depends not only on the definition of class B but also class A. So,
>  obviously classes A and B are highly coupled.
I can see that. But when you use objects that you don't have to extend then
you've just got an interface, right? So if you have a mix of objects that you do
and don't have to extend isn't that better than the procedural approach in some
cases? Where the OO approach can be more loosely coupled in the cases where you
don't have to extend classes you are re-using yet in the procedural approach you
have to couple pretty tightly regardless.

Again, that's why I like prototype-based OO better than class-based OO.

> 
> Polymorphism: A method doesn't do a single task, but many, according to the
>  types of object to what it applies (low coherence).
I see some polymorphism in Euphoria already. Maybe we should be talking about
genericity rather than polymorphism, though. I like the idea of generic routines
that behave the same or similarly on different datatypes.

But I understand what you mean I think.
 
> Moreover, classes mix data and procedures. They are in totally different
>  fields.
> 
That's kind of the thing I like about it though. I usually think about it more
in terms of "API" and "state", though. I agree that it can be overdone.

> I think that OOP will eventually fail as hierachical databases did, in
>  favor of relational databases, for the same reason. In relational databases,
>  each piece of data is not related to others, but the relation is provided
>  in a flexible way by procedures (SQL and PL/SQL sentences), as old good
>  structured programming does.
> 
> You can get more criticism of OOP in places like this one:
> 
> <a
> href="http://dmoz.org/Computers/Programming/Methodologies/Object-Oriented/Criticism/">http://dmoz.org/Computers/Programming/Methodologies/Object-Oriented/Criticism/</a>
> 
> Regards.
I'll try to read that tomorrow. Thanks for sharing, I'm always interested in
learning new things.

I remember it took me a very long time to understand exactly what OO is.
Surveying programming languages I can see where multi-paradigm languages are
better than one-trick ponies. I don't think that OO is useless but I also don't
think it is the solution to all programming problems. Sometimes you just want to
tell the computer to do something -- imperative, rather than trying to think of
how different objects fit together.

However sometimes having an object makes sense, especially when it is something
that has to keep state as well as provide an interface to change that state.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu