Re: More on 4D Objects and 'Inheritance'

2019-09-20 Thread Aparajita Fishman via 4D_Tech
Thanks for the plug, Tim!

> And he is also an experienced C++ programmer

And python and JavaScript. In the case of these courses most of the inspiration 
comes from the JavaScript/Node world, which makes sense since 4D is slowly 
integrating JavaScript into the 4D language.


> Maybe this would be a great 1 day 4D Summit advanced class. Humm... 🤔

Can’t make it to the Summit. It’s better as a video course anyway. For many 
people the concepts will be quite new, and it’s more valuable if you can go at 
your own pace and watch several times if necessary.

- Aparajita
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-20 Thread Tim Nevels via 4D_Tech
On Sep 20, 2019, at 2:25 AM, John J Foster wrote:

> I would be interested as well. Especially object-oriented programming in 4D 
> v17 with a messaging  system that takes advantage of new 4D concepts. And 
> good quality reusable examples to speed up the integration into 4D v17R...
> 
> And the API one as well.

I am interested in the 2 courses as well. It has been so many years since I 
have seen Aparajita and enjoyed one of his presentations. I remember one from a 
4D Summit when he was developing his Active4D plugin, which is an amazing 
plugin for doing websites in 4D. 

He has a very deep understanding of 4D and many other technologies and has the 
ability to integrate them to produce very productive solutions to solve complex 
problems. 

For those of you who may not know Aparajita, I might describe him as a 
combination of JPR, Miyako and Rob Laveaux. His depth and experience is 
tremendous. 

He is a very experienced 4D developer that has done many 4D projects over the 
years so he has a solid foundation of using 4D to solve real world problems. So 
he has that in common with JPR and Rob.  And he is also an experienced C++ 
programmer and has built amazing 4D plugins like Miyako and Rob. And his 
plugins have been created first for his own use to solve complex problems he 
has encountered in his 4D development work. Then he has released them to the 
world. 

So I am confident any classes or presentations he would deliver will be of the 
highest level. Extremely useful, valuable and insightful. You are going to walk 
away saying “I’m so glad I took this course”. 

I encourage everyone to reply to Aparajita and show your interest in these 2 
courses. I want to see them, but he’ll only do them if there is enough 
interest. 

I encourage Aparajita to set up a simple signup website that we can use to 
pre-register for the courses. I’d even be happy to pay a deposit in advance. 
Yeah... I’m psyched about this. 

I just had great idea... We have had so many “advanced classes” from JPR at 4D 
Summits over the years.  Maybe this would be a great 1 day 4D Summit advanced 
class. Humm... 🤔

Tim

Sent from my iPad
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-19 Thread Nils Kollandsrud via 4D_Tech
Sign me up for both!

Nils

On Wed, 18 Sep 2019 at 21:17, Aparajita Fishman via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> creating two video courses:
>
> - Revolutionize your apps with object-oriented programming in 4D v17 —
> today!
> - express4d: The better way to write web APIs in 4D
>
> I’m wondering how many people would be interested in one or both of these
> courses.
>
> Pricing:
> 1 course: $500
> 2 courses: $900
>
> - Aparajita
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

-- 
Nils Kollandsrud
Ixmal Intelesis AS, Pilestredet 75 C, Postboks 5130 Majorstuen, 0302 Oslo,
Norway
Tel: +47 22121212 Mob: +47 920 15550
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-19 Thread John J Foster via 4D_Tech
Hi Aparajita,

I would be interested as well. Especially object-oriented programming in 4D v17 
with a messaging  system that takes advantage of new 4D concepts. And good 
quality reusable examples to speed up the integration into 4D v17R...

And the API one as well.

John…



> - Revolutionize your apps with object-oriented programming in 4D v17 — today!
> - express4d: The better way to write web APIs in 4D


