New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested copy edits to 2 way binding article. #2

Merged
merged 1 commit into from Jun 9, 2014

Conversation

Projects
None yet
2 participants
@asolove
Contributor

asolove commented Jun 9, 2014

No description provided.

@@ -322,10 +322,10 @@ <h2 id="meteor">Meteor</h2>
<h2>Summary</h2>
<p>Backbone doesn’t support two-way data binding out of the box, it’s the only library here that overwrites currently edited input field with the same value.</p>
<p>Backbone doesn’t support two-way data binding out of the box. It’s the only library here that overwrites the currently edited input field with the same value.</p>
<p>React’s virtual DOM works well in most cases but needs some massaging when dealing with floating point numbers.</p>

This comment has been minimized.

@asolove

asolove Jun 9, 2014

Contributor

I think this isn't quite right. The virtual DOM is working fine. What this illustrates is actually an issue with React's philosophy of only storing the minimum of state and re-calculating as much as possible on the fly rather than storing lots of state and using bindings to sync it. If you show, and let users edit, calculated values rather than stored ones, you need to have functions a->b and b->a that work precisely, so that a->b->a is always exactly a.

If you don't, you'll need to do something like storing both pieces of state and updating one when the other changes.

@asolove

asolove Jun 9, 2014

Contributor

I think this isn't quite right. The virtual DOM is working fine. What this illustrates is actually an issue with React's philosophy of only storing the minimum of state and re-calculating as much as possible on the fly rather than storing lots of state and using bindings to sync it. If you show, and let users edit, calculated values rather than stored ones, you need to have functions a->b and b->a that work precisely, so that a->b->a is always exactly a.

If you don't, you'll need to do something like storing both pieces of state and updating one when the other changes.

This comment has been minimized.

@NV

NV Jun 9, 2014

Owner

5e0bbaa Any better?

@NV

NV Jun 9, 2014

Owner

5e0bbaa Any better?

@@ -106,7 +106,7 @@ <h2 id="vanilla">Vanilla JS</h2>
};
</script>

This comment has been minimized.

@asolove

asolove Jun 9, 2014

Contributor

I think it might be worth starting out saying that you're going to write these solutions the 'naive' way using each framework. On some level none of the 'bugs' are actually bugs with the frameworks. They're just cases when you need to do more manual work as a developer to get things to work right.

@asolove

asolove Jun 9, 2014

Contributor

I think it might be worth starting out saying that you're going to write these solutions the 'naive' way using each framework. On some level none of the 'bugs' are actually bugs with the frameworks. They're just cases when you need to do more manual work as a developer to get things to work right.

This comment has been minimized.

@NV

NV Jun 9, 2014

Owner

I linked to two StackOverflow questions that have solutions. I think I’ll leave it at that.

@NV

NV Jun 9, 2014

Owner

I linked to two StackOverflow questions that have solutions. I think I’ll leave it at that.

@@ -322,10 +322,10 @@ <h2 id="meteor">Meteor</h2>
<h2>Summary</h2>
<p>Backbone doesn’t support two-way data binding out of the box, it’s the only library here that overwrites currently edited input field with the same value.</p>
<p>Backbone doesn’t support two-way data binding out of the box. It’s the only library here that overwrites the currently edited input field with the same value.</p>

This comment has been minimized.

@asolove

asolove Jun 9, 2014

Contributor

Is it worth covering selectionStart, etc. as a way to avoid this problem when you do need to change a value in a text field?

@asolove

asolove Jun 9, 2014

Contributor

Is it worth covering selectionStart, etc. as a way to avoid this problem when you do need to change a value in a text field?

This comment has been minimized.

@NV

NV Jun 9, 2014

Owner

Good point. I didn’t want to cover it because it would be too much extra code.

@NV

NV Jun 9, 2014

Owner

Good point. I didn’t want to cover it because it would be too much extra code.

@@ -177,7 +177,7 @@ <h2 id="backbone">Backbone.js</h2>
</code></pre>

This comment has been minimized.

@asolove

asolove Jun 9, 2014

Contributor

Having the fahrenheit method as both a getter and a setter is not particularly idiomatic Backbone.

@asolove

asolove Jun 9, 2014

Contributor

Having the fahrenheit method as both a getter and a setter is not particularly idiomatic Backbone.

This comment has been minimized.

@NV

NV Jun 9, 2014

Owner

What is? getFahrenheit and setFahrenheit?

@NV

NV Jun 9, 2014

Owner

What is? getFahrenheit and setFahrenheit?

This comment has been minimized.

@asolove

asolove Jun 9, 2014

Contributor

I think more idiomatic would be storing both celsius and fahrenheit in the model data, and having setters for each of them, where each setter sets both.

@asolove

asolove Jun 9, 2014

Contributor

I think more idiomatic would be storing both celsius and fahrenheit in the model data, and having setters for each of them, where each setter sets both.

This comment has been minimized.

@NV

NV Jun 9, 2014

Owner

I could use some more consistency, but I wanted to show both model methods and model properties.

@NV

NV Jun 9, 2014

Owner

I could use some more consistency, but I wanted to show both model methods and model properties.

NV added a commit that referenced this pull request Jun 9, 2014

Merge pull request #2 from asolove/binding-copy
Suggested copy edits to 2 way binding article.

@NV NV merged commit e5697d1 into NV:master Jun 9, 2014

@NV

This comment has been minimized.

Show comment
Hide comment
@NV

NV Jun 9, 2014

Owner

Thanks a lot!

Owner

NV commented Jun 9, 2014

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment