These are chat archives for whereat/contrib

1st
Apr 2016
aguestuser
@aguestuser
Apr 01 2016 05:51
apropos of trying to figure out signing .apk's and deploying them to the Play Store via CI Pipepline: this guy did it with Travis and this guy says Jenkins is the only way!
Paul Nasrat
@pnasrat
Apr 01 2016 16:06
I'm fairly happy with travis. But write up the CI stories with the requirements and we can see what fits best.
Alexander Martin
@alxmrtn
Apr 01 2016 19:37
until we make a CI decision can we remove the circle integration with github as it may be confusing?
aguestuser
@aguestuser
Apr 01 2016 21:44
Yes!
Hey gang! Just spoke on a fun class about human-centered design at NYU that I think netted us a new contributor! His name's Druv and he'll hopefully be showing up here soon! Let's give him a warm welcome! :)
Sorry! * Dhruv!
Meitar M.
@meitar
Apr 01 2016 22:38
Hello everyone. I'm not Dhruv, I'm maymay. I spoke to @aguestuser a couple days ago and am currently working my way through the React primer to see how likely it is I might be able to contribute. I have a question (mostly for Austin but I'll post it here for posterity's sake): when we spoke, you mentioned how you strongly prefer a functional style so that you could minimize your use of variables to store state as much as possible. React seems like it wants to do things differently, storing state for components pretty explicitly. Am I misunderstanding what React's concept of "state" really is? Or, alternately, am I misunderstanding the reason for where@'s preference for functional programming and thus conflating why React's state concepts are okay in the framework versus in the where@ logic? Or, is this a silly question that betrays my complete ignorance in some area that I don't yet know how to speak about intelligently?
aguestuser
@aguestuser
Apr 01 2016 23:09
great question! and welcome to the gitter @meitar ! :smile: answer's sorta long so imma put it in another message....
so... the main thing about functional programming ("FP" for short) is that there's really one main design pattern (easy to remember): "no mutations, no side effects."
since we can't always get that, we often settle for "minimize mutations, minimize side effects"
the point here is not that in an FP paradigm we don't have state altogether. it's that we want -- where possible -- to isolate it to inputs that pass into and out of functions. if we change something we do it inside a function, and we try not to change ("mutate") state that is living somewhere else. that way, our entire program becomes understandable locally -- inside the small chunks that are our functions, which can then be composed together to generate more complex behavior (in much the same way you'd "compose" objects together into heirarchies, but want those objects to be decoupled as much as possible.)
if in object oriented programming (OO), we try to achieve the goal of decoupling/modularity by wrapping mutation in private variables that are only accessible inside an object, in FP, we try to do something similar, by isolating mutation inside functions, or eliminating it altogether. but that means the state doesn't "live" somewhere (in some nouny object that we can go change if we have a reference to it. it flows through our functions and we alter it as the data flows through. as far as each function is concerned, though, what it gets as input is an immutable fact)...
aguestuser
@aguestuser
Apr 01 2016 23:14
(for a decent and very approachable intro to this paradigm in python see mary rose cook's EXCELLENT primer on FP in python: https://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming)
(and some more stuff in the section on fp in the dev glossary on our wiki)
BUT! to get back to your question... which was about FP/state in react!
to the extent that React on its own is functional, it's because it takes care to isolate mutable state as much as possible to a position high up in the component tree
for components further down, they just take props (which are immutable) as input, and render out some picture of the DOM tree as output
so we could say that react on its own is trying to minimize mutation and side effects, but you're VERY correct that it does not avoid them altogether
that's where Redux comes in!
Redux is a library for managing state that was made by one of the best functional programmers in know of working in Javascript (Dan Abramov)
When you get to that part of the primer, pay special attention to the strong opinions that it has about the way it thinks about state
in Redux, an "action creator" (the main thing that changes stuff and updates state in the app) is just a function with the "signature":
(action, state) -> state
in other words, any time something changes, we call a function that takes an action and a prior state as arguments, and spits back out another (completely new!) state
aguestuser
@aguestuser
Apr 01 2016 23:19
so we never mutate the original state or ever refer to it again!!!
we just use it (along with some set of rules provided by the action) to build a new state!
there are a lot of benefits that come from that, but many are probably outside the scope of answering this question.
suffice it to say, it's worth noticing that the Redux docs are at great pains to stress that when you use a "reducer" to change the Big Global State tree, you have to take care to do it in such a way that doesn't "mutate" the input state that you start off with, but rather uses it as the foundation to build a completely new state as output
Meitar M.
@meitar
Apr 01 2016 23:22
That answers my question really well. Thanks. :) I haven't gotten to the Redux part of your primer (obviously) so I'll continue to that part with this in mind.
aguestuser
@aguestuser
Apr 01 2016 23:22
yeah: but you're DEAD ON that react on it's own sits in this really weird position with regards FP! it's sort of hinting at it but not totally doing it
which in fact is why Abramov decided to make Redux!
when you get to that part (and if this stuff piques your curiosity), i highly recommend checking out the talk linked to in the primer about why he decided to make Redux. it also covers (WAY more eloquently than i could) what some of the benefits of having commited to the "no mutation" rule are.
Meitar M.
@meitar
Apr 01 2016 23:23
Yeah, okay, that makes a lot more sense now. As an aside, I found JavaScript Allongé, a free leanpub-published book that purports to be a "learn JavaScript" book but is actually a "learn functional programming by learning JavaScript" book, and if you're not already aware of it, you might enjoy it a lot.
aguestuser
@aguestuser
Apr 01 2016 23:24
yes! i've heard it's great but have never picked it up!
probably a good resource to add to the wiki for folks looking to find their way into the JS stack
Meitar M.
@meitar
Apr 01 2016 23:25
I read through a third of it or so and really liked the way it started from the ground up without assuming "advanced concepts" were actually "too advanced to explain in the beginning of the book."
Okay, I'll do that.
aguestuser
@aguestuser
Apr 01 2016 23:25
in general: thanks for asking this question! (1) we should all ask questions and answer them in places like this where people who join us can benefit, and (2) in general, i think functional programmers are kind of jerks and don't spend enough time justifying why they like the stuff they like. instead they just act fancy and make other people feel dumb, and as a result, nobody likes the cool stuff they're trying to use!
Meitar M.
@meitar
Apr 01 2016 23:26
IMHO that attitude is not limited to functional programmers…. But I hear ya.
aguestuser
@aguestuser
Apr 01 2016 23:26
hahah! yeah, it's just they know more math or something? ;D
Meitar M.
@meitar
Apr 01 2016 23:26
To add this to your wiki I should fork whereat/wiki and send you a pull request?
aguestuser
@aguestuser
Apr 01 2016 23:27
nah! for wiki, just edit it directly. i think i have to make you a member of the maintainers group to do that, tho... one sec!
Meitar M.
@meitar
Apr 01 2016 23:27
No, wait, your wiki is a wiki in the wiki in the wiki repo. Im confused.
Ah! That's what I'm missing.
aguestuser
@aguestuser
Apr 01 2016 23:27
haha! i know!
it's the wiki/wiki!
it IS confusing!
if you want to pull it locally, you have to clone https://github.com/whereat/wiki.wiki.git
but it seems like most folks prefer to just edit directly on the page
invite sent!
Meitar M.
@meitar
Apr 01 2016 23:30
Whatever way you prefer editors to do so is fine by me.
Cool, thx! Back to the primer with me.
aguestuser
@aguestuser
Apr 01 2016 23:32
:+1: