Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Improving Legacy Applications with Spring

Improving Legacy Applications with Spring

Slides for the webinar "Improving Legacy Applications with Spring". The code is available on http://github.com/mdeinum/legacy-app.

Marten Deinum

May 12, 2015
Tweet

More Decks by Marten Deinum

Other Decks in Programming

Transcript

  1. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Improving Legacy Applications with Spring Marten Deinum, Consultant, Conspect Consulting & ICT @mdeinum
  2. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 2 Marten Deinum Spring Community Rockstar @mdeinum | [email protected] § Father § Husband § Experienced Java/JEE Consultant § Pragmatist Author Open Source Enthusiast
  3. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - History § JDK 1.0 was released in 1996 • ~ 20 years old § First JEE (or J2EE 1.2) released in 1999 • ~ 16 years old § J2EE Design and Development by Rod Johnson in 2002 • Led to the Spring Framework we know today § Spring 1.0 was released in 2004 • ~ 12 years old § A lot of application have been build in that time period • Some of those still exist • Code is still being used 3
  4. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 4
  5. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software § Has proven itself (battle tested) § Has proven business value § It exists and we have to deal with it • Ignore • Hide • Full Rebuild • Incremental Redesign 5
  6. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Architecture 6
  7. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Architecture 7 Domain Presentation Service Data Access Presentation Service Data Access Domain DTO
  8. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Architecture 8 Presentation Service Data Access Presentation Service Data Access Presentation Service Data Access
  9. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Architecture 9
  10. Demo Unless otherwise indicated, these slides are 
 © 2013-2014

    Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
  11. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - How to Improve 11
  12. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 12 Legacy Software - Structured Monolith “If you can't build a structured monolith, what makes you think microservices are the answer? Simon Brown
  13. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 13 Legacy Software - Structured Monolith
  14. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Structured Monolith § Write integration tests! 14
  15. Demo Unless otherwise indicated, these slides are 
 © 2013-2014

    Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
  16. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Structured Monolith § Write integration tests! § Single Responsibility Principle • A [class|component|service] should have one, and only one, reason to change. • Classes that change together are packaged together. • Classes that are used together are packaged together. 16
  17. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Structured Monolith § Write integration tests! § Single Responsibility Principle • A [class|component|service] should have one, and only one, reason to change. • Classes that change together are packaged together. • Classes that are used together are packaged together. § Protect your Internals § Use package protected classes § Expose only the public API 17
  18. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Structured Monolith 18 Integration Core User Event web security ws
  19. Demo Unless otherwise indicated, these slides are 
 © 2013-2014

    Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
  20. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Structured Monolith § Write integration tests! § Single Responsibility Principle § Protect your internals § Decouple using events § Use the right abstractions and framework features 20
  21. Demo Unless otherwise indicated, these slides are 
 © 2013-2014

    Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
  22. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Structured Monolith § Write integration tests! § Single Responsibility Principle § Protect your internals § Decouple using events § Spring 4.2 has some nice improvements in this area
 https://spring.io/blog/2015/02/11/better-application-events-in-spring- framework-4-2 § Use the right abstractions and framework features 22
  23. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Independent Services 23 "Physalia physalis, Tayrona national park, Colombia" by Biusch - Own work.
  24. Demo Unless otherwise indicated, these slides are 
 © 2013-2014

    Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
  25. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Independent Services § Spring Remoting • HttpInvoker, Burlap, Hessian, RMI, JMS, AMQP • Remote Procedure Call (RPC) § Spring Integration • JMS with Objects • JMS with XML Marshalling • AMQP (JSON) 25
  26. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Legacy Software - Lessons Learned § Have a plan and prioritize § Use automated tests § Take small steps § Upgrading Spring might not be as hard as you think § Upgrading a JDK might not be as hard as you think § Know your frameworks / libraries § Use the right abstractions 26
  27. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Questions?
  28. Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 28 Learn More. Stay Connected. Twitter: twitter.com/mdeinum YouTube: spring.io/video LinkedIn: nl.linkedin.com/in/mdeinum GitHub: github.com/mdeinum