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


Groups > comp.lang.javascript > #40563

Re: Array object sorted on time, how to deal with.

Newsgroups comp.lang.javascript
Date 2021-11-26 16:02 -0800
References (6 earlier) <6ee13397-3a3f-4ad5-8d46-8f9eb85debd8n@googlegroups.com> <878rxff75v.fsf@bsb.me.uk> <snimfa$7p4$1@dont-email.me> <bee25966-1d2e-4e8e-85e2-0912c0ad9340n@googlegroups.com> <snr8d4$vmj$1@dont-email.me>
Message-ID <542db347-0e59-4297-bc56-9bc77ebd7214n@googlegroups.com> (permalink)
Subject Re: Array object sorted on time, how to deal with.
From luserdroog <luser.droog@gmail.com>

Show all headers | View raw


On Friday, November 26, 2021 at 12:18:20 PM UTC-6, John Harris wrote:
> On 26/11/2021 02:05, luserdroog wrote: 
> 
> <snip>> Agreed that there might be other data structures that are
> even better suited 
> > to the task. But I hope I can safely say we all agree that it is a good idea 
> > to abstract this stuff off and make the data structure reasonably self-contained 
> > and isolated from the business logic of the application. Ie. you'd still 
> > interface with the linked list through *functions*, right?
> <snip> 
> 
> It's an object, so when you say *functions* you really mean *method 
> function*, right? 
> 
> John

They could certainly be method functions. And if we're borrowing the
implementation from somewhere on the web then it's almost certain
to be built with method functions. But I don't consider it a hard line.
If Jonas finds it easier to do with normal (global) functions, then that
still fits with my programme. 

Either using methods or just plain functions, both should have the
benefit of eliminating code duplication and reducing the size of
existing functions. 

I think this all falls under the DRY (Don't Repeat Yourself) principle.

If you have the same (or similar) code in more than one place,
then sooner or later you're going to forget to change one spot
when it needs to change. 

But if the code is in one place, one function, and everything calls
that function instead of using inline code, then you have just
one place to change. Doing this consistently can eliminate a
whole class of bugs that just waste your time (and rob the world 
of the results of your creativity).

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


Thread

Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-10-26 01:44 -0700
  Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-10-26 01:48 -0700
    Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-05 00:48 -0700
      Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-19 17:59 -0800
        Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-20 20:41 -0800
          Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-21 04:28 -0800
            Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-22 20:36 -0800
              Re: Array object sorted on time, how to deal with. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-23 11:22 +0000
                Re: Array object sorted on time, how to deal with. The Natural Philosopher <tnp@invalid.invalid> - 2021-11-23 12:23 +0000
                Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-25 18:05 -0800
                Re: Array object sorted on time, how to deal with. John Harris <niam@jghnorth.org.uk.invalid> - 2021-11-26 18:18 +0000
                Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-26 16:02 -0800
                Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-25 18:17 -0800
                Re: Array object sorted on time, how to deal with. Richard Damon <Richard@Damon-Family.org> - 2021-11-25 22:27 -0500
                Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-25 20:14 -0800
                Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-25 21:02 -0800
                Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-26 16:18 -0800
                Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-25 20:41 -0800
                Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-25 21:06 -0800

csiph-web