Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
How to be a better PHP Developer
Search
大澤木小鐵
January 12, 2013
Programming
40k
62
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to be a better PHP Developer
WebConf Taiwan 2013 議程簡報
大澤木小鐵
January 12, 2013
More Decks by 大澤木小鐵
See All by 大澤木小鐵
Effective Unit Testing
jaceju
3
670
JSConf Asia 2014 Sessions
jaceju
4
460
What happens in Laravel 4 bootstraping
jaceju
9
610
Deal with Laravel assets by Bower & Gulp
jaceju
30
2.1k
Leaning MVC By Example
jaceju
0
450
ng-conf_2014
jaceju
2
1.1k
The Power of JavaScript in JSConf.Asia 2013
jaceju
5
470
jQuery vs AngularJS, dochi?
jaceju
20
3.1k
Begining Composer
jaceju
24
5.5k
Other Decks in Programming
See All in Programming
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
190
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
200
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
220
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
350
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
4
3.5k
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
4.9k
setup-vp GitLab対応の裏側
naokihaba
0
120
Java 27新機能 / Java 27 new features
kishida
2
160
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
290
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
560
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
4
750
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
190
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
14
39k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
770
The Cult of Friendly URLs
andyhume
79
7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Agile that works and the tools we love
rasmusluckow
331
22k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
340
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
520
Design in an AI World
tapps
1
330
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Automating Front-end Workflow
addyosmani
1369
210k
Transcript
jaceju@webconf 2013 如何成為更好的 PHP 開發者 磚業也要專業
Jace Ju 大澤木小鐵 http://plurk.com/jaceju http://twitter.com/jaceju http://weibo.com/jaceju http://www.jaceju.net
[email protected]
新浪微博軟體工程師 PHP
開發者
匠
牆
塌
老闆的想法
微薪 技佳
PHP 的困境 不需要高門檻 大量舊資訊充斥 社群過於多元化
捫心自問 我們真的瞭解 PHP 嗎 要不要繼續學 PHP
第一式 瞭解 PHP
門
瞭解新版本 4.x → 5.x http://php.net/manual/en/migration5.php 5.2 → 5.3 http://php.net/manual/en/migration53.php
瞭解運作環境 Error Reporting Session Save Path Web Server OS
瞭解執行模式 Web 執行模式 命令列執行模式
瞭解語法 // 交換變數內容 list($a, $b) = array($b, $a); // 直接取得指定位置的值
list( , $el) = getElements(); // PHP 5.4 :⽤用⽅方括號來直接取⽤用元素 $el = getElements()[1];
瞭解原生函式 // Bad $diff_ids = array(); foreach ($ids as $id)
{ if (!in_array($id, $actual_ids)) { $diff_ids[] = $id; } } // Good $diff_ids = array_diff($ids, $actual_ids);
瞭解技術原理������� HTTP 協定 資料庫存取 檔案存取 ...
學會 SPL 及內建介面 Standard PHP Library http://www.php.net/manual/en/book.spl.php Predefined Interfaces http://www.php.net/manual/en/reserved.interfaces.php
第二式 開發工具
編輯器 語法高亮度 自動完成 API 查詢 函式或類別方法的查找 其他工具的整合
NetBeans for PHP http://netbeans.org/
Eclipse PDT http://www.eclipse.org/projects/project.php?id=tools.pdt
除錯工具 中斷點設置 完整執行堆棧資訊 變數內容追蹤 .........
Xdebug http://xdebug.org/
FirePHP http://www.firephp.org/
版本控制 歷史紀錄 還原版本 解決衝突 支線版本
GitHub http://github.com/
Git 教育訓練課程投影片 http://ihower.tw/blog/archives/6696/
程式碼等級 一,,,要能對得起自己的良心 二,,,不能考驗測試人員的耐心 三,,,要能得到上頭的歡心 四,,,要能獲得客戶的信心 五,,,要能受到其他開發者的關心
第三式 成為團隊一份子
群
良好的程式架構 使用 Framework 減少溝通成本 減少開發成本
遵守編碼標準 統一團隊編碼風格 PHP-FIG https://github.com/php-fig/fig-standards
套件管理������� 避免套件散落各地 統一套件載入方式 Composer http://getcomposer.org/ https://packagist.org/
第四式 學會把程式寫活
Any fool can write code that a computer can understand.
Good programmers write code that humans can understand. Martin Fowler
以抽象角度看事物 // 找出特定作者的所有⽂文章 $sql = 'SELECT * FROM articles WHERE
'; $sql .= 'author = :author'; $sth = $dbh->prepare($sql); $sth->execute(array( ':author' => 'jaceju' )); $articles = $sth->fetchAll();
以抽象角度看事物 // 找出特定作者的所有⽂文章 $blog = new Blog(); $articles = $blog->fetchArticlesByAuthor('jaceju');
讓程式容易佈署 <?php include '/home/web/my/config.php';
讓程式容易佈署 <?php include __DIR__ . '/config.php'; // 假設 __DIR__ 在執⾏行時期的值為
// "/home/web/my"
一開始做對系統純屬神話 要將系統寫活來應付變化
組 合
讓系統可以被擴充 統一抽象介面 定義插入點 Template Method / Observer 模組化設計 管理�������介面
協
第五式 自我要求
注意安全 SQL Injection Cross Site Script (XSS) Cross Site Request
Forgery (CSRF)
Filter Input, Escape Output 不要信任瀏覽器所回傳的資訊 也不要直接輸出敏感的資訊
開發時嚴格 上線時寬鬆 解決掉所有警告與錯誤 隱藏但紀錄線上環境的 錯誤訊息
天下網站 無堅不摧 唯快不破
第六式 效能
原則 不做重複的事 放到背景執行 空間換取時間 執行路徑越短越好 保持輕量化 必要時才初始化 有異動才更新 資料少時全抓 資料多時分段抓
事先計算 善用快取
不做重複的事 function fib($n) { if ($n < 2) return $n;
$f[$n] = fib($n - 2) + fib($n - 1); return $f[$n]; } echo fib(30), "\n"; // 結果: 832040 ,共執⾏行 5.59556889534 秒
不做重複的事 function fib($n) { static $f = array(); if (isset($f[$n]))
return $f[$n]; if ($n < 2) return $n; $f[$n] = fib($n - 2) + fib($n - 1); return $f[$n]; } echo fib(30), "\n"; // 結果: 832040 ,共執⾏行 0.002144813537 秒
奧巴馬籌款網站的製作過程 http://www.ruanyifeng.com/blog/2012/12/ obama_fundraising_website.html
第七式 強健的程式碼
測試 確保系統舊有功能的完整 建立問題發生的情境
自動化測試框架 PHPUnit http://www.phpunit.de/ PHPSpec http://www.phpspec.net/ Behat http://behat.org/
重構 不是打掉重練 防止程式碼腐敗 搭配測試實行 Refactoring - Martin Fowler
第八式 不要只學寫程式碼
系統管理������� 系統安裝 Shell Script Service 管理������� 排程設定
學習使用雲端服務 AWS Linode Heroku ...
學習使用雲端服務 Hosting Plan http://blog.gslin.org/archives/2012/04/19/2865/ hosting-plan/ Startup : 如何挑選適合的 Hosting Plan?
http://blog.xdite.net/posts/2012/04/18/startup- hosting-plan/
學習其它語言 JavaScript (Browser) Perl / Python / Ruby / Node.js
C English
眼 神 死
關注國外資訊 PHP Master http://phpmaster.com/ nettuts+ http://net.tutsplus.com/category/tutorials/php/ PHP Mailing Lists http://php.net/mailing-lists.php
第九式 學會用輪子 也要學會造輪子
https://github.com/c9s c9s
PHPConf Taiwan 2013 http://phpconf.tw/
不要只問 自己勤練 真正的功夫
謝謝大家 版權所有.翻印必舊 - 定價 50 元 -