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


Groups > comp.lang.javascript > #36868

Rudimentary programming methodology

Newsgroups comp.lang.javascript
Date 2019-06-12 14:40 -0700
Message-ID <9beb723d-79b6-4894-bf22-6906fb06dec1@googlegroups.com> (permalink)
Subject Rudimentary programming methodology
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


I have a problem that i should know howto solve it is probably very basic.

Normally when you have choices, the most common way is to solve it with if, else if.

But sometimes your choices is fundamental to a process, so they are the input parmeters for something.

In my case i have a metronome, but depending on the "synth/hardware" you want to use you simply select it from an option list.

And now i could do 

if (met=="external") {something sent to port)
else if (met=="othersynth") {something else sent to port}
else if (met=="anothersynth") {something else sent to port}


If these are timed events it is not that effective to do this x times a second.

So you just want check and set the case once? and then be used everytime during the interval?

I guess that means to breakout the if cases into functions?
But you just want the actual function call to differ, but not be checked every time you send something to the metronome.

Basicly about setting what function to be called once, like flipping a switch and then it always take that "path".

I have a slight memory it could be case programming using switches, but i don't quite see hot it applies dealing with timed events during an interval?

Basicly i want to replace if else if before every metronome event.

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


Thread

Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-12 14:40 -0700
  Re: Rudimentary programming methodology "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-12 23:54 +0200
    Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-12 23:41 -0700
      Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 11:27 +0200
    Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-12 23:56 -0700
      Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 00:49 -0700
        Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 00:57 -0700
          Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 11:31 +0200
            Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:19 -0700
            Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:21 -0700
            Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:26 -0700
              Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 13:43 +0200
        Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 11:29 +0200
          Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:13 -0700
            Re: Rudimentary programming methodology "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-13 12:24 +0200
              Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:36 -0700
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:48 -0700
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 03:56 -0700
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 04:01 -0700
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 04:03 -0700
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 04:10 -0700
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-13 04:14 -0700
                Re: Rudimentary programming methodology Arno Welzel <usenet@arnowelzel.de> - 2019-06-13 13:45 +0200
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-15 03:36 -0700
                Re: Rudimentary programming methodology "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-15 13:49 +0200
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-15 06:31 -0700
                Re: Rudimentary programming methodology dr.j.r.stockton@gmail.com - 2019-06-15 07:40 -0700
                Re: Rudimentary programming methodology Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-15 08:25 -0700
  Re: Rudimentary programming methodology JJ <jj4public@vfemail.net> - 2019-06-13 15:13 +0700
  Re: Rudimentary programming methodology dr.j.r.stockton@gmail.com - 2019-06-13 04:20 -0700

csiph-web