SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

广告投放代码和创意代码持续优化
广告投放代码和创意代码持续优化广告投放代码和创意代码持续优化
广告投放代码和创意代码持续优化
taobao.com
 
Kind editor设计思路
Kind editor设计思路Kind editor设计思路
Kind editor设计思路
taobao.com
 
美团前端架构简介
美团前端架构简介美团前端架构简介
美团前端架构简介
pan weizeng
 
性能优化
性能优化性能优化
性能优化
Lu Wei
 
非常靠谱 Html 5
非常靠谱 Html 5 非常靠谱 Html 5
非常靠谱 Html 5
Tony Deng
 
淘宝开放产品前端实践
淘宝开放产品前端实践淘宝开放产品前端实践
淘宝开放产品前端实践
taobao.com
 
淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践淘宝网前台应用性能优化实践
淘宝网前台应用性能优化实践
丁 宇
 
2011新版首页总结 技术篇
2011新版首页总结 技术篇2011新版首页总结 技术篇
2011新版首页总结 技术篇
传贵 谢
 
编辑器设计2
编辑器设计2编辑器设计2
编辑器设计2
yiming he
 
使用kslite支持第三方内容开发
使用kslite支持第三方内容开发使用kslite支持第三方内容开发
使用kslite支持第三方内容开发
leneli
 

Tendances (20)

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

En vedette

Fiqih icha
Fiqih ichaFiqih icha
Fiqih icha
ichaa17
 
An Opinion Without Support Is Not An Appraisal
An Opinion Without Support Is Not An AppraisalAn Opinion Without Support Is Not An Appraisal
An Opinion Without Support Is Not An Appraisal
James Regnere
 
Com 303 1
Com 303 1Com 303 1
Com 303 1
ChadH1
 
Ici final project report
Ici final project reportIci final project report
Ici final project report
Jıa Yıı
 
Occupational Health Technician Training
Occupational Health Technician TrainingOccupational Health Technician Training
Occupational Health Technician Training
Jane Coombs
 
1st group!!
1st group!! 1st group!!
1st group!!
ichaa17
 

En vedette (20)

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

Similaire à Web coding principle

构建基于Lamp的网站架构
构建基于Lamp的网站架构构建基于Lamp的网站架构
构建基于Lamp的网站架构
Cosey Lee
 
ASP.Net MVC2 简介
ASP.Net MVC2 简介ASP.Net MVC2 简介
ASP.Net MVC2 简介
Allen Lsy
 
前端性能测试
前端性能测试前端性能测试
前端性能测试
tbmallf2e
 
Nodejs & NAE
Nodejs & NAENodejs & NAE
Nodejs & NAE
q3boy
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
pepsixp
 

Similaire à Web coding principle (20)

How to ASP.NET MVC4
How to ASP.NET MVC4How to ASP.NET MVC4
How to ASP.NET MVC4
 
ColaPHP In Action
ColaPHP In ActionColaPHP In Action
ColaPHP In Action
 
從軟體開發角度
談 Docker 的應用
從軟體開發角度
談 Docker 的應用從軟體開發角度
談 Docker 的應用
從軟體開發角度
談 Docker 的應用
 
Rest与面向资源的web开发
Rest与面向资源的web开发Rest与面向资源的web开发
Rest与面向资源的web开发
 
合久必分,分久必合
合久必分,分久必合合久必分,分久必合
合久必分,分久必合
 
Real World ASP.NET MVC
Real World ASP.NET MVCReal World ASP.NET MVC
Real World ASP.NET MVC
 
Servlet & JSP 教學手冊第二版 - 第 1 章:簡介Web應用程式
Servlet & JSP 教學手冊第二版 - 第 1 章:簡介Web應用程式Servlet & JSP 教學手冊第二版 - 第 1 章:簡介Web應用程式
Servlet & JSP 教學手冊第二版 - 第 1 章:簡介Web應用程式
 
构建基于Lamp的网站架构
构建基于Lamp的网站架构构建基于Lamp的网站架构
构建基于Lamp的网站架构
 
Comment System of 56.com
Comment System of 56.comComment System of 56.com
Comment System of 56.com
 
使用Big pipe提升浏览速度 wk_velocity
使用Big pipe提升浏览速度 wk_velocity使用Big pipe提升浏览速度 wk_velocity
使用Big pipe提升浏览速度 wk_velocity
 
View 與 Blade 樣板引擎
View 與 Blade 樣板引擎View 與 Blade 樣板引擎
View 與 Blade 樣板引擎
 
ASP.Net MVC2 简介
ASP.Net MVC2 简介ASP.Net MVC2 简介
ASP.Net MVC2 简介
 
前端性能测试
前端性能测试前端性能测试
前端性能测试
 
twMVC#01 | ASP.NET MVC 的第一次親密接觸
twMVC#01 | ASP.NET MVC 的第一次親密接觸twMVC#01 | ASP.NET MVC 的第一次親密接觸
twMVC#01 | ASP.NET MVC 的第一次親密接觸
 
4. Go 工程化实践-0124-v2.pdf
4. Go 工程化实践-0124-v2.pdf4. Go 工程化实践-0124-v2.pdf
4. Go 工程化实践-0124-v2.pdf
 
Nodejs & NAE
Nodejs & NAENodejs & NAE
Nodejs & NAE
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
ASP.NET Core 6.0 全新功能探索
ASP.NET Core 6.0 全新功能探索ASP.NET Core 6.0 全新功能探索
ASP.NET Core 6.0 全新功能探索
 
大话Php之性能
大话Php之性能大话Php之性能
大话Php之性能
 
Non-MVC Web Framework
Non-MVC Web FrameworkNon-MVC Web Framework
Non-MVC Web Framework
 

Plus de ZongYing Lyu

Plus de ZongYing Lyu (16)

Vue.js
Vue.jsVue.js
Vue.js
 
Performance improvement techniques for software distributed shared memory
Performance improvement techniques for software distributed shared memoryPerformance improvement techniques for software distributed shared memory
Performance improvement techniques for software distributed shared memory
 
Architecture of the oasis mobile shared virtual memory system
Architecture of the oasis mobile shared virtual memory systemArchitecture of the oasis mobile shared virtual memory system
Architecture of the oasis mobile shared virtual memory system
 
A deep dive into energy efficient multi core processor
A deep dive into energy efficient multi core processorA deep dive into energy efficient multi core processor
A deep dive into energy efficient multi core processor
 
Libckpt transparent checkpointing under unix
Libckpt transparent checkpointing under unixLibckpt transparent checkpointing under unix
Libckpt transparent checkpointing under unix
 
Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業Device Driver - Chapter 6字元驅動程式的進階作業
Device Driver - Chapter 6字元驅動程式的進階作業
 
Device Driver - Chapter 3字元驅動程式
Device Driver - Chapter 3字元驅動程式Device Driver - Chapter 3字元驅動程式
Device Driver - Chapter 3字元驅動程式
 
提高 Code 品質心得
提高 Code 品質心得提高 Code 品質心得
提高 Code 品質心得
 
SCRUM
SCRUMSCRUM
SCRUM
 
Consistency protocols
Consistency protocolsConsistency protocols
Consistency protocols
 
Compiler optimization
Compiler optimizationCompiler optimization
Compiler optimization
 
MPI use c language
MPI use c languageMPI use c language
MPI use c language
 
Cvs
CvsCvs
Cvs
 
Parallel program design
Parallel program designParallel program design
Parallel program design
 
MPI
MPIMPI
MPI
 
OpenMP
OpenMPOpenMP
OpenMP
 

Web coding principle