> On Sep 18, 2019, at 12:00 PM, 4d_tech-requ...@lists.4d.com wrote:
> 
> From: Aparajita Fishman  <mailto:aparaj...@aparajita.com>>
> Subject: Re: More on 4D Objects and 'Inheritance'
> Date: September 18, 2019 at 11:17:15 AM PDT
> To: 4d_tech@lists.4d.com <mailto:4d_tech@lists.4d.com>
> 
> 
>> I worked on a 4D system originally developed by Aparajita more than 22 years 
>> ago for an investment bank. It used a plug-in that was probably little known 
>> at the time - ObjectTools.
> 
> I wrote ObjectTools specifically for that project, so that we could use an 
> object oriented style of programming. It worked pretty well. 😁
> 
> 
>> Hint... if Aparajita was to give some trainings at the next 4D Summit on the 
>> work he's done porting npm pacakges to 4D, well we could all learn a great 
>> deal from his experience and I would be over there like a shot!
> 
> I’ve given some thought to creating two video courses:
> 
> - Revolutionize your apps with object-oriented programming in 4D v17 — today!
> - express4d: The better way to write web APIs in 4D
> 
> I’m wondering how many people would be interested in one or both of these 
> courses.
> 
> Pricing:
> 1 course: $500
> 2 courses: $900
> 
> - Aparajita

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-19 Thread Peter Bozek via 4D_Tech
On Wed, Sep 18, 2019 at 8:17 PM Aparajita Fishman via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> > I worked on a 4D system originally developed by Aparajita more than 22
> years ago for an investment bank. It used a plug-in that was probably
> little known at the time - ObjectTools.
>
> I wrote ObjectTools specifically for that project, so that we could use an
> object oriented style of programming. It worked pretty well. 😁
>
>
> > Hint... if Aparajita was to give some trainings at the next 4D Summit on
> the work he's done porting npm pacakges to 4D, well we could all learn a
> great deal from his experience and I would be over there like a shot!
>
> I’ve given some thought to creating two video courses:
>
> - Revolutionize your apps with object-oriented programming in 4D v17 —
> today!
> - express4d: The better way to write web APIs in 4D
>

I definitely in express4D, but package of both looks very intriguing as
well

--

Peter Bozek
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-19 Thread Narinder Chandi via 4D_Tech
- Revolutionize your apps with object-oriented programming in 4D v17 — 
today!
- express4d: The better way to write web APIs in 4D

I’m wondering how many people would be interested in one or both of these 
courses.

Pricing:
1 course: $500
2 courses: $900

I would definitely be interested in both of these courses.

Regards,
 
Narinder Chandi,
ToolBox Systems Ltd.
 
I am available for new consulting opportunities…
http://4d.1045681.n5.nabble.com/ANN-4D-Developer-Available-td5765443.html
-- 



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-18 Thread Sannyasin Siddhanathaswami via 4D_Tech
Aloha Aparajita,

I’d definitely be interested. Object-oriented programming is something I never 
learned, but is becoming a requirement in 4D. I’ve been using objects, 
collections and entity selections quite a bit recently in 4D and love them. I 
know I’m only scratching the surface. v18 knowing all of this will be a 
requirement.


Sannyasin Siddhanathaswami
On Sep 18, 2019, 8:17 AM -1000, Aparajita Fishman via 4D_Tech 
<4d_tech@lists.4d.com>, wrote:
I worked on a 4D system originally developed by Aparajita more than 22 years 
ago for an investment bank. It used a plug-in that was probably little known at 
the time - ObjectTools.

I wrote ObjectTools specifically for that project, so that we could use an 
object oriented style of programming. It worked pretty well. 😁


Hint... if Aparajita was to give some trainings at the next 4D Summit on the 
work he's done porting npm pacakges to 4D, well we could all learn a great deal 
from his experience and I would be over there like a shot!

I’ve given some thought to creating two video courses:

- Revolutionize your apps with object-oriented programming in 4D v17 — today!
- express4d: The better way to write web APIs in 4D

I’m wondering how many people would be interested in one or both of these 
courses.

Pricing:
1 course: $500
2 courses: $900

- Aparajita
**
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4d_tech-unsubscr...@lists.4d.com
**
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-18 Thread Aparajita Fishman via 4D_Tech
> I worked on a 4D system originally developed by Aparajita more than 22 years 
> ago for an investment bank. It used a plug-in that was probably little known 
> at the time - ObjectTools.

I wrote ObjectTools specifically for that project, so that we could use an 
object oriented style of programming. It worked pretty well. 😁


> Hint... if Aparajita was to give some trainings at the next 4D Summit on the 
> work he's done porting npm pacakges to 4D, well we could all learn a great 
> deal from his experience and I would be over there like a shot!

I’ve given some thought to creating two video courses:

- Revolutionize your apps with object-oriented programming in 4D v17 — today!
- express4d: The better way to write web APIs in 4D

I’m wondering how many people would be interested in one or both of these 
courses.

Pricing:
1 course: $500
2 courses: $900

