How Frameworks Can Kill Your Projects at XP Days Ukraine 2013 in Kiev

2,098 views
1,992 views

Published on

Here's the slide deck for my closing keynote at XP Days Ukraine 2013 in Kiev.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,098
On SlideShare
0
From Embeds
0
Number of Embeds
98
Actions
Shares
0
Downloads
13
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

How Frameworks Can Kill Your Projects at XP Days Ukraine 2013 in Kiev

  1. 1. How frameworks can kill your projects Sander Hoogendoorn Principal Technology Officer & Global Agile Thouhtleader Capgemini And some patterns to prevent you from getting killed www.sanderhoogendoorn.com www.speedbird9.com @aahoogendoorn
  2. 2. Sander Hoogendoorn 2 Capgemini  Principal technology officer  Global agile thought leader  Chief architect Accelerated Delivery Platform Other      Author books on UML, agile (2) Author +200 articles Speaker +100 international conferences Microsoft Partner Advisory Council .NET Editorial boards & Advisory boards Web  www.sanderhoogendoorn.com  www.speedbird9.com | www.smartusecase.com  @aahoogendoorn HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  3. 3. HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  4. 4. On being a developer... 4 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  5. 5. A small rectification … 5 Ukrainian HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  6. 6. Agenda 6 An short story about frameworks How frameworks can get you in trouble Software architecture versus frameworks The layer supertype Introducing the descriptor pattern The manager-provider HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  7. 7. Agenda 7 An short story about frameworks How frameworks can get you in trouble Software architecture versus frameworks The layer supertype Introducing the descriptor pattern The manager-provider HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  8. 8. Hofstadter’s Law It always takes longer than you expect, even when you take into account Hofstadter’s Law
  9. 9. MyFirstSurvey 9 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  10. 10. MyFirstSurvey 10 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  11. 11. Life is never easy Frameworks, like pizzas, come in only two sizes: too big and too small.
  12. 12. MyFirstSurvey 12 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  13. 13. What’s it gonna be punk? 13 General purpose frameworks Enterprise Library, Spring.Net, Castle, NakedObjects, Accelerated Delivery Framework (ADF), SubSonic Single goaled frameworks – verticals Single goaled frameworks – architectural Dependency injection: ObjectBuilder, Unity, Castle Windsor User interface: Silverlight, ASP.NET MVC, WPF, ASP.NET Ajax, Spring MVC Logging: Log4Net, Logging Block, Common.Logging Process: UI Process Application Block, WF Exception handling: Exception Handling Block Apect orientation: PostSharp, SetPoint Data: Entity Framework, Hibernate, Castle ActiveRecord, CSLA Search: Lucene.net, NLucene Service s: WCF, WCF RIA Domain: Entity Framework, Hibernate, NEO Portals: DotNetNukeSpatial, Umbraco HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  14. 14. Frameworks. CodePlex 14 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  15. 15. Frameworks. www.csharpopensource.com 15 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  16. 16. Frameworks. Microsoft Enterprise Library 16 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  17. 17. Frameworks. Project Castle 17 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  18. 18. Don’t believe the hype. It’s a SQL 18 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  19. 19. Convincing the management to apply the framework (25.5 %) 19 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  20. 20. Understanding the framework (56.4 %) 20 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  21. 21. Convincing other developers to use the framework (23.6 %) 21 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  22. 22. Convincing other developers to use the framework (23.6 %) 22 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  23. 23. Training the developers (20 %) 23 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  24. 24. The eye of the tiger 24 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  25. 25. Agenda 25 An short story about frameworks How frameworks can get you in trouble Software architecture versus frameworks The layer supertype Introducing the descriptor pattern The manager-provider HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  26. 26. Applying Frameworks My software never has bugs. It just develops random features
  27. 27. So glad you made it! 27 What if the author of our favorite framework suddenly stops developing it? What if we require additional features that aren’t covered by our framework? And what if the new version of our framework is implemented totally different? What if we decide that another framework might be better than the one we’re using now? What if the framework contains bugs? HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  28. 28. More than anything, dependencies will kill your project 28 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  29. 29. Kentucky Fried Architecture A short story about framework developers and application developers
  30. 30. Pigs & Chickens The framework developer 30 The application developer HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  31. 31. The customer is not always right 31 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  32. 32. KFC Architecture. Entity Framework 32 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  33. 33. KFC Architecture. Entity Framework 33 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  34. 34. KFC Architecture. Entity Framework 34 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  35. 35. Here’s … beta! Letting the lunatics run the asylum I don’t care if it works on your machine! We are not shipping your machine!
  36. 36. Hot or not? 37 Hot? From hot to not? Not? WindowsRT PCL HTML5 LightSwitch WCF RIA Services Silverlight 4.0? ASP.NET MVC 3 MEF jQuery NService Bus Entity Framework Code First Xamarin TypeScript Expression Blend ASP.NET Ajax REST Unity BizTalk Surface Duet SketchFlow Azure Services ADO.NET Data Services ASP.NET Dynamic Data WPF Entity Framework 2.0 LINQ2SQL LINQ2Entities Entity Data Model Dublin DSL’s Silverlight 2.0 F# ASP.NET PopFly M Oslo MGrammar HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  37. 37. Be a genius 38 Metro? WTF? I just figured out ASP.NET MVC HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  38. 38. Here’s Johnny! ASP.NET MVC 39 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  39. 39. Here’s Johnny! ASP.NET MVC 40 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  40. 40. No strings attached It’s only in theory that practice and theory are the same
  41. 41. MyFirstSurvey 42 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  42. 42. Changing base classes. NHibernate / Log4Net 43 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  43. 43. Changing base classes. NHibernate / Log4Net 44 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  44. 44. Yes, your frameworks version too Programming is like sex. One mistake and you have to support it for the rest of your life
  45. 45. It ain’t over till it’s over 46 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  46. 46. Missing base classes. Workflow Foundation 4.0 47 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  47. 47. Missing base classes. Workflow Foundation 4.0 48 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  48. 48. Enterprise Library & Retirement 49 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  49. 49. “Evolving” the Reflection API 50 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  50. 50. “Evolving” the Reflection API 51 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  51. 51. “Evolving” the Reflection API 52 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  52. 52. Agenda 54 An short story about frameworks How frameworks can get you in trouble Software architecture versus frameworks The layer supertype Introducing the descriptor pattern The manager-provider HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  53. 53. Sound architecture Architecture starts when you carefully put two bricks together. There it begins.
  54. 54. (Software.Architecture != List<Framework>)
  55. 55. A software architecture 57 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  56. 56. Creating your architecture 58 What to do?  Identify your architectural requirements  Set up a (layered) architecture  Identify layers and layer elements  List the elements responsibilities  List the elements collaborations  And only then map to frameworks  Create a thin “umbrella” of independence responsible for managing dependencies  “Wrap” frameworks to avoid too many dependencies HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  57. 57. Presentation Silverlight XAML ASPX Process Pages UserControls Panels Entities (from EF) Domain Services Use cases Workflow MVVM? MVP? Domain objects / Entities Factories / Repositories Enums / Value objects / Smart references [Mapping] Domain Metadata Service gateways Service locators [Mapping] Data / Services COBOL Outside world SAP BizTalk Java Entity Framework LINQ Nhibernate? WCF? Databases Services / ESB HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  58. 58. Agenda 61 An short story about frameworks How frameworks can get you in trouble Software architecture versus frameworks The layer supertype Introducing the descriptor pattern The manager-provider HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  59. 59. Layer supertype From a developers point of view the user is a peripheral that types when you issue a read request.
  60. 60. Layer Supertype 63 What’s a layer supertype Ollie?  Acts as a supertype for all types in its layer  All types inherit from the layer supertype Well Stan, it’s characteristics are  Name expresses common behaviour  Forces common features on all inherited types  Ideal starting point for services  Initially the layer supertype is empty  Reserve layer supertype for future additions  Extension methods don’t (always) help, you know HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  61. 61. Layer Supertype. ASP.NET MVC 64 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  62. 62. Layer Supertype. ASP.NET MVC 65 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  63. 63. Pages UserControls Panels Presentation Process Use cases Workflow Domain Domain objects / Entities Factories / Repositories Enums / Value objects / Smart references [Mapping] Service gateways Service locators [Mapping] Data / Services Exact Outside world SAP BizTalk Java Databases Services / ESB HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  64. 64. Layer Supertype. Using a layer supertype 67 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  65. 65. Layer Supertype. Reasoning about layer supertypes 68 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  66. 66. Layer Supertype. Extension methods on layer supertypes 69 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  67. 67. Agenda 70 An short story about frameworks How frameworks can get you in trouble Software architecture versus frameworks The layer supertype Introducing the descriptor pattern The manager-provider HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  68. 68. Descriptor Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
  69. 69. I know nothing. I’m from Barcelona 72 What is the matter Mister Fawlty? The problem Manuel, is that  I want to use constants in my application  But I want to define them in my framework and extend them in my application  Enumeration won’t do – there’s no inheritance HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  70. 70. Descriptor. The problem 73 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  71. 71. Descriptor. The problem 74 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  72. 72. Enum? 75 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  73. 73. String Collection? 76 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  74. 74. String Collection 77 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  75. 75. I know nothing. I’m from Barcelona 78 Descriptor Defines a restricted but application specific extendible list of definitions Useful when  Enums can not be inherited  Framework defines enumeration types that need to be extended in application code  Define layer supertype using reflection  Pre-define frequently used instances HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  76. 76. Descriptor Pattern 79 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  77. 77. Descriptor Pattern. Definition 80 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  78. 78. Descriptor Pattern. Extending the definition 81 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  79. 79. Descriptor Pattern. Use in framework 82 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  80. 80. Descriptor Pattern. Use in application 83 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  81. 81. MyFirstSurvey 84 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  82. 82. Descriptor Pattern. Use in ASP.NET MVC 85 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  83. 83. Descriptor Pattern. Use in ASP.NET MVC 86 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  84. 84. Agenda 87 An short story about frameworks How frameworks can get you in trouble Software architecture versus frameworks The layer supertype Introducing the descriptor pattern The manager-provider HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  85. 85. Dependency injection XML is like violence. If it doesn’t solve your problems, you are not using enough of it.
  86. 86. Dependency Injection. A contagious disease? 89 What do you think it is? Create true separation between definition and implementation, so that the two can vary independently and can be replaced easily Looks like a typical case of dependency injection to me So …  Call functionality without having to know  Single or multiple implemenations need the actual implementation  Implement replaceable services  Apply implementations in different contexts  Plug-in services at run-time  Single topic services to be handled, which differs dependant on context, like with Windows API, logging or error handling  Unit testing HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  87. 87. Different variations? 90 Did you know that there are different types of this dependency injection? Yeah, sure. There’s  Constructor injection  Property (setter) injection  And even manual injection Arggh… Who cares doc? HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  88. 88. Dependency injection. Manual injection 92 c HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  89. 89. Dependency injection. what to plug in 93 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  90. 90. Manager – Provider "Teamwork is a lot of people doing what I say“ Marketing executive, Citrix Corporation
  91. 91. Manager-Provider Pattern 95 Definition  Create a simple static facade (manager) for a (set of) interfaced implementations (providers) In practice  Manager holds one or a collection of providers  Provider implement a particular interface  Manager has methods to call methods from interface  At run-time, using dependency injection, actual providers are injected HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  92. 92. Manager. ValidationManager 96 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  93. 93. Interface 97 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  94. 94. Manager. Initialization (using dependency injection) 98 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  95. 95. Configuration of implementation 99 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  96. 96. Configuration of implementation 100 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  97. 97. Manager. Executing methods 101 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  98. 98. Client. Calling methods 102 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  99. 99. Client. Extending 103 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  100. 100. Manager-Provider pattern 104 Useful when  Generic services need to be called, which may have different implementations  Manager prevents having to loop through each of a list of providers  Flexibility to add or remove providers without changing application code  Providers differ e.g. in development code, test code or deployed code  Writing platform independent code HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  101. 101. Manager-Provider pattern 105 Use for  Task Management  View Management  Binding and Persisting  Resource Management  State Management  Logging  Datasource interaction  Encryption  Authorization  Testing! HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  102. 102. Creating your architecture Software architecture is like deodorant. Those who need it the most don’t use it.
  103. 103. Creating your architecture 107 What to do?  Identify your architectural requirements  Set up a (layered) architecture  Identify layers and layer elements  List the elements responsibilities  List the elements collaborations  And only then map to frameworks  Create a thin “umbrella” of independence responsible for managing dependencies  “Wrap” frameworks to avoid too many dependencies HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  104. 104. Too many layers 108 HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  105. 105. HOW FRAMEWORKS CAN KILL YOUR PROJECTS ©2012 Sander Hoogendoorn All Rights Reserved
  106. 106. References and questions www.sanderhoogendoorn.com www.smartusecase.com www.speedbird9.com sander.hoogendoorn@capgemini.com sander@ditisagile.nl @aahoogendoorn

×