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


Groups > comp.lang.javascript > #37544

Re: Weather App reworked

From John G Harris <niam@jghnorth.org.uk.invalid>
Newsgroups comp.lang.javascript
Subject Re: Weather App reworked
Date 2019-10-13 14:46 +0100
Organization A noiseless patient Spider
Message-ID <fka6qe5facre0am2o5pma5u7dk249rsrmd@4ax.com> (permalink)
References <4a61cdd9-0b9c-41ed-97e3-08d154f0ba02@googlegroups.com>

Show all headers | View raw


On Sun, 13 Oct 2019 03:31:40 -0700 (PDT), luserdroog
<luser.droog@gmail.com> wrote:

>I reworked the Weather App to try to make better use of Object Orientation.
>It seems to really help to group related things together. My use of the
>controller seems a little weird, though. I got all the control functions
>grouped nicely, but they're not in a class. I didn't see any easy way to
>do that given the way it all works. I'm not sure if I need more than one
>control so that may be moot.
  <snip>

>There still remain a few unencapsulated functions but they are all pure
>utility functions it doesn't seem too bad to leave them vanilla.

If you want to bunch functions together just make them properties of
an isolated object, in the same way that mathematical functions are
placed inside the Math (pseudo) object.

Doing this means you can re-use the functions in another project
without suffering from name clashes. (As in cowboy.draw and
picture.draw)

This may apply to your control functions as well.

  John

PS Remember that Julio doesn't approve of OO

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


Thread

Weather App reworked luserdroog <luser.droog@gmail.com> - 2019-10-13 03:31 -0700
  Re: Weather App reworked Julio Di Egidio <julio@diegidio.name> - 2019-10-13 05:49 -0700
    Re: Weather App reworked luserdroog <luser.droog@gmail.com> - 2019-10-14 10:53 -0700
      Re: Weather App reworked Julio Di Egidio <julio@diegidio.name> - 2019-10-14 21:22 -0700
  Re: Weather App reworked John G Harris <niam@jghnorth.org.uk.invalid> - 2019-10-13 14:46 +0100
    Re: Weather App reworked Julio Di Egidio <julio@diegidio.name> - 2019-10-13 07:02 -0700
      Re: Weather App reworked Julio Di Egidio <julio@diegidio.name> - 2019-10-13 07:08 -0700
        Re: Weather App reworked Julio Di Egidio <julio@diegidio.name> - 2019-10-13 07:16 -0700
          Re: Weather App reworked "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-13 10:10 -0700
            Re: Weather App reworked Julio Di Egidio <julio@diegidio.name> - 2019-10-13 10:34 -0700
          Re: Weather App reworked John G Harris <niam@jghnorth.org.uk.invalid> - 2019-10-13 19:55 +0100
            Re: Weather App reworked Julio Di Egidio <julio@diegidio.name> - 2019-10-14 05:56 -0700
              Re: Weather App reworked John G Harris <niam@jghnorth.org.uk.invalid> - 2019-10-15 18:21 +0100
                Re: Weather App reworked Julio Di Egidio <julio@diegidio.name> - 2019-10-15 12:32 -0700
                Re: Weather App reworked John G Harris <niam@jghnorth.org.uk.invalid> - 2019-10-16 16:06 +0100
  Re: Weather App reworked "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-13 14:02 -0700
    Re: Weather App reworked dr.j.r.stockton@gmail.com - 2019-10-14 13:28 -0700
      Re: Weather App reworked "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-14 14:58 -0700
    Re: Weather App reworked luserdroog <luser.droog@gmail.com> - 2019-10-15 09:00 -0700

csiph-web