SlideShare a Scribd company logo
WEB
CODING
PRINCIPLE
PRINCIPLE
Readable
Maintainable
Debuggable (include Testable)
unit test !?
BROWSER
Full HTML5 Solution
Chrome
Firefox
Safari
IE edge
IE6.0~11.0 !?
ENVIRONMENT
PHP 5.3.x
Apache 2.2.x
Mysql 5.0.x
XAMPP 1.7.7
FRAMEWORK
CodeIgniter
MVC
• Controller: HTTP request, 參數檢查, Model & View邏輯
• Model: 資料新增, 刪除,修改
• View: 顯示頁面
• css class instead of style
DATABSE
欄位和資料表要寫註解
PDO
notORM !?
Other ORM
• http://datamapper.wanwizard.eu
• http://www.doctrine-project.org
URL
API
Return JSON
REST
NAMING
命名需要有意義
PSR
http://www.php-fig.org/psr/psr-2
CI
• http://www.codeigniter.org.tw/user_guide/general/styleguide.
html
4 space instead of tab
CSS
RWD
• font-size: em
• width, height: grid system
themes
• default
• css
• main.css
• img
https://github.com/doggy8088/CSS-
Guidelines/blob/master/README.md
JAVASCRIPT
js
• jquery…etc
• 一般寫在 view html 最後
• 較大寫成獨立 js
http://jstherightway.org/
CONFIGURE
global.php
• 自定的 config
DOCUMENT
docs
• api
• API_NAME.md
• INDEX.md
• INSTALL.md
• README.md
• UPDATE_NOTICE.md
PATCH
patch
• php command
COMMAND
bin
• crontab used
• php command tools
COST OF FIXING
SOFTWARE BUGS
TESTING SOP
White-Box Testing
• Data flow
• Control flow
Black-Box Testing
• Staging test
• 合併到 develop 會自動更新到 staging
Unit Testing
TDD
GIT FLOW
http://nvie.com/posts/a-successful-git-branching-model/
COMMIT SOP
1. 在本地端測試自己新的功能是”正確”完成的
2. Git Pull 取得最新的狀態
3. Commit Code 請一隻一隻程式確定
• 禁用 commit –a
4. 一隻一隻程式去確定這次改變的 Diff
5. 寫 log
6. Merger new branch to Develop
7. 到 Staging 去驗證本次寫的功能
MULTI LANGUAGE
語言
• 繁體
• 简体
• English
applicationlanguage$languagemessage_lang.php
• applicationconfigconfig.php
STRING TABLE
• 請一開始就使用 String table 寫法
• 英文、阿拉伯數字和中文中間空一格(半形)
• 標點符號請用全形
• PDF、MP3 統一使用大寫
• 多國語言請僅量不要使用 string 組合
• 有變數的提示訊息使用格式化的 string 處理
• sprintf : http://www.php.net/manual/en/function.sprintf.php

More Related Content

PPT
编辑器设计U editor
PDF
编辑器设计Kissy editor
PPT
02.web sphere培训 应用websphere
PDF
Ksdg 使用 ruby on rails 快速打造你的 web app
PDF
Berserk js
PDF
Rails talk-5
PDF
百度前端性能监控与优化实践
PPTX
广告投放代码和创意代码持续优化
编辑器设计U editor
编辑器设计Kissy editor
02.web sphere培训 应用websphere
Ksdg 使用 ruby on rails 快速打造你的 web app
Berserk js
Rails talk-5
百度前端性能监控与优化实践
广告投放代码和创意代码持续优化

What's hot (19)

PPTX
Maven & mongo & sring
PDF
Kind editor设计思路
PDF
谈谈缓存
PDF
美团前端架构简介
PPT
性能优化
PPTX
非常靠谱 Html 5
PPTX
Blazor 與 Radzen 同行
PPTX
淘宝开放产品前端实践
PPT
构建基于Lamp的中型网站架构
PPTX
谈谈模块化
PPTX
HBase
PDF
服务器基准测试-叶金荣@CYOU-20121130
PDF
前端调试工具,编码相关,性能相关
PDF
2011新版首页总结 技术篇
PDF
编辑器设计2
PPT
Php study.20130110
PPT
前端跨域总结
PPTX
使用kslite支持第三方内容开发
PDF
Truck js 高性能移动web开发解决方案
Maven & mongo & sring
Kind editor设计思路
谈谈缓存
美团前端架构简介
性能优化
非常靠谱 Html 5
Blazor 與 Radzen 同行
淘宝开放产品前端实践
构建基于Lamp的中型网站架构
谈谈模块化
HBase
服务器基准测试-叶金荣@CYOU-20121130
前端调试工具,编码相关,性能相关
2011新版首页总结 技术篇
编辑器设计2
Php study.20130110
前端跨域总结
使用kslite支持第三方内容开发
Truck js 高性能移动web开发解决方案
Ad

