+1 for using modern JS wherever applicable. Am Fr., 30. Nov. 2018, 06:55 hat Darryl Pogue <dvpdin...@gmail.com> geschrieben:
> I both agree and disagree with your points :P > > To your first point, yes ES6 classes are just syntactic sugar around > prototypes, but that sugar exists for a reason and it's extremely > popular now. Personally, I've been using class syntax at work for > going on three years now, and looking at some parts of the Cordova > code that are obviously implementing a class pattern with ES5 syntax > just makes it feel like nobody has touched or dusted off the code > since the pre-ES6 days. This is the modern style of JavaScript, and I > find it much easier to glance at a class and see easily which things > belong to the instance vs the class compared to needing to check > whether something was declared on the prototype or not. For better or > worse, there are people coming to JavaScript today who will be much > more comfortable with ES6 classes than with the ES5 style of > prototypical declarations, and I think that using ES6 classes makes > the code clearer, more readable, and more maintainable. > > But only where it makes sense to use classes. We should only use > classes where it makes sense, where we have some sort of instance of > something and it's encapsulating data and providing methods to > interact with/manipulate that data. > > I definitely feel like the majority of Cordova can and should be set > up in a functional programming-inspired style, where it's just > functions that do one task, and they get chained together. > > > On Thu, Nov 29, 2018 at 6:22 PM Chris Brody <chris.br...@gmail.com> wrote: > > > > I would not personally favor using ES6 classes, here are my main reasons: > > * ES6 class is really sugar around prototypal inheritance, unlike many > > other languages > > * In many cases it is better to use functional programming and factory > > functions than classes > > > > Some reading: > > * > https://artem.today/what-is-behind-syntactical-sugar-in-es6-classes-6dfa4ab4d6a2 > > * > https://medium.com/javascript-scene/the-two-pillars-of-javascript-ee6f3281e7f3 > > * > https://medium.com/javascript-scene/why-composition-is-harder-with-classes-c3e627dcd0aa > > * > https://hackernoon.com/favor-object-composition-over-class-inheritance-they-said-9f769659b6e > > On Thu, Nov 29, 2018 at 9:20 PM Chris Brody <chris.br...@gmail.com> > wrote: > > > > > > I was wondering what our sentiment should be about using ES6 classes? > > > > > > My own opinion in coming in a response email. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org > > For additional commands, e-mail: dev-h...@cordova.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org > For additional commands, e-mail: dev-h...@cordova.apache.org > >