騎著驢子在高速公路上奔馳
Growing up with drupal
第一次見面
2009/11 - 出社會的小毛頭
2009/11/19 - PHP 5.3.1
2009/12/16 - Drupal 6.15
直到最近開始研究各 Framework 才知道 Drupal 使用的是 HMVC (掩面)
Make it more complex,
but more easier.
回到 Drupal 5 !?
看似跟 Drupal 6 一樣有完整的 HMVC,但事實上各功能之間的關聯還是很強、很亂。
這位看起來非常古老的系統,卻是陪伴我最長又最多的朋友...(攤手)
這就是我們今天的主人公,驢子先生!
來自四面八方的颱風
Import...Import...Import……減肥之前要先吃飽(?
解決問題前,要先承認問題!
So……let’s get deeper…
PHP 5.6
Pass by value? Pass by reference?
更新的伺服器,更新的版本,只好乖乖的修正所有的 Bug。
Cache
資料庫要先做過 Serialize,Memcache 可以直接存入。
盡你所能的快取,但快取要主動清理。
Anything can be cached,
please manage it.
Is necessary?
Let’s go to Drupal 7
PDO (PHP Data Objects)
更彈性的組合語法,交給系統來做最佳化。
See: mysqli
Entity
改變的不只是前端,而是整體的思考架構
程式 - Extend from entity class
資料庫 - One field one table
Find out common ground,
make system more flexible.
Drush / Drupal Console
Command line 更方便直接從系統端管理
Make system automatic,
spend time to valuable things.
What’s next?
Class extends & traits
各功能詳細的分工,專注在該做的事情上
群體變大了,做的事情變小了
Search from hook function to extends parent
PHP 7 資料傳遞
資料之間的傳遞變的嚴謹
格式不能再隨意的使用
但因為沒檢查資料而造成錯誤的機率降低
function (string $var, Class $var, int $var = 0)
Class interface
固定 Class 應有的架構,避免找不到參數或功能的狀況。
Class A implements Structure
Composer
任何需要的功能都可以隨時取用,但又不用擔心相依性問題。
See: Composer, PSR-4
Keep tool closer,
but don’t hold it.
前後端分離
See: RESTful Web Services API
HTML 5 / CSS 3 / Javascript
變的更好的方法不是只有後端,前端更是使用者的直接體驗
Front-end is a more
directly experience.
About me
James Liu
Chief Developer
Cool3c Media Inc.
https://lista.tw/