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


Groups > comp.lang.javascript > #36405

Re: Javascript "object creation" and object oriented programming

Newsgroups comp.lang.javascript
Date 2019-04-24 11:01 -0700
References <5a2b4e29-7d14-4cd3-8759-a77083b987cb@googlegroups.com> <2841cetqa4cnmscb37qsmndks4jbl1o8an@4ax.com>
Message-ID <6deb0dc8-45ff-4fea-98c8-bf316ece03f1@googlegroups.com> (permalink)
Subject Re: Javascript "object creation" and object oriented programming
From jonas.thornvall@gmail.com

Show all headers | View raw


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. 

But is not all the "objects" "subobjects" "synth,bank,instrument,note" reachable by selecting the index? That is how i use the track object track is reachable by an index, and it has a property its name?

You say that is wrong approach?

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 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?


> The same goes for the other things you've called an index.
> 
> 
> >Now each instruments have notes with index and the notes have names. Maybe my attempt below is correct but it just feel so wrong? It somehow miss the depth aspect of multidimensional arrays?
>   <snip>
> 
> So, what you've described can be summarised as :
> 
>   A synth object is
>     a list of banks
> 
>   A bank is
>     a name, and
>     a list of instruments
> 
>   An instrument is
>     a name, and
>     a list of notes
> 
>   A note is
>     a name
> 
> 
> You can now see that you have four kinds of object. Each has two
> properties :
> 
>   name, possibly null
>   list, possibly null
> 
> A non-null name will be a string.
> A non-null list will be an array.
> 
> 
>   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