- Aparajita
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-16 Thread Narinder Chandi via 4D_Tech
Indeed. This prompts to relay a quick anecdote - I worked on a 4D system 
originally developed by Aparajita more than 22 years ago for an investment 
bank. It used a plug-in that was probably little known at the time - 
ObjectTools. Aparajita's always been far, far ahead of the curve. That 4D 
codebase was, and still is, the cleanest and most maintainable 4D codebase I've 
ever had the opportunity to work on - apart from my own of course :D

Actually, Aparajita writes on his website, and I quote:
"I originally wrote ObjectTools in 1990. In 2013, 4D added C_OBJECT, which has 
most of the functionality of ObjectTools. It only took them 23 years to catch 
up, not bad! 😁"

Hint... if Aparajita was to give some trainings at the next 4D Summit on the 
work he's done porting npm pacakges to 4D, well we could all learn a great deal 
from his experience and I would be over there like a shot! I've made a couple 
of half-hearted attempts to get to grips with JavaScript's power in the last 
few years but not seen them through. Looks like it's time to try again with a 
fresh mindset. If we didn't know it already, that JavaScript stuff is 
everywhere these days...

In the meantime, it would educate us a great deal if 4D was to provide some 
really good detailed examples of these new commands. Perhaps they exist already 
and I just didn't come across them yet...

Regards,
 
Narinder Chandi,
ToolBox Systems Ltd.
 
I am available for new consulting opportunities…
http://4d.1045681.n5.nabble.com/ANN-4D-Developer-Available-td5765443.html
-- 

-Original Message-
From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of 4D Tech Mailing List 
<4d_tech@lists.4d.com>
Reply-To: 4D Tech Mailing List <4d_tech@lists.4d.com>
Date: Monday, 16 September 2019 at 23:32
To: 4D Tech Mailing List <4d_tech@lists.4d.com>
Cc: Kirk Brooks 
Subject: Re: More on 4D Objects and 'Inheritance'

Well gee, what does Aparajita know about object oriented stuff? 🤔

Nicely put.

On Mon, Sep 16, 2019 at 1:23 PM Aparajita Fishman via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> > Well my recommendation is not to use New formula ever.
>
> Translation: “I’m not sure I can use them properly, therefore no one
> should.”  😂
>
>
> > Even with properly
> > encapsulated code structured in a way that makes sense, it's still
> > impossible to get the context, source, or whether or not the method call
> > even exists in the object.
>
> Not my experience at all.
>
>
> > It's basically just a dangerous feature at this
> > point just waiting to explode when your ".get()" isn't the same ".get()"
> as
> > you were expecting.
>
> Not my experience at all.
>
>
> > 4D needs to add actual class structures for it to be
> > 1) Easy to document and lookup the source, or see the actual function
> > documentation like now when we mouseover a method call.
>
> True, but I have found the benefits far outweigh those minor
> inconveniences. Looking up the source is trivial if you use a good naming
> convention.
>
>
> > Right now there would be a lot of
> > overhead to design an object correctly so that New formula use doesn't
> > spiral out of control
>
> Not my experience at all. I ported https://github.com/expressjs/express <
> https://github.com/expressjs/express> to 4D.
>
>
> > , and even then, time consuming to maintain.
>
> Not my experience at all.
>
>
> > I tried applying it in another case
> > where there was no UI and a lot of processing in loops. It was slow.
>
> Not my experience at all. I see no measurable slowdown.
>
> - Aparajita
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
Kirk Brooks
San Francisco, CA
===

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-16 Thread Kirk Brooks via 4D_Tech
Well gee, what does Aparajita know about object oriented stuff? 🤔

Nicely put.

On Mon, Sep 16, 2019 at 1:23 PM Aparajita Fishman via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> > Well my recommendation is not to use New formula ever.
>
> Translation: “I’m not sure I can use them properly, therefore no one
> should.”  😂
>
>
> > Even with properly
> > encapsulated code structured in a way that makes sense, it's still
> > impossible to get the context, source, or whether or not the method call
> > even exists in the object.
>
> Not my experience at all.
>
>
> > It's basically just a dangerous feature at this
> > point just waiting to explode when your ".get()" isn't the same ".get()"
> as
> > you were expecting.
>
> Not my experience at all.
>
>
> > 4D needs to add actual class structures for it to be
> > 1) Easy to document and lookup the source, or see the actual function
> > documentation like now when we mouseover a method call.
>
> True, but I have found the benefits far outweigh those minor
> inconveniences. Looking up the source is trivial if you use a good naming
> convention.
>
>
> > Right now there would be a lot of
> > overhead to design an object correctly so that New formula use doesn't
> > spiral out of control
>
> Not my experience at all. I ported https://github.com/expressjs/express <
> https://github.com/expressjs/express> to 4D.
>
>
> > , and even then, time consuming to maintain.
>
> Not my experience at all.
>
>
> > I tried applying it in another case
> > where there was no UI and a lot of processing in loops. It was slow.
>
> Not my experience at all. I see no measurable slowdown.
>
> - Aparajita
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
Kirk Brooks
San Francisco, CA
===

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-16 Thread Peter Jakobsson via 4D_Tech
rofl !  That was a very inspiring post.

