Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #13221

Re: Function or Object

From "Wolfgang Riedmann" <wriedmann@gmail.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Function or Object
Date 2021-01-18 13:59 +0100
Message-ID <i6lf0mFd6g9U1@mid.individual.net> (permalink)
References <7e5c102c-6008-4dd3-85c9-21589e5b0c51n@googlegroups.com>

Show all headers | View raw


Hi Gregory,

the fastest code is using strong typed functions.

Using a class has other advantages, but speed is not one of them. And
since you are passing the parameter in the Init() method, strong typing
is not possible.

If you have more parameter, it could be an option to use a class,
assign the parameter values to strong types variables (assign) and then
call a strong typed method.

Wolfgang

Grzegorz R. wrote:

> Hello 
> what is better (code, speed, clarity, ...) to use:
> 1) function
> Data := FUN(x)
> - where
> Function FUN(argument)
>   // do calculation
>   output := xx
> Return Output
> 
> or
> 2) object
> Data := FUN{x}:Output
> - where
> Class FUN
> Protect xx as ...
> Access Output class FUN
> RETURN xx
> Init (Argument) Class FUN
>   // do calculation
> Return SELF
> 
> If We need only one output function is more natural but if an output
> should be more complex data (ex: string + number + logic) then object
> is easier to use.
> 
> Generally what is "better" or when is better to use FUN vs OBJ
> (Class)?
> 
> Rgds
> Gregory



-- 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Function or Object "Grzegorz R." <ramotny64@gmail.com> - 2021-01-17 03:30 -0800
  Re: Function or Object "Wolfgang Riedmann" <wriedmann@gmail.com> - 2021-01-18 13:59 +0100
    Re: Function or Object "Grzegorz R." <ramotny64@gmail.com> - 2021-01-18 08:50 -0800
      Re: Function or Object "Wolfgang Riedmann" <wriedmann@gmail.com> - 2021-01-19 07:43 +0100
        Re: Function or Object "Grzegorz R." <ramotny64@gmail.com> - 2021-01-20 03:32 -0800
          Re: Function or Object "Wolfgang Riedmann" <wriedmann@gmail.com> - 2021-01-20 13:09 +0100

csiph-web