CMF: a pain in the F @ PHPDay 05-14-2011

2,029 views

Published on

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

No Downloads
Views
Total views
2,029
On SlideShare
0
From Embeds
0
Number of Embeds
275
Actions
Shares
0
Downloads
7
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

CMF: a pain in the F @ PHPDay 05-14-2011

  1. 1. Long story short, a true tale about an hopeless DevTeam CMF: a pain in the F David Funaro & Alessandro Nadalin May, 14 2011domenica 15 maggio 2011
  2. 2. let us introduce The Problem™domenica 15 maggio 2011
  3. 3. There comes the boss < theres a new projectdomenica 15 maggio 2011
  4. 4. There comes the boss < seems easy, lets use Joomla!domenica 15 maggio 2011
  5. 5. Dont open that door!domenica 15 maggio 2011
  6. 6. CMS The 80/20 dilemmadomenica 15 maggio 2011
  7. 7. 80% is cool at alldomenica 15 maggio 2011
  8. 8. but as the requirements growsdomenica 15 maggio 2011
  9. 9. (you always knew that)domenica 15 maggio 2011
  10. 10. the project becomes a messdomenica 15 maggio 2011
  11. 11. There comes the boss < can I haz fotonic menthal scanner in the websitedomenica 15 maggio 2011
  12. 12. There comes the boss < cant do boss Joomla! is not meant...domenica 15 maggio 2011
  13. 13. There comes the boss < STFU NOOB DO THA OR BLA BLA BLAdomenica 15 maggio 2011
  14. 14. what ifdomenica 15 maggio 2011
  15. 15. There comes the boss < seems complex, no Joomla this time, lets use a framework!domenica 15 maggio 2011
  16. 16. There comes the boss < STFU NOOB WE SHOULD GO LIVE NEXT WEEK BLA BLAdomenica 15 maggio 2011
  17. 17. Framework The 20/80 dilemmadomenica 15 maggio 2011
  18. 18. 20% is cool at alldomenica 15 maggio 2011
  19. 19. the 80% is really funnydomenica 15 maggio 2011
  20. 20. but has a cost Time To Marketdomenica 15 maggio 2011
  21. 21. again, what ifdomenica 15 maggio 2011
  22. 22. There comes the boss < seems complex, no Joomla this time, when should it go live?domenica 15 maggio 2011
  23. 23. There comes the boss < salesguy just told the client tomorrowdomenica 15 maggio 2011
  24. 24. There comes the boss < ok, lets use a CMFdomenica 15 maggio 2011
  25. 25. unfortunately, there is no stable CMF in the PHP ecosystemdomenica 15 maggio 2011
  26. 26. so it has a cost initial developmentdomenica 15 maggio 2011
  27. 27. investment = know how (team) + quality (framework) + velocity (that customers pretend) = CMFdomenica 15 maggio 2011
  28. 28. "Our" CMFdomenica 15 maggio 2011
  29. 29. Target: End User/Site admin Should be able to manage a site editing pages with different elements. Easily, like a CMS.domenica 15 maggio 2011
  30. 30. Target: Developer should be able to plug the CMF with NO PAIN, using the kick-ass framework at the bottom of the CMF.domenica 15 maggio 2011
  31. 31. domenica 15 maggio 2011
  32. 32. 2 thingsdomenica 15 maggio 2011
  33. 33. Pages • main structure of a web site • organized as a tree • a way to express our contents • usually composed by a series of containers ( that well refer to as boxes )domenica 15 maggio 2011
  34. 34. Boxesdomenica 15 maggio 2011
  35. 35. Boxes The way to separate single elements of a page Loosely coupled HMVC structuresdomenica 15 maggio 2011
  36. 36. Entities Pagesdomenica 15 maggio 2011
  37. 37. Boxes {Bridge} Entities Pages Boxes let entities be shown inside webpagesdomenica 15 maggio 2011
  38. 38. Boxes We dispose of different types of boxes: • Common • DSLdomenica 15 maggio 2011
  39. 39. Common Box • Simple o Input field o Textarea o Video o Image o File o Richtext • Composite o Input field + image o input field + image + richetex o textarea + videodomenica 15 maggio 2011
  40. 40. what about the DSL?domenica 15 maggio 2011
  41. 41. Domain Specific Language DSL = ! (Website 1 Website 2 )domenica 15 maggio 2011
  42. 42. Example: Identify DSL Event Page Event Page Books Cars Users Review News Users News Contract Widget Widgetdomenica 15 maggio 2011
  43. 43. domenica 15 maggio 2011
  44. 44. News Page Widgetdomenica 15 maggio 2011
  45. 45. Web Elements = CMF Entities News Page Widgetdomenica 15 maggio 2011
  46. 46. Web Elements = CMF Entities Books News Cars Page Review Contract Widgetdomenica 15 maggio 2011
  47. 47. Web Elements = CMF Entities Books News Cars Page Review Contract Widget DSLdomenica 15 maggio 2011
  48. 48. back to the CMFdomenica 15 maggio 2011
  49. 49. CMF Stack • Framework: symfony, for example • CMF entities: Site, Pages, Menus, Users ... • DSL entities: cars, contracts (for Hertz) • Common Boxes : Textarea, image, video, ... • Dsl boxes: Cars image gallerydomenica 15 maggio 2011
  50. 50. Common Boxes + DSL Boxes =The main tool for the developer to build a page with the CMFdomenica 15 maggio 2011
  51. 51. Example : page & box composition Main Image most sold product product Richtextdomenica 15 maggio 2011
  52. 52. Example : page & box composition Main Image most sold product product Richtext Dsl Boxesdomenica 15 maggio 2011
  53. 53. Example : page & box composition Main Image most sold product product Common Boxes Richtext Dsl Boxesdomenica 15 maggio 2011
  54. 54. Example : page & box composition Main Image most sold product product Common Boxes Richtext Dsl Boxesdomenica 15 maggio 2011
  55. 55. Example : page & box composition Main Image most sold product product Common Boxes Richtext Dsl Boxesdomenica 15 maggio 2011
  56. 56. Example : page & box composition Main Image most sold product product Common Boxes Richtext Dsl Boxesdomenica 15 maggio 2011
  57. 57. Example : page & box composition Main Image most sold product product Common Boxes Richtext Dsl Boxesdomenica 15 maggio 2011
  58. 58. The Page-Box Binding Storage Data can change its structure fastly, according to the domain model. We need a technology supporting this fast change. Since we have N box type, to compose a page we should look for a few tables. We need a technology supporting this kind of lookups.domenica 15 maggio 2011
  59. 59. so, How will we manage the data?domenica 15 maggio 2011
  60. 60. RDBMS , of coursedomenica 15 maggio 2011
  61. 61. because different data always have the same needdomenica 15 maggio 2011
  62. 62. one size fits alldomenica 15 maggio 2011
  63. 63. We tend to think at the way we should store data not how were gonna use itdomenica 15 maggio 2011
  64. 64. and we think that the shit-it-always-happens migration will be easydomenica 15 maggio 2011
  65. 65. also if that column is useful for one and one only rowdomenica 15 maggio 2011
  66. 66. among milionsdomenica 15 maggio 2011
  67. 67. so we know were gonna face a few well-known problems...domenica 15 maggio 2011
  68. 68. Data Mapping Data Structure RDBMS id name parent_id we have to find a way to re-organize the data-structre to insert our tree inside a table. But is really different! Tree find a node in O(nlogn)domenica 15 maggio 2011
  69. 69. Data Mapping Data Structure RDBMS is better than before, but isnt the best waydomenica 15 maggio 2011
  70. 70. Data Mapping Data Structure RDBMS ? ... and NOW??????domenica 15 maggio 2011
  71. 71. The Alien spend more time to normalize your models BUT you always find something that as a different Behaviourdomenica 15 maggio 2011
  72. 72. Unpredictable Tomorrow User Story evolve continous Worse than the Aliendomenica 15 maggio 2011
  73. 73. EAV formerly known as: normalization WTF?!?!?! or: how to do 70k joins to retrieve an entity of you modeldomenica 15 maggio 2011
  74. 74. Overnormalized user_id | mail | phone | address Large schema is broken into smaller ones user_id | mail_id user_id | phone_id user_id | address_iddomenica 15 maggio 2011
  75. 75. Overnormalizeduser_id | mail_id LEFT JOINuser_id | phone_id LEFT JOIN ... ... ... ... ...user_id | address_id LEFT JOINdomenica 15 maggio 2011
  76. 76. Overnormalized Users ListLEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOINLEFT JOIN LEFT JOINdomenica 15 maggio 2011
  77. 77. OvernormalizedLEFT JOIN LEFT JOIN JOIN LEFT JOIN LEFTUsers List LEFT JOINLEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN LEFT JOIN What if you need to show only a single primary address?domenica 15 maggio 2011
  78. 78. back to the CMFdomenica 15 maggio 2011
  79. 79. Bind Page with Boxes Foreing Key -> TextareaBoxdomenica 15 maggio 2011
  80. 80. Bind Page with Boxes Foreing Key -> ? AND NOW ???domenica 15 maggio 2011
  81. 81. #1 Mantain the RIdomenica 15 maggio 2011
  82. 82. #2 Not Mantain the RIdomenica 15 maggio 2011
  83. 83. Maintain or not Maintain the RI; that is the questiondomenica 15 maggio 2011
  84. 84. we have to choosedomenica 15 maggio 2011
  85. 85. have you ever thought "there should be another way!" ?domenica 15 maggio 2011
  86. 86. Can someone help us ?domenica 15 maggio 2011
  87. 87. lets try NoSQL worlddomenica 15 maggio 2011
  88. 88. • Written in: C/C++ • Main point: Blazing fast • Protocol: Telnet-like • Disk-backed in-memory database, • but since 2.0, it can swap to disk. • Master-slave replication • Simple keys and values, • but complex operations like ZREVRANGEBYSCORE • INCR • Values can be set to expire (as in a cache) $ redis-cli set mykey "my binary safe value" => OK $ redis-cli get mykey => my binary safe valuedomenica 15 maggio 2011
  89. 89. Best used: • rapidly changing data with a foreseeable database size (should fit mostly in memory) For example: • analytics • real-time data collection • caching • MQ • loghttp://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redisdomenica 15 maggio 2011
  90. 90. very fastdomenica 15 maggio 2011
  91. 91. very fast Object != key->valuedomenica 15 maggio 2011
  92. 92. very fast Object != key->value Not reliabledomenica 15 maggio 2011
  93. 93. very fast Object != key->value Not reliable Can I haz otha nozql?domenica 15 maggio 2011
  94. 94. • Written in: C++ • Main point: Retains some friendly properties of SQL • Protocol: Custom, binary (BSON) • Master/slave replication • speaks JavaScript • Built-in sharding • Performance over features • After crash, it needs to repair tables> j = { name : david, surname : funaro };{ "name" : "david", "surname" : "funaro" }> db.things.save(t);> db.things.find();{ "_id" : ObjectId("4c2209f9f3924d31102bd84a"), "name" : "mongo" }domenica 15 maggio 2011
  95. 95. Best used: • you need dynamic queries • you prefer to define indexes, not map/reduce functions • you need good performance on a big DB For example: • all things that you would do with MySQL or PostgreSQL, but having predefined columns really holds you backhttp://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redisdomenica 15 maggio 2011
  96. 96. Document Orienteddomenica 15 maggio 2011
  97. 97. Document Oriented Schema Freedomenica 15 maggio 2011
  98. 98. Document Oriented Schema Free Navigate Objectdomenica 15 maggio 2011
  99. 99. Document Oriented Schema Free Navigate Object Can I haz otha nozql?domenica 15 maggio 2011
  100. 100. • Written in: Erlang • Main point: DB consistency, ease of use • Protocol: HTTP, some say REST • Bi-directional replication => master-master • conflict detection ( 409 Conflict ) • MVCC: write operations do not block reads • Previous versions of documents are available • Crash-only (reliable) design • Needs compacting from time to time • Views: embedded map/reduce • jQuery library included curl -d {"keys":["bar"]} -X POST http://host:port/foo/_all_docs?include_docs=truedomenica 15 maggio 2011
  101. 101. Best used: • accumulating occasionally- changing data • pre-defined queries • versioning is king For example: • CRM/CMS systems • APIhttp://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redisdomenica 15 maggio 2011
  102. 102. Reliabledomenica 15 maggio 2011
  103. 103. Reliable Document Orienteddomenica 15 maggio 2011
  104. 104. Reliable Document Oriented Schema Freedomenica 15 maggio 2011
  105. 105. Reliable Document Oriented Schema Free Navigate Objectdomenica 15 maggio 2011
  106. 106. Reliable Document Oriented Schema Free Navigate Object Can I haz otha nozql?domenica 15 maggio 2011
  107. 107. Why do we so hardly need a GraphDB like OrientDB?domenica 15 maggio 2011
  108. 108. "GraphDBs dont avoid relations but they embrace them in a way that they are not a computational problem anymore, by making them explicit instead of implicit through joins." Claudio Martella ( http://blog.acaro.org/entry/somebody-is-going-to-hate-me-nosparql )domenica 15 maggio 2011
  109. 109. Easy joins select from users where city.country.continent = Oceaniadomenica 15 maggio 2011
  110. 110. Same link semantics, different objects select links from menu >> 28:1, 17:5domenica 15 maggio 2011
  111. 111. Same link semantics, different objects select from [28:1, 17:5] 28:1 17:5 ExternalLink ProductLink url: http://www.google.com id: 4domenica 15 maggio 2011
  112. 112. 28:1 17:5 ExternalLink ProductLink url: http://www.google.com id: 4 $link->render()domenica 15 maggio 2011
  113. 113. • Written in: Java • Main point: Graph • Protocol: Binary or HTTP • ACID • Disk-persisted or in-memory, • Cluster • 150k inserts per second • Schema-less, *-full, *-mixed • Speaks JSON • Integrated GUI • Documental • SQL commandscurl -X PUT 127.0.0.1:2480/document/demo/1:2 --data "{@rid: 1:2}"domenica 15 maggio 2011
  114. 114. Reliabledomenica 15 maggio 2011
  115. 115. Reliable Graph - Documentaldomenica 15 maggio 2011
  116. 116. Reliable Graph - Documental Schema-*domenica 15 maggio 2011
  117. 117. Reliable Graph - Documental Schema-* Easy traversaldomenica 15 maggio 2011
  118. 118. Reliable Graph - Documental Schema-* Easy traversal SQL-friendlydomenica 15 maggio 2011
  119. 119. Reliable Graph - Documental Schema-* Easy traversal SQL-friendly UberFast ( binary protocol )domenica 15 maggio 2011
  120. 120. Reliable Graph - Documental Schema-* Easy traversal SQL-friendly UberFast ( binary protocol ) Universal ( HTTP protocol )domenica 15 maggio 2011
  121. 121. is so cooldomenica 15 maggio 2011
  122. 122. but has a problem...domenica 15 maggio 2011
  123. 123. ver 1.0domenica 15 maggio 2011
  124. 124. rc1domenica 15 maggio 2011
  125. 125. but has a couple problems...domenica 15 maggio 2011
  126. 126. JAVAdomenica 15 maggio 2011
  127. 127. but somebodydomenica 15 maggio 2011
  128. 128. started writing the binary-protocol binding https://github.com/AntonTerekhov/OrientDB-PHP ( beta, 28 April 2010 )domenica 15 maggio 2011
  129. 129. and othersdomenica 15 maggio 2011
  130. 130. domenica 15 maggio 2011
  131. 131. wrote the HTTP one https://github.com/odino/Orientdomenica 15 maggio 2011
  132. 132. $driver = new OrientHttpClientCurl();$orient = new OrientFoundationBinding( $driver, 127.0.0.1, 2480, admin, admin, demo);$response = $orient->query("select from fellas whereany() traverse(0,-1) ( @rid = 1:1 )");$output = json_decode($response->getBody());foreach ($output->result as $friend){ echo $friend->name; // other fun...}domenica 15 maggio 2011
  133. 133. you can start playing with a pure GraphDB nowdomenica 15 maggio 2011
  134. 134. High-level PHP Component?domenica 15 maggio 2011
  135. 135. Nodomenica 15 maggio 2011
  136. 136. but we know that ;)domenica 15 maggio 2011
  137. 137. thats why in DNSEE we will build a basic Object Graph Mapper for OrientDBdomenica 15 maggio 2011
  138. 138. ...because...domenica 15 maggio 2011
  139. 139. hey, you remember about our CMF?domenica 15 maggio 2011
  140. 140. codename:domenica 15 maggio 2011
  141. 141. codename: ConGoWdomenica 15 maggio 2011
  142. 142. codename: ConGoW contents gone wild ( dont ask why )domenica 15 maggio 2011
  143. 143. ConGoWdomenica 15 maggio 2011
  144. 144. ConGoW • soon the real kickstartdomenica 15 maggio 2011
  145. 145. ConGoW • soon the real kickstart • 10 devs at the starting pointdomenica 15 maggio 2011
  146. 146. ConGoW • soon the real kickstart • 10 devs at the starting point • OSS on GitHubdomenica 15 maggio 2011
  147. 147. ConGoW • soon the real kickstart • 10 devs at the starting point • OSS on GitHub • Stackdomenica 15 maggio 2011
  148. 148. ConGoW • soon the real kickstart • 10 devs at the starting point • OSS on GitHub • Stack o Symfony2domenica 15 maggio 2011
  149. 149. ConGoW • soon the real kickstart • 10 devs at the starting point • OSS on GitHub • Stack o Symfony2 o Orientdomenica 15 maggio 2011
  150. 150. ConGoW • soon the real kickstart • 10 devs at the starting point • OSS on GitHub • Stack o Symfony2 o Orient o Doctrine2domenica 15 maggio 2011
  151. 151. "My only friend, the end"domenica 15 maggio 2011
  152. 152. "My only friend, the end" David Funaro @ingdavidino http://davidfunaro.comdomenica 15 maggio 2011
  153. 153. "My only friend, the end" David Funaro Alessandro Nadalin @ingdavidino @_odino_ http://davidfunaro.com http://odino.orgdomenica 15 maggio 2011
  154. 154. "My only friend, the end" David Funaro Alessandro Nadalin @ingdavidino @_odino_ http://davidfunaro.com http://odino.orgdomenica 15 maggio 2011
  155. 155. "My only friend, the end" David Funaro Alessandro Nadalin @ingdavidino @_odino_ http://davidfunaro.com http://odino.org http://joind.in/talk/view/3008domenica 15 maggio 2011
  156. 156. Credits http://www.flickr.com/photos/pagedooley/5313217918/sizes/l/in/photostream/ http://www.flickr.com/photos/zoetnet/5520594473/sizes/l/in/photostream/ http://www.flickr.com/photos/mhxbhd/3962410821/sizes/o/in/photostream/ http://www.flickr.com/photos/labyrinthx/1955594336/sizes/z/in/photostream/ http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis http://www.flickr.com/photos/salim/19426192/sizes/o/in/photostream/ http://www.flickr.com/photos/mybluevan/3780363712/sizes/l/in/photostream/ http://farm4.static.flickr.com/3064/3086258014_f1925639e0.jpgdomenica 15 maggio 2011

×