1 / 53

Refactoring to a SOLID Foundation

Refactoring to a SOLID Foundation. Steve Bohlen Senior Software Engineer SpringSource /VMware E-Mail: sbohlen@gmail.com Blog: http://blog.unhandled-exceptions.com Twitter: @ sbohlen. Sleep is for Wimps!. Indulge Yourself!. Get your LEARN on!. Do I suck?. Let me (and the world) know!.

butch
Download Presentation

Refactoring to a SOLID Foundation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Refactoring to a SOLID Foundation Steve Bohlen Senior Software Engineer SpringSource/VMware E-Mail: sbohlen@gmail.com Blog: http://blog.unhandled-exceptions.com Twitter: @sbohlen

  2. Sleep is for Wimps!

  3. Indulge Yourself!

  4. Get your LEARN on!

  5. Do I suck? Let me (and the world) know! http://spkr8.com/t/8095

  6. Who am I? • …and why should you care? • Steve Bohlen • I Read Books + Write Software • vs. “Read Software + Write Books”  • Blog, Screencast, Speak, Share, Learn

  7. Steve Bohlen Nearly 20 years developing software LISP, Delphi, C/C++, VB, VB.NET, C# Senior Engineer Springsource/VMware Co-Founder, NYC Alt.Net User Group http://nyalt.net • Co-Organizer, NYC DDD User Group • http://dddnyc.org Contributor: various OSS projects NHibernate http://www.nhforge.org • NDbUnit http://www.googlecode.com/ndbunit • Spring.NET http://www.springframework.net blog: http://blog.unhandled-exceptions.com e-mail: sbohlen@gmail.com twitter: @sbohlen

  8. Test Studio Express TelerikOpenAccess ORM RAD Controls for ASP.NET AJAX RAD Controls for Windows Phone ASPX to Razor Converter RAD Controls for WPF TelerikTeamPulse Sitefinity CMS C#/VB.NET Converter TelerikJustDecompile Telerik Reporting TelerikJustMock RAD Controls for Winforms RAD Controls for Silverlight TelerikJustCode Telerik Extensions for ASP.NET MVC Telerik Test Studio

  9. Refactoring • Disciplined technique • Restructuring an existing body of code • Altering its internal structure without changing its external behavior • A series of small behavior-preserving transformations • Each 'refactoring’ does little by itself • A sequence of transformations can produce a significant restructuring • Each refactoring is small so it's less likely to go wrong • The system is kept fully working after each small refactoring

  10. Refactoring Tools • Developer Express CodeRush • http://devexpress.com/coderush • JetBrainsResharper • http://www.jetbrains.com/resharper/ • TelerikJustCode • http://www.telerik.com/products/justcode.aspx • Visual Studio Professional • Notepad!

  11. Introduction to S.O.L.I.D. S O L I D RP ingle Responsibility Principle CP pen-Close Principle SP iskov Substitution Principle SP nterface Segregation Principle IP ependency Inversion Principle

  12. Introduction to S.O.L.I.D. S O L I D ingle Responsibility Principle pen-Close Principle iskov Substitution Principle nterface Segregation Principle ependency Inversion Principle

  13. Single Responsibility Principle There should never be more than one reason for a class to change.

  14. Refactoring to a S.O.L.I.D. Foundation SRP Demo

  15. Introduction to S.O.L.I.D. S O L I D ingle Responsibility Principle pen-Close Principle iskov Substitution Principle nterface Segregation Principle ependency Inversion Principle

  16. Open-Closed Principle Software Entities (Classes, Modules, Functions, etc.)should be Open for Extension, but Closed for Modification.

  17. Refactoring to a S.O.L.I.D. Foundation OCP Demo

  18. Introduction to S.O.L.I.D. S O L I D ingle Responsibility Principle pen-Close Principle iskov Substitution Principle nterface Segregation Principle ependency Inversion Principle

  19. LiskovSubstitution Principle If for each object o1 of type S there is an object o2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when o1 is substituted for o2, then S is a subtype of T. WTF ?!?

  20. LiskovSubstitution Principle Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.

  21. Refactoring to a S.O.L.I.D. Foundation LSP Demo

  22. Introduction to S.O.L.I.D. S O L I D ingle Responsibility Principle pen-Close Principle iskov Substitution Principle nterface Segregation Principle ependency Inversion Principle

  23. Interface Segregation Principle Clients should not be forced to depend upon interfaces that they do not use.

  24. Refactoring to a S.O.L.I.D. Foundation ISP Demo

  25. Introduction to S.O.L.I.D. S O L I D ingle Responsibility Principle pen-Close Principle iskov Substitution Principle nterface Segregation Principle ependency Inversion Principle

  26. Dependency Inversion Principle High Level Modules should not depend upon Low Level Modules. Both should depend upon abstractions. Abstractions should not depend upon details. Details should depend upon abstractions.

  27. Refactoring to a S.O.L.I.D. Foundation DIP Demo

  28. Thinking About Re-Assembly Presto!

  29. Dependency Injection Frameworks • StructureMap • Spring.NET • Castle Windsor • NInject • Funq • Unity • More…

  30. Refactoring to a S.O.L.I.D. Foundation Closing Thoughts

More Related