naveen.chwl at gmail.com
Mon Dec 18 18:36:25 UTC 2017
Using static methods with plain objects can be cool if you don't want
method overriding and/or inheritance. Otherwise using classes and methods
makes that simpler to accomplish.
On Mon, 18 Dec 2017 at 20:53 Isiah Meadows <isiahmeadows at gmail.com> wrote:
> For one specific example, plain objects can be treated like C structs.
> For most scenarios you'd want "methods", you could get away just as
> easily with functions taking the instance as an argument (in
> particular, you could still use `this`, although I don't in practice).
> I've used this pattern quite a bit when I have a bit of state that
> needs accessed in several places, but actions are more easily
> encapsulated. This isn't as elegant for things like DSLs, but it's
> useful for more stateful programming.
> Isiah Meadows
> me at isiahmeadows.com
> Looking for web consulting? Or a new website?
> Send me an email and we can get started.
> On Mon, Dec 18, 2017 at 6:25 AM, Naveen Chawla <naveen.chwl at gmail.com>
> > hierarchies that require overriden methods, and offer a memory
> > gain in the case of when there are many instances vs using plain objects
> > do the same (which incurs a memory overhead for each instance's functions
> > even when they are the same as each other). The only encapsulated way of
> > doing this before ES6 was to use prototype, which is easier to get wrong
> > especially if there is more than two levels of depth of method
> > You get to chose what works for you. You can even argue for using plain
> > objects in certain cases where somebody has decided to use classes. That
> > nothing to do with what the language offers for those whose applications
> > simpler and more performant using classes instead.
> > On Mon, 18 Dec 2017 at 03:31 Frederick Stark <coagmano at gmail.com> wrote:
> >> I appreciate hearing Kai's point of view and think that we've had this
> >> exact discussion enough times. At this point it just adds to inbox
> >> without changing any minds
> >> On Dec 18 2017, at 8:23 am, Terence M. Bandoian <terence at tmbsw.com>
> >>> I appreciate hearing Kai's point of view and don't think he should be
> >>> silenced.
> >>> -Terence Bandoian
> >>> On 12/17/2017 2:03 PM, T.J. Crowder wrote:
> >>> On Sun, Dec 17, 2017 at 7:21 PM, Jordan Harband <ljharb at gmail.com>
> >>> >
> >>> > Adding features in *no way* sacrifices simplicity or ease-of-use
> >>> > for smaller web projects; as has been said many times on this
> >>> > list, if you don't like any new feature, simply choose not to use
> >>> > it.
> >>> And in many or even most cases, markedly *improves* simplicity and
> >>> ease-of-use. As has also been repeatedly pointed out.
> >>> Kai: Genuine questions are fine. Questions which are really just you
> >>> pushing your agenda of "don't change anything ever again" and your
> >>> -- and solitary -- claim that "all this new stuff makes life difficult
> >>> people" are, at best, pointless. Your position has been made crystal
> >>> There's no need to bang on about it.
> >>> -- T.J. Crowder
> >>> _______________________________________________
> >>> es-discuss mailing list
> >>> es-discuss at mozilla.org
> >>> https://mail.mozilla.org/listinfo/es-discuss
> >> _______________________________________________
> >> es-discuss mailing list
> >> es-discuss at mozilla.org
> >> https://mail.mozilla.org/listinfo/es-discuss
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss