react-map-gl icon indicating copy to clipboard operation
react-map-gl copied to clipboard

API callback names inconsistency

Open abmai opened this issue 9 years ago • 15 comments

requesting for comment -

onChangeViewport bugs me a lot. I always want to use onViewportChanged or onViewportChange instead. There are a couple of other instances where we do on + <verb> + <noun> which is counter-intuitive.

I'll make a sweep and update, but wanted thoughts first. @ibgreen @Pessimistress @shaojingli

abmai avatar May 24 '17 23:05 abmai

@abmai I agree with your proposal. We have onWebGLInitialized in deck.gl, there is no reason to not follow that.

howtimeflies0 avatar May 24 '17 23:05 howtimeflies0

I always want to use onViewportChanged

It is a major breaking change, every single app will be affected.

But if we keep supporting the old prop with a warning, then fine, new apps will benefit from logical prop names, old apps will keep working.

ibgreen avatar May 25 '17 00:05 ibgreen

Isn't that what major version bumps mean? API breaking changes :p.

But in all seriousness - I'm cool with still supporting the old props and slapping a console.warn in it. But I do want to remove it eventually if we make the switch.

abmai avatar May 25 '17 02:05 abmai

What's our stance on deprecation, generally?

Seems that this kind of change can (should?) always be made over multiple versions as @ibgreen suggested. No reason to break older apps completely when you don't have to.

ericsoco avatar May 25 '17 16:05 ericsoco

What's our stance on deprecation, generally?

@shaojingli The team of contributors is growing, perhaps we need to start writing these things down. How about this?

  • Every feature removal should be given careful thought. Gently deprecating things (keep supporting them for 1+ release with a console warning) has a big value and is the preference.

  • But sometimes the price in e.g. complexity or code overhead can be too big (thinking about deck.gl v4 which has three big deprecated ChoroplethLayers that take up a lot of space in the app bundle but are used by very few apps. One could question whether keeping them was the right choice). The situation is similar for the less frequently used Overlays in react-map-gl v3.

  • In cases where we can't or won't do gentle deprecation, we should document the breaking changes in an upgrade guide.

Just yesterday I was asked to work with an old react-map-gl app that for some reason was hitting mapbox shader bugs, and I was able to fix it just by bumping it to latest react-map-gl v2.

If we had allowed trivial API breakages, I would have had to modify the app which would have taken a more time (and I would not have been ready in time for my demo :).

ibgreen avatar May 25 '17 16:05 ibgreen

I'm in favor of following what Facebook does with React in general - console.warn for API deprecations and clearly stating in the CHANGELOG and then deprecate 2-3 versions later.

The question also is when to eventually do the deprecation. Do we do it in a minor patch, or wait for a major version bump?

abmai avatar May 25 '17 17:05 abmai

Given we already have a few majors, everything that is potentially breaking should be done in a major

balthazar avatar May 25 '17 17:05 balthazar

The question also is when to eventually do the deprecation. Do we do it in a minor patch, or wait for a major version bump?

Isn't the key consideration that we should provide some reasonable time for users to update? If a feature has been deprecated for 6+ months, and we are cutting a new major release, it would seem acceptable to remove it.

If it was just deprecated a week earlier in a minor release, and we are cutting a new major release, then we should probably keep it around as deprecated for another major release.

ibgreen avatar May 25 '17 17:05 ibgreen

Even if it has only been deprecated for a week and we are about to draft a new major, we should take the opportunity to remove it completely as soon as possible. If users want to update to the latest major and stay on the edge, they'll have to do the appropriate changes.

balthazar avatar May 25 '17 17:05 balthazar

Great conversation. I'm in favor of where we've ended up here:

  • gently deprecate with console.warn when possible (and not too burdensome)
  • note API deprecation and removal in CHANGELOG
  • keep deprecated APIs for one major release
  • remove deprecated APIs only on major versions, but don't be shy about it

Note that we're not really talking only about react-map-gl here, these rules should probably apply across the Uber-OSS board. (Do we have a doc for "Uber OSS Best Practices"?)

ericsoco avatar May 25 '17 17:05 ericsoco

Note that we're not really talking only about react-map-gl here, these rules should probably apply across the Uber-OSS board. (Do we have a doc for "Uber OSS Best Practices"?)

That might be too prescriptive, and perhaps impractical. But for our geospatial/webgl stack (react-map-gl/deck.gl/luma.gl) it would make a lot of sense to follow the same set of rules.

For now, how about we document these things in a development-guidelines folder in deck.gl (being the biggest and most active framework) and we add a note in the other two indicating that they follow the same rules?

ibgreen avatar May 25 '17 18:05 ibgreen

Right, sorry, I meant Uber-Vis-OSS. But I'm all for good standards applied loosely. Your plan sounds good to me.

On Thu, May 25, 2017 at 11:08 AM, Ib Green [email protected] wrote:

Note that we're not really talking only about react-map-gl here, these rules should probably apply across the Uber-OSS board. (Do we have a doc for "Uber OSS Best Practices"?)

That might be too prescriptive, and perhaps impractical. But for our geospatial/webgl stack (react-map-gl/deck.gl/luma.gl) it would make a lot of sense to follow the same set of rules.

For now, how about we document these things in a development-guidelines folder in deck.gl (being the biggest and most active framework) and we add a note in the other two indicating that they follow the same rules?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/uber/react-map-gl/issues/254#issuecomment-304081129, or mute the thread https://github.com/notifications/unsubscribe-auth/ABEzWzcdzIMggRTrYkAvQ2kFkE2yzZyIks5r9cOLgaJpZM4Nlxg- .

ericsoco avatar May 25 '17 18:05 ericsoco

Sounds good. But yeah timeline should be sensible. If we're cutting major releases every 2 weeks then we should also re-evaluate life a bit :p.

It'll help to keep a clear log, going forward, of planned API deprecation and when the warnings were introduced to the user so as we work on new major versions, we can have a clear sense of how much time the user has had to make the necessary changes.

abmai avatar May 25 '17 18:05 abmai

I'm going to add a section on API addition / modification / deletion in API-GUIDELINES.md of deck.gl

howtimeflies0 avatar May 25 '17 18:05 howtimeflies0

@shaojingli I think that document is too deck.gl specific. I just pushed a branch dev-guidelines on deck.gl with the new folder and some base docs. Suggest you use that as a base and make a PR from that.

ibgreen avatar May 25 '17 18:05 ibgreen