Skip to content
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

rfc 79: cdk v2.0 - change strategy on how deprecated APIs are handled #241

Merged
merged 4 commits into from
Sep 7, 2020

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented Aug 25, 2020

Two changes to the RFC:

  • The branch name next has been updated to v2 throughout the RFC.
    The name v2 is a lot clearer on what the branch indicates than slightly
    more vague next.
  • The strategy on how deprecated APIs are handled has been revamped to
    be less manual and more automated. A one-time clean up towards the end
    of the project is included.

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache-2.0 license

Two changes to the RFC:
- The branch name `next` has been updated to `v2` throughout the RFC.
- The strategy on how deprecated APIs are handled has been revamped to
be less manual and more automated. A one-time clean up towards the end
of the project is included.
@nija-at nija-at requested a review from a team August 25, 2020 17:33
@nija-at nija-at self-assigned this Aug 25, 2020
@nija-at nija-at added the pr/do-not-merge Let mergify know not to auto merge label Aug 25, 2020
@nija-at
Copy link
Contributor Author

nija-at commented Aug 26, 2020

Moving this to draft as I work through some of the details.

@nija-at nija-at marked this pull request as draft August 26, 2020 06:59
text/0079-cdk-2.0.md Show resolved Hide resolved
text/0079-cdk-2.0.md Outdated Show resolved Hide resolved
@nija-at nija-at marked this pull request as ready for review August 26, 2020 16:29
@nija-at nija-at requested a review from a team August 26, 2020 16:30
- `cdk-build` will be updated to recognize the environment variable `CDK_BLOCK_DEPRECATIONS` and set the
`--no-deprecated` flag on the `jsii` assembler.

- All current usage of deprecated APIs within the CDK repository will be removed. In addition, a new check will be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about things that are deprecated because we think it's a bad idea to use them, but that we don't want to remove? (One example that springs to my mind are unversioned Engines in RDS, but I'm sure there's more of them)

We need some mechanism for preserving deprecated things that we don't want to remove in v2.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this new category of deprecated APIs?

If it's a bad idea for customers to use them, they should be removed, and customers should use the better APIs that should now be available.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this new category of deprecated APIs?

If it's a bad idea for customers to use them, they should be removed, and customers should use the better APIs that should now be available.

That's not really an option, because L2s should model the entire service area of the service, even things we consider not to be good practices.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not clear what you mean.

In the example you've provided, they would use the versioned engines API, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that would mean it's impossible to create an Instance/Cluster without a version, violating the above tenet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the api will not be removed in the next major version is not deprecated. Maybe it's "NOT RECOMMENDED TO USE" but the term deprecated should not mean two different things. Keep it simple please

Copy link
Contributor Author

@nija-at nija-at Sep 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to @eladb.

It's not clear how much the IDE helps the user today anyway. In fact, we're now adding the word deprecated into the doc summary - aws/jsii@ce8c0c4

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, IDEs mark the usage of something deprecated pretty clearly (here's an example in Intellij).
Screen Shot 2020-09-04 at 8 51 12 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the api will not be removed in the next major version is not deprecated. Maybe it's "NOT RECOMMENDED TO USE" but the term deprecated should not mean two different things. Keep it simple please

This is not the definition of "deprecated" that I know. For example, there are APIs still available in Java that have been deprecated since the 90s.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, IDEs mark the usage of something deprecated pretty clearly (here's an example in Intellij).

Screen Shot 2020-09-04 at 8 51 12 AM

That's not the case for VSCode unfortunately, which is probably the most used by our users.

For example, there are APIs still available in Java that have been deprecated since the 90s.

The fact that java decided to not remove these between major versions doesn't mean we should leave deprecated "debt" behind.

I think this is just about the semantics and I really prefer that keep the term "deprecated" reserved for APIs that will (most likely) be removed in the next major release (unless there are very unique circumstances that may require keeping it for another round). The api you are describing is not being deprecated but perhaps not recommended to use. If possible we should deprecate and remove it, if not, we should state in the docs and even add a warning if it's used.

rix0rrr
rix0rrr previously approved these changes Sep 2, 2020
Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I found a situation where this strategy is going to break:

https://github.com/aws/aws-cdk/blob/443948164e09aaa81c094c013b32aa1f67b69570/packages/%40aws-cdk/core/lib/stack-synthesizers/legacy.ts#L75

This is where we purposely call a deprecated API for backwards compatibility, and that will need to stay in.

I am okay with the general gist of this strategy, but we're going to need an exclude list of some sort.

@nija-at
Copy link
Contributor Author

nija-at commented Sep 2, 2020

This is where we purposely call a deprecated API for backwards compatibility, and that will need to stay in.

Why not change that line to this.stack.synthesizer.addFileAsset(asset);?

@rix0rrr
Copy link
Contributor

rix0rrr commented Sep 3, 2020

The point is: people used to be able to override a method on Stack. That's @deprecated, but still supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/do-not-merge Let mergify know not to auto merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants