1 of 25

騎著驢子在高速公路上奔馳

Growing up with drupal

2 of 25

第一次見面

2009/11 - 出社會的小毛頭

2009/11/19 - PHP 5.3.1

2009/12/16 - Drupal 6.15

直到最近開始研究各 Framework 才知道 Drupal 使用的是 HMVC (掩面)

3 of 25

Make it more complex,

but more easier.

4 of 25

回到 Drupal 5 !?

看似跟 Drupal 6 一樣有完整的 HMVC,但事實上各功能之間的關聯還是很強、很亂。

這位看起來非常古老的系統,卻是陪伴我最長又最多的朋友...(攤手)

這就是我們今天的主人公,驢子先生!

5 of 25

來自四面八方的颱風

Import...Import...Import……減肥之前要先吃飽(?

解決問題前,要先承認問題!

So……let’s get deeper…

6 of 25

PHP 5.6

Pass by value? Pass by reference?

更新的伺服器,更新的版本,只好乖乖的修正所有的 Bug。

7 of 25

Cache

資料庫要先做過 Serialize,Memcache 可以直接存入。

盡你所能的快取,但快取要主動清理。

8 of 25

Anything can be cached,

please manage it.

9 of 25

Is necessary?

  • 了解系統的極限
    • 資料庫結構
    • 系統概念
  • 功能是否真的必要
    • 試試第三方工具
  • 可能做到最小化嗎
    • 停用一些子功能
    • 另外重寫小模組

10 of 25

Let’s go to Drupal 7

11 of 25

PDO (PHP Data Objects)

更彈性的組合語法,交給系統來做最佳化。

See: mysqli

12 of 25

Entity

改變的不只是前端,而是整體的思考架構

程式 - Extend from entity class

資料庫 - One field one table

13 of 25

Find out common ground,

make system more flexible.

14 of 25

Drush / Drupal Console

Command line 更方便直接從系統端管理

15 of 25

Make system automatic,

spend time to valuable things.

16 of 25

What’s next?

17 of 25

Class extends & traits

各功能詳細的分工,專注在該做的事情上

群體變大了,做的事情變小了

Search from hook function to extends parent

18 of 25

PHP 7 資料傳遞

資料之間的傳遞變的嚴謹

格式不能再隨意的使用

但因為沒檢查資料而造成錯誤的機率降低

function (string $var, Class $var, int $var = 0)

19 of 25

Class interface

固定 Class 應有的架構,避免找不到參數或功能的狀況。

Class A implements Structure

20 of 25

Composer

任何需要的功能都可以隨時取用,但又不用擔心相依性問題。

See: Composer, PSR-4

21 of 25

Keep tool closer,

but don’t hold it.

22 of 25

前後端分離

  • 不只是Twig讓前端工程師不用再學習PHP
  • Drupal 完全成為後端 API

See: RESTful Web Services API

23 of 25

HTML 5 / CSS 3 / Javascript

變的更好的方法不是只有後端,前端更是使用者的直接體驗

  • RWD
  • File position / minify / async
  • Schema structure

24 of 25

Front-end is a more

directly experience.

25 of 25

About me

James Liu

Chief Developer

Cool3c Media Inc.

https://lista.tw/