Ok I think thats pushed me over the edge. OO 4D here I come.

> On 16 Sep 2019, at 22:23, Aparajita Fishman via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
>> Well my recommendation is not to use New formula ever.
> 
> Translation: “I’m not sure I can use them properly, therefore no one should.” 
>  😂
> 
> 
>> Even with properly
>> encapsulated code structured in a way that makes sense, it's still
>> impossible to get the context, source, or whether or not the method call
>> even exists in the object.
> 
> Not my experience at all.
> 
> 
>> It's basically just a dangerous feature at this
>> point just waiting to explode when your ".get()" isn't the same ".get()" as
>> you were expecting.
> 
> Not my experience at all.
> 
> 
>> 4D needs to add actual class structures for it to be
>> 1) Easy to document and lookup the source, or see the actual function
>> documentation like now when we mouseover a method call.
> 
> True, but I have found the benefits far outweigh those minor inconveniences. 
> Looking up the source is trivial if you use a good naming convention.
> 
> 
>> Right now there would be a lot of
>> overhead to design an object correctly so that New formula use doesn't
>> spiral out of control
> 
> Not my experience at all. I ported https://github.com/expressjs/express 
>  to 4D.
> 
> 
>> , and even then, time consuming to maintain.
> 
> Not my experience at all.
> 
> 
>> I tried applying it in another case
>> where there was no UI and a lot of processing in loops. It was slow.
> 
> Not my experience at all. I see no measurable slowdown.
> 
> - Aparajita
> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-16 Thread Aparajita Fishman via 4D_Tech
> Well my recommendation is not to use New formula ever.

Translation: “I’m not sure I can use them properly, therefore no one should.”  😂


> Even with properly
> encapsulated code structured in a way that makes sense, it's still
> impossible to get the context, source, or whether or not the method call
> even exists in the object.

Not my experience at all.


> It's basically just a dangerous feature at this
> point just waiting to explode when your ".get()" isn't the same ".get()" as
> you were expecting.

Not my experience at all.


> 4D needs to add actual class structures for it to be
> 1) Easy to document and lookup the source, or see the actual function
> documentation like now when we mouseover a method call.

True, but I have found the benefits far outweigh those minor inconveniences. 
Looking up the source is trivial if you use a good naming convention.


> Right now there would be a lot of
> overhead to design an object correctly so that New formula use doesn't
> spiral out of control

Not my experience at all. I ported https://github.com/expressjs/express 
 to 4D.


> , and even then, time consuming to maintain.

Not my experience at all.


> I tried applying it in another case
> where there was no UI and a lot of processing in loops. It was slow.

Not my experience at all. I see no measurable slowdown.

- Aparajita

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-16 Thread Peter Jakobsson via 4D_Tech
Fascinating stuff Kirk.

Thanks for posting.

Peter

> On 16 Sep 2019, at 17:10, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Not everyone is a fan and there are some good arguments to be made

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: More on 4D Objects and 'Inheritance'

2019-09-16 Thread Kirk Brooks via 4D_Tech
Peter,
On Mon, Sep 16, 2019 at 1:58 AM Peter Jakobsson via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> The key is the new “This” self-referencing function because it now lets
> you create an active object as a class.

It does.


> I realise OO purists may not regard it as a class,

They do not.


> Immense !
>
I agree.

For example, try this (needs v17 R3 or greater):
>
> C_OBJECT($animal;$dog;$cat;$pet)
> // 1. Define a class
> $animal:=New object("sound";"";"talk";Formula(ALERT(This.sound)))
>
To expand on the options here:
You can put that code into a method which returns the new object:

$animal:=Animal_obj

// Animal_obj

$0:=New object("sound";"";"talk";Formula(ALERT(This.sound)))


New Formula can call, and pass parameters to, a method.

// Animal_obj

C_TEXT($1;$2)

$animal_obj:=New object
$animal_obj.type:=$1
$animal_obj.name:=$2
$animal_obj.goodBoy:=null  // boolean
$animal_obj.color:=null // text

