Hi all,
So as we're getting into 2.6.x development in depth, I'd like to go over some best practices for migration where there are changes to existing APIs or addition of new APIs.
The first best practice is to document any migration.
Add the change in Migration26.md:
If it's a large change, then consider breaking out the documentation into its own page linked from Migration26.md, but note that in that case you must also add it to the table of contents:
Please see the documentation overview page at
for how to run the documentation server and add validation and tests.
If you have a method or class that you would like people not to use any more, then first consider deprecating the class, and mark it as "deprecated in 2.6.0" so it's clear to other developers this is a new deprecation. The deprecation message should contain both an indication of what to do about it, and a link to the migration notes explaining the migration in more detail:
For example, play.api.libs.concurrent.Execution.Implicits.defaultContext depends on Akka.system, which is the execution context connected to Play.current's ActorSystem. In this case, we want people to move to
class MyService @Inject()(implicit ec: ExecutionContext) {
}
but there is no direct documentation from the "old way" to the "new way" -- deprecation with a link to the migration notes is the best way to make that connection obvious to users.
The second best practice is to avoid breaking anything where possible, and to provide a fallback approach where it is not.
If you are dealing with something like implicit conversion in a base class or a change in execution flow which does not show up quite as easily in deprecation, then consider moving the deprecated methods into a DeprecatedImplicitConversions trait, and then that gives people something to fall back on.
The third best practice is to road test.
Take an existing Play 2.5.0 project that uses the old API, and try changing it to the new API. Assume the user changes the version number and doesn't read the documentation first -- what do they see first of all? If there are any configuration settings that have changed, do they know how and where they have moved? What would it look like to a first time user of Play? Modelling the user experience of upgrading ensures that things go smoothly on launch.
Please contribute your own tips and feedback to this thread -- I think that the 2.5.0 upgrade went pretty smoothly overall for most people, but I'm always interested in hearing what worked and what didn't.
Thanks,
--
Will Sargent
Engineer, Lightbend, Inc.