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


Groups > comp.lang.javascript > #36417

Re: Javascript "object creation" and object oriented programming

From John G Harris <niam@jghnorth.org.uk.invalid>
Newsgroups comp.lang.javascript
Subject Re: Javascript "object creation" and object oriented programming
Date 2019-04-25 18:08 +0100
Organization A noiseless patient Spider
Message-ID <0ef3ce1iuihbo2ef72e1ijnsh2l0gqmtn2@4ax.com> (permalink)
References <5a2b4e29-7d14-4cd3-8759-a77083b987cb@googlegroups.com> <2841cetqa4cnmscb37qsmndks4jbl1o8an@4ax.com> <6deb0dc8-45ff-4fea-98c8-bf316ece03f1@googlegroups.com>

Show all headers | View raw


On Wed, 24 Apr 2019 11:01:43 -0700 (PDT), jonas.thornvall@gmail.com
wrote:

>Den onsdag 24 april 2019 kl. 18:39:23 UTC+2 skrev John G Harris:
>> On Tue, 23 Apr 2019 23:50:46 -0700 (PDT), jonas.thornvall@gmail.com
>> wrote:
>> 
>>   <snip>
>> >Let us say i have a synth object, each synth have bank index and the banks have names, each bank have instrument index and the instruments have names.
>> 
>> Please stop sayint it's a bank index. It's a lot less confusing to say
>> it clearly : it's a list or sequence of banks. 
  <snip>

>I was thinking i have synths that have index, and a property of it is name, another property is the subindex (Nested object?) of the bank? It has also a name and also a subindex (Nested object?) and so on...
>
>Do you say it is the wrong way to think about the object?

I'm saying it's the wrong way to describe it. An "index" is just a
number. It says which thing in the list is the one you want. The list
of banks in a synth looks like :

  Things        :  [bank, bank, bank, ...]
  Index numbers :    0     1     2    ...

Obviously you would store this list of bank objects in an array. If
the array is held in a variable named banks then
  banks[2]
accesses the bank in the list whose index number is 2.


>I see you choose to separate the objects "below", instead of nest them will that not make it harder to read in and out things from the objects?
>
>Lets say i want the read out a "drumname" it equals note 23 name, of instrument X, in bank Y, in synth Z
>How do you do that?
>
>It seem to me a nested structure you can do it in one swoop?
  <snip>

What I said is that 
  each synth has several banks, 
  each bank in each synth has several instruments, 
  each instrument in each bank in each synth has several notes.

That's what you will see in the structure of a synth. Obviously, it's
a nested structure. Now that the structure has been described you can
decide what objects, etc, you are going to use to implement one of
these stuctures.

  John

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-23 23:50 -0700
  Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 01:02 -0700
  Re: Javascript "object creation" and object oriented programming "R.Wieser" <address@not.available> - 2019-04-24 12:34 +0200
    Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 05:41 -0700
      Re: Javascript "object creation" and object oriented programming "R.Wieser" <address@not.available> - 2019-04-24 18:06 +0200
  Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 06:24 -0700
    Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 07:00 -0700
  Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-24 17:39 +0100
    Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 11:01 -0700
      Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:08 +0100
        Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-25 10:14 -0700
    Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 11:11 -0700
      Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 13:50 -0700
        Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-25 01:01 -0700
      Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:12 +0100

csiph-web