Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-22 Thread David Adams via 4D_Tech
Hey again John, Here's a fun thought experiment: Imagine a computer language that doesn't have globals at all. (Eiffel.) P.S. To those following along at home: Yes, you can always create globals my misusing a singleton. No, not all singletons are following an "anti-pattern."

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-22 Thread John Baughman via 4D_Tech
David… reminiscent of old times, you can feel ignored once again ;-) Seriously though, I am not disagreeing here with you or any one else with regard to the problems that global variables can create. I am just once again saying, don’t throw the baby out with the bath water. Globals, in my

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-22 Thread Jeremy Roussak via 4D_Tech
Pretty much. And the gaps are filled by Dilbert. Jeremy Jeremy Roussak j...@mac.com > On 22 Jul 2017, at 09:17, Jeremy Roussak via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Someone has thought of that, Chip: https://xkcd.com/1205/ > > > Jeremy > > > Jeremy

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-22 Thread Chip Scheide via 4D_Tech
there is an XKCD for *everything* :) > Someone has thought of that, Chip: https://xkcd.com/1205/ > > > Jeremy > > > Jeremy Roussak > j...@mac.com > > > >> On 21 Jul 2017, at 14:47, Chip Scheide via 4D_Tech >> <4d_tech@lists.4d.com> wrote: >> >> On Fri, 21 Jul

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-22 Thread Jeremy Roussak via 4D_Tech
Someone has thought of that, Chip: https://xkcd.com/1205/ Jeremy Jeremy Roussak j...@mac.com > On 21 Jul 2017, at 14:47, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > On Fri, 21 Jul 2017 23:01:56 +1000, David Adams via 4D_Tech wrote: >> let's take a

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread David Adams via 4D_Tech
On Sat, Jul 22, 2017 at 12:56 PM, John Baughman via 4D_Tech < 4d_tech@lists.4d.com> wrote: > Lacking a computer science background ...me too. > My point is that none of the hammers are evil nor should any “be avoided > like the plague”. Each has a place in my tool shed. I have a very basic >

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread John Baughman via 4D_Tech
I always get amused whenever the discussion on the NUG turns to the evils of global variables. Lacking a computer science background most of the discussions in this vain go way over my head. I am a self taught 4D guy who over the years, for reasons I know not why, have taken a minimalist

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Robert McKeever via 4D_Tech
I doubt that they would let you through customs, David. > On Jul 21, 2017, at 6:01 AM, David Adams via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > On Fri, Jul 21, 2017 at 10:35 PM, Pat Bensky via 4D_Tech < > 4d_tech@lists.4d.com> wrote: > >> My 2 cents: >> >> According to a recent 4D blog

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Kirk Brooks via 4D_Tech
Nigel, Nice post. I very much agree with pretty much all your points. A few things I'll add: Functions: yes! A lot of IP vars I see in old code are used to make values available that used to take measurable time to derive. Lots of them can be replaced with a short function to just go get the

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread David Adams via 4D_Tech
> if you have 3 ways to do something I'd go with the way I found easiest and, ideally, made the simplest to understand code. If one of the choices was obviously stupid or inefficient, I'd probably skip it. But, honestly, clear code is super important. I'll leave the fancy stuff for when it's

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Peter Jakobsson via 4D_Tech
On 21 Jul 2017, at 16:48, David Adams via 4D_Tech <4d_tech@lists.4d.com> wrote: > * No. You do not need classes. Modules do not require OOP, OO came out of > earlier work and embraced modules and extended them. I'm just talking about > module-level scope and data hiding, not OO Ok, you could be

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread David Adams via 4D_Tech
Hey Peter, just a quick response to a couple of things: * Don't really know what you mean by 3G and 4G languages. If memory serves me, this was more of a marketing term from the 1980s or so than any kind of real technical distinction. * No. You do not need classes. Modules do not require OOP, OO

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Peter Jakobsson via 4D_Tech
Well, I’m afraid I’ll have to take the pariah role here and politely disagree with you all :-)) - or at least present an alternative perspective in which “globals” play a very powerful and unique part. Lets think this all through for a moment. As is relevant to this topic, we can notionally

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Chip Scheide via 4D_Tech
On Fri, 21 Jul 2017 23:01:56 +1000, David Adams via 4D_Tech wrote: > let's take a moment to > remember that speed only matters when things are slow. true. BUT... if you have 3 ways to do something 1 - this works, but takes X time 2 - this works too, take a bit more coding, but takes X/2 time 3 -

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread David Adams via 4D_Tech
On Fri, Jul 21, 2017 at 10:35 PM, Pat Bensky via 4D_Tech < 4d_tech@lists.4d.com> wrote: > My 2 cents: > > According to a recent 4D blog entry, using the new object notation option > will speed up your objects significantly: > Sounds great! Before this becomes the new "for loops are faster",

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Pat Bensky via 4D_Tech
My 2 cents: According to a recent 4D blog entry, using the new object notation option will speed up your objects significantly: "Good news, now you have a mean to get rid of all those OB Get and OB SET

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread David Adams via 4D_Tech
Nigel, Wow! I haven't read your whole post yet and I look forward to going through it when I have more time and brain power. Just a few quick notes: * Globals are bad. Because science. * 4D's approach to scope iseccentric. * "Global" means "global to all code in the system", which doesn't

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-21 Thread Nigel Greenlee via 4D_Tech
Global Variables. Regardless of the relative merits of Arrays vs Object. I would like to relay my dislike in general of Global variables. I have been working with 4D since before the concept existed-since 4D V2(Globals came in with V3). Yes i am one of the old boys. Back then we did not have

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-18 Thread Chip Scheide via 4D_Tech
Long ago - and I am pretty sure the code has been lost to time - in v2.2.3 (I think) I wrote code to do binary searching on a selection, as at that time Search Selection (the old command name) was sequential, but sorting the selection was indexed. Even with the overhead of managing the

Re: Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-18 Thread David Adams via 4D_Tech
> The original thread on "Arrays vs Object for Key/Value pair lookups” is a good case in point. Yes there is a huge > performance boost in using objects (I hold my hands up - I’m doing it ! LoL), but I’m retaining the use of ‘parallel arrays’ > for much of the code simply because they’re so nice

Use of Objects vs Global Variables (Was 'Arrays vs Objects...)

2017-07-18 Thread Peter Jakobsson via 4D_Tech
This is just a brief commentary on my experience with objects after about a year of using them intensively. I now use them extensively for certain things but have ditched them for others where I had initially thought they may have a role. But one of the reasons I don’t use 4D objects too