Skip to main content

From Code Refactoring to API Refactoring: Agile Service Design and Evolution

  • Conference paper
  • First Online:
Service-Oriented Computing (SummerSOC 2021)

Part of the book series: Communications in Computer and Information Science ((CCIS,volume 1429))

Included in the following conference series:

Abstract

Refactoring is an essential agile practice; microservices are a currently trending implementation approach for service-oriented architectures. While program-internal code refactoring is well established, refactoring components on the architectural level has been researched but not adopted widely in practice yet. Hence, refactoring service Application Programming Interfaces (APIs) is not understood well to date. As a consequence, practitioners struggle with the evolution of APIs exposed by microservices. To overcome this problem, we propose to switch the refactoring perspective from implementation to integration and study how refactorings can be applied to the problem domain of agile service API design and evolution. We start with an empirical analysis and assessment of the state of the art and the practice. The contributions of this paper then are: 1) presentation of results from a practitioner survey on API change and evolution, 2) definitions for a future practice of API refactoring and 3) a candidate catalog of such API refactorings. We discuss these contributions and propose a research action plan as well.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    http://www.syncdev.com/minimum-viable-product/.

  2. 2.

    http://wirfs-brock.com/blog/2011/01/18/agile-architecture-myths-2-architecture-decisions-should-be-made-at-the-last-responsible-moment/.

  3. 3.

    https://martinfowler.com/articles/injection.html.

  4. 4.

    https://aws.amazon.com/architecture/well-architected.

  5. 5.

    https://docs.microsoft.com/en-us/azure/architecture/framework.

  6. 6.

    https://stackoverflow.com/.

  7. 7.

    https://www.microsoft.com/en-us/servicesagreement/default.aspx.

  8. 8.

    http://www.jamesshore.com/v2/blog/2005/red-green-refactor.

  9. 9.

    One might argue that this violates the original definition of refactoring because the observable behavior is clearly and deliberately changed. In the refactoring example given earlier, a local variable is renamed, making it unlikely that the observable behavior of the software changes. But refactorings involving multiple classes, for example moving a method from one class to another, change the interfaces of these classes – possibly including public ones – in a backwards-incompatible manner. Whether this constitutes observable behavior depends on the viewpoint and expectations of the observer: an API client developer might notice and be directly affected by the change, but not the end user of the software. It has been shown that behavior-changing modifications still qualify as refactorings [11].

  10. 10.

    https://www.microservice-api-patterns.org, also see [15, 22, 30, 31, 33].

  11. 11.

    At https://interface-refactoring.github.io we have started to publish these refactorings; names and content of the refactoring are subject to change.

  12. 12.

    Only include a pattern if there are at least three known uses. Not to be confused with the “rule of three” of refactoring [6] duplicated pieces of code, where it refers to the number of duplicates starting from which a refactoring is recommended.

  13. 13.

    www.ozimmer.ch/practices/2021/03/05/POINTPrinciplesForAPIDesign.html.

