POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code : Re: Object Oriented POV code Server Time
29 Jul 2024 08:11:35 EDT (-0400)
  Re: Object Oriented POV code  
From: Warp
Date: 19 Feb 2004 13:55:16
Message: <40350693@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> >   One of the basic features of an object-oriented language are modules.

> FWIW, there are many modular languages that aren't OO.

  So?
  I didn't say modules are a sole feature of OO languages. I said that
modules are a minimum requirement for a language to be OO.

  A good example of a modular language which is not OO is modula. It has
modules (created not very surprisingly with the keyword 'module') which
contains member variables, member functions, private and public parts, etc.
However, since it does not have (AFAIK) inheritance and dynamic binding
it's not an OO language, only a modular one.

> >   A second basic feature of an OO language is inheritance.

> FWIW, there are many OO languages that don't support inheritance.

  Then they are not object-oriented languages. Some kind of inheritance is
a basic feature of object-oriented languages.
  The whole idea of object-orientedness is that you can have a hierarchy
of objects (from more abstract to more specific). If you can't build such
hierarchy, then it's not object oriented.

> Inheritance is something different, designed to 
> allow you to share code between different parts of your program, to ease 
> maintenance.

  Nope, that's a way too narrow way of defining inheritance.

  It's true that inheritance can (and should) be used to group common
code into a single module. However, that's not the only (and depending
on who you ask not even the most important) reason for inheritance.
  There are other ways of grouping common code into single modules,
such as composition (ie. a class having another class as member variable).
You don't necessarily need inheritance for this.

> >   A third basic feature, related to inheritance, is dynamic binding. 

> Dynamic binding is not really necessarily related to inheritance, and 
> vica versa. That's just an artifact of how popular OO languages handle it.

  Lack of dynamic binding would make inheritance more or less obsolete.
If you are going to use inheritance without dynamic binding you could
as well use compositionality instead.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.