Viewers also liked (20)

PPTX
Creative & Digital Business Briefing - November 2016
PPTX
Creative, Digital & Design Business Briefing — October 2015
PPTX
Lights in world
PPTX
Fiqih icha
PPTX
behavior tips! for school kids !
PDF
An Opinion Without Support Is Not An Appraisal
PPTX
Com 303 1
DOCX
Ici final project report
PPTX
Developing for Windows 8 based devices
PPT
Engranajes fotos
PPTX
Obesity
PPS
Photos from gaza(1)
PDF
經濟部訴願委員會第A410501007號決定書
DOCX
Psy final (1)
PPTX
Tik1
PPTX
Digital business briefing January 2015
PPT
Cot safety
PPTX
Occupational Health Technician Training
PPTX
1st group!!
PPTX
Digital business briefing September 2014
Creative & Digital Business Briefing - November 2016
Creative, Digital & Design Business Briefing — October 2015
Lights in world
Fiqih icha
behavior tips! for school kids !
An Opinion Without Support Is Not An Appraisal
Com 303 1
Ici final project report
Developing for Windows 8 based devices
Engranajes fotos
Obesity
Photos from gaza(1)
經濟部訴願委員會第A410501007號決定書
Psy final (1)
Tik1
Digital business briefing January 2015
Cot safety
Occupational Health Technician Training
1st group!!
Digital business briefing September 2014
Ad

Similar to Web coding principle (20)

PDF
CodeIgniter 2.0.X
PDF
Introduction to MVC of CodeIgniter 2.1.x
PDF
Phpconf 2011 introduction_to_codeigniter
PDF
Maintainable PHP Source Code
PDF
Introduction to CodeIgniter
ODP
Mobile web開發架構與入門
PDF
OpenWebSchool - 11 - CodeIgniter
PDF
Phalcon phpconftw2012
PDF
Phalcon the fastest php framework 阿土伯
PDF
运维系统开发与Rails 3页面开发实践
PPT
PHP Coding Standard and 50+ Programming Skills
PDF
PHP 語法基礎與物件導向
PDF
Laradebut #5 - 關於 CRUD 外的一點小事
PPTX
Codeigniter 3.0 之 30 分鐘就上手
PDF
常見設計模式介紹
PDF
Php设计模式介绍
PDF
advanced introduction to codeigniter
PPT
PHP & MySQL 教學
PDF
PHP教材
PPTX
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
CodeIgniter 2.0.X
Introduction to MVC of CodeIgniter 2.1.x
Phpconf 2011 introduction_to_codeigniter
Maintainable PHP Source Code
Introduction to CodeIgniter
Mobile web開發架構與入門
OpenWebSchool - 11 - CodeIgniter
Phalcon phpconftw2012
Phalcon the fastest php framework 阿土伯
运维系统开发与Rails 3页面开发实践
PHP Coding Standard and 50+ Programming Skills
PHP 語法基礎與物件導向
Laradebut #5 - 關於 CRUD 外的一點小事
Codeigniter 3.0 之 30 分鐘就上手
常見設計模式介紹
Php设计模式介绍
advanced introduction to codeigniter
PHP & MySQL 教學
PHP教材
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3

More from ZongYing Lyu (16)

PPTX
Vue.js
PPT
Performance improvement techniques for software distributed shared memory
PPT
Architecture of the oasis mobile shared virtual memory system
PPT
A deep dive into energy efficient multi core processor
PPT
Libckpt transparent checkpointing under unix
PPT
Device Driver - Chapter 6字元驅動程式的進階作業
PPT
Device Driver - Chapter 3字元驅動程式
PDF
提高 Code 品質心得
PPT
PPT
Consistency protocols
PPT
Compiler optimization
PPT
MPI use c language
PPT
PDF
Parallel program design
PDF
PPT
OpenMP
Vue.js
Performance improvement techniques for software distributed shared memory
Architecture of the oasis mobile shared virtual memory system
A deep dive into energy efficient multi core processor
Libckpt transparent checkpointing under unix
Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 3字元驅動程式
提高 Code 品質心得
Consistency protocols
Compiler optimization
MPI use c language
Parallel program design
OpenMP

Web coding principle