← Back to context

Comment by deanCommie

6 years ago

I'm really struggling to empathize with your point here.

I SUSPECT you are expecting that the questionner is going to hold you to an incredibly high and rigorous bar and in fact I don't think that's true. If you say "It will improve our user's perceived client latency" i expect that is sufficient - IF TRUE.

And this is the key. In software everything is a tradeoff. I don't know what the tradeoffs with using React are, but tenerally the industry trend right now is React is worth it. But why? I think it's a fair question to understand that, otherwise you're just cargo culting an architecture without understanding it.

BTW blindly following a trend is itself a choice and a tradeoff. You might not need a deeper answer for using React than "A lot of people use React, so if we use React it'll be easier to hire people to continue to make changes." That's a valid technical decision to use something!

I'm not a frontend engineer, BTW. However I just googled Javascript Locality and React Locality and found basically nothing reasonable except https://stackoverflow.com/questions/45069206/does-data-local...

So I do feel like i'm going to illustrate my point here and ask you "What is locality in this context? Why is it important? Is React the only way to achieve it? What are we choosing as a tradeoff?"

I think I did a poor job of explaining the situation I was referring to. My point was I could’ve made a better job explaining a concept, but I just wasn’t prepared for or had the capacity to do so at the spot. Explaining complex things in an ad-hoc fashion with no preparation is hard, is what I’m saying.

Locality is about having the code for one feature in one spot. If you can remove a feature by deleting one piece of code at one place, for example an entire file, then the feature is local to that file. It allows you to make changes and remove features without understanding the entire application. Without it, you have to understand the entire codebase to make any changes, which goes from hard to impossible as the project grows. This is why globals are a pain.

Locality is related to code cohesion and loose coupling.

React encourages locality because you’re only supposed to pass data one way, which gives you a sort of tree structure where you can remove a branch without affecting other branches.

Of course you can mess this up in React as well, React is no silver bullet and you can do it without React.

There is so much to talk about here, but none of that is relevant to the point I’m trying to make, which is:

I should probably have been able to explain all of this to the person asking, but it’s a lot harder to do so verbally with no preparation than it is to write it down like this.

  • The context here might be that we are in a design review - you are presenting a design. Maybe it's verbally, but maybe it's a document.

    Ideally it's a document, so you can describe it by writing it down.

    But if someone asks a hard question that you didn't prepare for, well you still have to make a best effort to answer it verbally.

    You can use "I'll write down my thoughts and get back to you" to SOME things, but not every time.

    • My original context was rather that of a junior developer asking a more experienced developer what choices to make, and then questioning them. Which is good, but sometimes the knowledge gap is just too wide to deal with then and there.