$animal_obj.talk:=New Formula(f_animal_getTalk)
$animal_obj.setGoodBoy:=New Formula(This.goodBoy:=$1))  //  what?
$animal_obj.setColor:=New Formula(This.color:=$1))

$0:=$animal_obj

// f_animal_getTalk

case of
  :(This.type="dog")

...

:(This.type="cat")

...

end case


This is a trivial use of formulas but illustrates a couple of points.
First, note the way the $1 param is handled. First, I pass in the
initialization params. You can also make these an option. In the
method Animal_obj is a text value. Later on I pass "$1" in as a boolean.
This compiles just fine. 4D sorts it out internally. So you can pass
multiple params of varying types to the formulas.

BTW, when a method returns an object you can address the properties
directly from the method. Eg:

$name:=Animal_obj("Fido";"dog").name  //  $name = "Fido"


Being able to use methods as New Formulas is very powerful. Methods run in
the context of an object formula have access to This. So cool.

Another use I am liking a lot is to put an entity reference is an object
with some formulas. Let's imagine a PERSON table.

// Person_obj (person id)

$person_obj:=New object
$person_obj.id:=$1

$person_obj.data:=ds.PERSON.get($1)  // get a reference to the entity

$person_obj.getLastEmail:=New Formula(f_person_getLastEmail)
$0:=$person_obj

//  f_person_getLastEmail

some complicated procedure to look up the last email

$0:=LastEmail


And so on. You could write more methods to the object to retrieve common
values for Person. This can be handy when the paths to those values, in the
.data property, are related in complex ways. For myself I try to keep the
processing and look ups in these methods pretty simple and light. Heavy
queries, manipulations and calculations are best done outside this context.

 Not everyone is a fan and there are some good arguments to be made. One I
received on another channel after I posted some of these ideas:

Well my recommendation is not to use New formula ever. Even with properly
encapsulated code structured in a way that makes sense, it's still
impossible to get the context, source, or whether or not the method call
even exists in the object. It's basically just a dangerous feature at this
point just waiting to explode when your ".get()" isn't the same ".get()" as
you were expecting. 4D needs to add actual class structures for it to be
1) Easy to document and lookup the source, or see the actual function
documentation like now when we mouseover a method call.
2) Safe to use and relatively performant. Right now there would be a lot of
overhead to design an object correctly so that New formula use doesn't
spiral out of control, and even then, time consuming to maintain.


Another thing I've noticed is there is a processing overhead involved. I
see it in both compiled and interpreted uses. For anything having to do
with the UI I don't hesitate to build objects like this. The benefits are
great and the overhead unnoticeable. I tried applying it in another case
where there was no UI and a lot of processing in loops. It was slow. I'm
using the beta versions for that stuff so it may be better when it's
actually released. I say that because I suspect the overhead has to do with
whatever internal mechanism 4D uses to manage the references and I expect
it to get better as it's used more. But for now YMMV.

-- 
Kirk Brooks
San Francisco, CA
===

What can be said, can be said clearly,
and what you can’t say, you should shut up about

*Wittgenstein and the Computer *
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

More on 4D Objects and 'Inheritance'

2019-09-16 Thread Peter Jakobsson via 4D_Tech
Hi

Just expanding on that last thread, (“Why does this not work") there do appear 
to be some real object orientation aspects to the new 4D commands - at least 
from the point of view of what’s needed and useful in a high level environment 
like 4D.

The key is the new “This” self-referencing function because it now lets you 
create an active object as a class. I realise OO purists may not regard it as a 
class, but it’s as much of a class as I’ve ever used in OOP languages and I 
don’t see what else we’d want or need. It can contain both encapsulated 
properties AND methods. Also, we don’t need to keep passing it an object 
reference from an external call to execute those methods using the “internal” 
properties and we can create new instances of objects from that class using the 
OB Copy command (which basically does the same job as “New”).

Immense !

For example, try this (needs v17 R3 or greater):

C_OBJECT($animal;$dog;$cat;$pet)

// 1. Define a class

$animal:=New object("sound";"";"talk";Formula(ALERT(This.sound)))

// 2. Instantiate new objects from the class which inherit its properties and 
behaviours

$dog:=OB Copy($animal)
$cat:=OB Copy($animal)

// 3. Customise the objects

$dog.sound:="wooff"
$cat.sound:="meow"

// 4. Do stuff using the encapsulated object reference defined in the class

$pet:=$dog
$pet.talk()

$pet:=$cat
$pet.talk()

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**