References

  1. Balalaie, A., Heydarnoori, A., Jamshidi, P.: Microservices architecture enables DevOps: migration to a cloud-native architecture. IEEE Softw. 33(3), 42–52 (2016)

    Article  Google Scholar 

  2. Beck, K., Andres, C.: Extreme Programming Explained: Embrace Change, 2nd edn. Addison-Wesley Professional, Boston (2004)

    Google Scholar 

  3. Cossette, B.E., Walker, R.J.: Seeking the ground truth: a retroactive study on the evolution and migration of software libraries. In: Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering. FSE 2012. Association for Computing Machinery, New York (2012)

    Google Scholar 

  4. Dig, D., Johnson, R.: The role of refactorings in API evolution. In: 21st IEEE International Conference on Software Maintenance (ICSM 2005), pp. 389–398 (2005)

    Google Scholar 

  5. Dig, D., Johnson, R.: How do APIs evolve? A story of refactoring: research articles. J. Softw. Maint. Evol. 18(2), 83–107 (2006)

    Article  Google Scholar 

  6. Fowler, M.: Refactoring. Addison-Wesley Signature Series (Fowler). Addison-Wesley, Boston. 2 edn. (2018)

    Google Scholar 

  7. Hunt, A., Thomas, D.: The Pragmatic Programmer: From Journeyman to Master. Addison-Wesley, Boston (2000)

    Google Scholar 

  8. Jamshidi, P., Pahl, C., Mendonca, N.C., Lewis, J., Tilkov, S.: Microservices: the journey so far and challenges ahead. IEEE Softw. 35(03), 24–35 (2018)

    Article  Google Scholar 

  9. Kasunic, M.: Designing an Effective Survey. Software Engineering Institute (2005)

    Google Scholar 

  10. Kerievsky, J.: Refactoring to Patterns. Pearson Higher Education (2004)

    Google Scholar 

  11. Kim, M., Zimmermann, T., Nagappan, N.: A field study of refactoring challenges and benefits. In: Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering. FSE 2012, Association for Computing Machinery, New York (2012)

    Google Scholar 

  12. Kula, R.G., Ouni, A., German, D.M., Inoue, K.: An empirical study on the impact of refactoring activities on evolving client-used APIs. Inf. Softw. Technol. 93, 186–199 (2018)

    Article  Google Scholar 

  13. Kwon, Y.W., Tilevich, E.: Cloud refactoring: automated transitioning to cloud-based services. Autom. Softw. Eng. 21(3), 345–372 (2014)

    Article  Google Scholar 

  14. Li, J., Xiong, Y., Liu, X., Zhang, L.: How does web service API evolution affect clients? In: 2013 IEEE 20th International Conference on Web Services, pp. 300–307 (2013)

    Google Scholar 

  15. Lübke, D., Zimmermann, O., Stocker, M., Pautasso, C., Zdun, U.: Interface evolution patterns - balancing compatibility and extensibility across service life cycles. In: Proceedings of the 24th EuroPLoP conference. EuroPLoP 2019 (2019)

    Google Scholar 

  16. Menascé, D.A.: QoS issues in web services. IEEE Internet Comput. 6(6), 72–75 (2002)

    Article  Google Scholar 

  17. Neri, D., Soldani, J., Zimmermann, O., Brogi, A.: Design principles, architectural smells and refactorings for microservices: a multivocal review. SICS Softw. Intensive Cyber Phys. Syst. 35(1), 3–15 (2020)

    Google Scholar 

  18. Pautasso, C., Zimmermann, O., Amundsen, M., Lewis, J., Josuttis, N.M.: Microservices in practice, part 2: service integration and sustainability. IEEE Softw. 34(2), 97–104 (2017)

    Article  Google Scholar 

  19. Rodríguez, C., et al.: REST APIs: a large-scale analysis of compliance with principles and best practices. In: Bozzon, A., Cudre-Maroux, P., Pautasso, C. (eds.) ICWE 2016. LNCS, vol. 9671, pp. 21–39. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-38791-8_2

    Chapter  Google Scholar 

  20. Rosenberg, F., Celikovic, P., Michlmayr, A., Leitner, P., Dustdar, S.: An end-to-end approach for QoS-aware service composition. In: IEEE International Conference on Enterprise Distributed Object Computing Conference (EDOC 2009), pp. 151–160. IEEE (2009)

    Google Scholar 

  21. Stal, M.: Agile Software Architecture. Morgan Kaufmann (12 2013)

    Google Scholar 

  22. Stocker, M., Zimmermann, O., Lübke, D., Zdun, U., Pautasso, C.: Interface quality patterns - communicating and improving the quality of microservices APIs. In: Proceedings of the 23nd EuroPLoP conference. EuroPLoP 2018 (2018)

    Google Scholar 

  23. Suryanarayana, G., Sharma, T., Samarthyam, G.: Software process versus design quality: tug of war? IEEE Softw. 32(4), 7–11 (2015)

    Article  Google Scholar 

  24. Wang, S., Keivanloo, I., Zou, Y.: How do developers react to RESTful API evolution? In: Franch, X., Ghose, A.K., Lewis, G.A., Bhiri, S. (eds.) ICSOC 2014. LNCS, vol. 8831, pp. 245–259. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-662-45391-9_17

    Chapter  Google Scholar 

  25. Zdun, U., Stocker, M., Zimmermann, O., Pautasso, C., Lübke, D.: Guiding architectural decision making on quality aspects in microservice APIs. In: 16th International Conference on Service-Oriented Computing ICSOC 2018, pp. 78–89, November 2018

    Google Scholar 

  26. Zeng, L., Benatallah, B., Dumas, M., Kalagnanam, J., Sheng, Q.Z.: Quality driven web services composition. In: Proceedings of the 12th International Conference on World Wide Web, pp. 411–421. ACM (2003)

    Google Scholar 

  27. Zimmermann, O.: Architectural refactoring: a task-centric view on software evolution. IEEE Softw. 32(2), 26–29 (2015)

    Article  Google Scholar 

  28. Zimmermann, O.: Architectural refactoring for the cloud: decision-centric view on cloud migration. Computing 99(2), 129–145 (2017)

    Article  MathSciNet  Google Scholar 

  29. Zimmermann, O.: Microservices tenets. Comput. Sci. 32(3–4), 301–310 (2017)

    Google Scholar 

  30. Zimmermann, O., Lübke, D., Zdun, U., Pautasso, C., Stocker, M.: Interface responsibility patterns: processing resources and operation responsibilities. In: Proceedings of the 25th EuroPLoP conference. EuroPLoP 2020 (2020)

    Google Scholar 

  31. Zimmermann, O., Pautasso, Cesare Lübke, D., Zdun, U., Stocker, M.: Data-oriented interface responsibility patterns: types of information holder resources. In: Proceedings of the 25th EuroPLoP conference. EuroPLoP 2020 (2020)

    Google Scholar 

  32. Zimmermann, O., Stocker, M., Lübke, D., Pautasso, C., Zdun, U.: Introduction to microservice API patterns (MAP). In: Cruz-Filipe, L., Giallorenzo, S., Montesi, F., Peressotti, M., Rademacher, F., Sachweh, S. (eds.) Joint Post-proceedings of the First and Second International Conference on Microservices (Microservices 2017/2019), vol. 78, pp. 4:1–4:17 (2020)

    Google Scholar 

  33. Zimmermann, O., Stocker, M., Lübke, D., Zdun, U.: Interface representation patterns: crafting and consuming message-based remote APIs. In: Proceedings of the 22nd EuroPLop, EuroPLoP 2017, pp. 27:1–27:36. ACM (2017)

    Google Scholar 

Download references

Acknowledgments

We would like to thank all reviewers and participants of the survey. The work of Mirko Stocker and Olaf Zimmermann is supported by the Hasler Foundation through grant nr. 21004.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Mirko Stocker .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Stocker, M., Zimmermann, O. (2021). From Code Refactoring to API Refactoring: Agile Service Design and Evolution. In: Barzen, J. (eds) Service-Oriented Computing. SummerSOC 2021. Communications in Computer and Information Science, vol 1429. Springer, Cham. https://doi.org/10.1007/978-3-030-87568-8_11

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-87568-8_11

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-87567-1

  • Online ISBN: 978-3-030-87568-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics