本文是《HTML重構》讀書筆記的第三篇:工具篇;從戰略到戰術,真正實踐過程中沒有好的工具HTML重構也将成為開發者的噩夢。是以之前就有朋友問是否有工具可以減輕工作量,由于作者介紹的工具多是Java開發的,是以我把作者給出的工具清單作為線索給出了更多可能選擇。
如果你不知道我在做什麼,那麼請看前情提要:
<a href="http://www.cnblogs.com/me-sa/archive/2009/04/20/1439546.html">HTML重構:戰術篇</a>
<a href="http://www.cnblogs.com/me-sa/archive/2009/04/19/1439315.html">HTML重構:戰略篇</a>
嗯哼,我們開始:
版本管理工具Version Control
作者原來的标題是"Backups, Staging Servers, and Source Code Control"
難以想象沒有Source Control我們的工作将會是什麼模樣,早在1972年就已經有源碼管理軟體問世。你也許在使用SVN或者VSTS,它們都提供基礎的服務:
文檔存儲Backup and Restore
保持文檔一緻性Synchronization
檔案比較合并Diff&Merge
Sandboxing:可以按照需要搭建一個友善的沙盒,記得簽入之前清理代碼:)
從軟體開發過程的角度
跟蹤開發進度,團隊協同工作
根據需要做版本復原:The Big Undo
根據需要做分支(Branches)打标簽Tags,分支可以看做是一個巨大的沙盒
辨別變化,跟蹤變化Track Changes&Ownership
大家可以看看關于Source Control的資料:
Revision control
Source Code Control System (SCCS)
Subversion
Pragmatic Version Control: Using Subversion (The Pragmatic Starter Kit Series)(2nd Edition)
Pragmatic Version Control Using CVS
頁面驗證工具Validators
W3C線上驗證工具
提供三種驗證方式:送出URL,送出檔案,直接輸入代碼
The Log Validator
Xmllint
Visual Studio
在Visual Studio中打開一個頁面檔案,你可以看到一個Target schema for validation的下拉清單框,你可以在這裡選擇要用什麼标準來做驗證,而且Error List框中會列出所有的錯誤和警告資訊.
工具名稱
開發者
開發語言
<a href="http://www.garshol.priv.no/download/xmltools/prod/DSDProcessor.html">DSD Processor</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/java.html">Java</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/Jing.html">Jing</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/JClark.html">James Clark</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/PyTREX.html">PyTREX</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/JTauber.html">James Tauber</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/python.html">Python</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/JCTREX.html">Sample TREX implementation</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/Schematron.html">Schematron</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/RJelliffe.html">Rick Jelliffe</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/Schematron.NET.html">Schematron.NET</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/NMatrix.html">NMatrix</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/cs.html">C#</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/MSV-Schematron.html">Sun MSV Schematron Add-on</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/Sun.html">Sun Microsystems</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/MSV.html">Sun Multi-Schema Validator</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/VBRELAXNG.html">VBRELAXNG</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/KYonekura.html">YONEKURA Koji</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/visual-basic.html">Visual Basic</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/XSV.html">XML Schema Validator</a>
測試工具
測試對于重構的重要性是毋庸置疑的,我還是援引《Refactoring: Improving the Design of Existing Code》中的闡述:
"If you want to refactor, the essential precondition is having solid tests. Even if you are fortunate enough to have a tool that can automate the refactorings, you still need tests. It will be a long time before all possible refactorings can be automated in a refactoring tool."
JWebUnit
Selenium
Visual Studio測試工具集
正規表達式工具
正規表達式的作用自不必多講,已經被包裝成程式員的X種武器之一。同樣的正規表達式工具太多了,推薦:
UltraEdit
Visual Studio :記得查找的時候勾選正規表達式選項
VisualRegex:一個小而強大的正規表達式工具,支援從文本構造正規表達式
Html清理工具
作者推薦了Tidy和Tagsoup,其中Tidy我找到了它的.net版本:
Tidy & TidyForNet
TidyForNet and wvForNet provide a native .NET/Mono Wrapper for HTML Tidy and wvWare, using C# and interop. It programmers, using languages such as C# or Visual Basic .NET to interact with HTML Tidy and wvWare. Both wrappers run on Windows and Linux.
Tagsoup
<a href="http://home.ccil.org/~cowan/XML/tagsoup/">http://home.ccil.org/~cowan/XML/tagsoup/</a>
XSLT工具
XSLT使得資料和呈現分離,将理論落實到實踐,它的工具:
平台
<a href="http://www.garshol.priv.no/download/xmltools/prod/FOA.html">FOA</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/FGiannetti.html">Fabio Giannetti</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/HTML-Kit.html">HTML-Kit</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/Chami.html">Chami.com</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/win32.html">Win32</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/XPathVisualizer.html">XPath Visualizer</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/AFayolle.html">Alexandre Fayolle</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/XSLTester.html">XSL Tester</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/VBXML.html">VBXML.COM</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/XSLT-process.html">XSLT-process</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/OPredescu.html">Ovidiu Predescu</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/emacs.html">Emacs</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/xslide.html">xslide</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/Mulberry.html">Mulberry Technologies</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/4Suite.html">4Suite</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/Fourthought.html">Fourthought</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/python-2.x.html">Python 2.x</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/MDC-XSL.html">MDC-XSL</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/Minoru.html">Minoru Development Corporation</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/Pyana.html">Pyana</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/BQuinlan.html">Brian Quinlan</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/SAXON.html">SAXON</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/MKay.html">Michael H. Kay</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/Sablotron.html">Sablotron</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/Gingerall.html">Ginger Alliance</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/TclXSLT.html">TclXSLT</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/SBall.html">Steve Ball</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/tcl.html">tcl</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/UnicornXSLT.html">Unicorn XSLT Processor</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/Unicorn.html">Unicorn Enterprises</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/XML_LibXSLT.html">XML::LibXSLT</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/MSergeant.html">Matt Sergeant</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/perl.html">Perl</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/XML_XSLT.html">XML::XSLT</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/XSLTC.html">XSLTC</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/OGerardin.html">Olivier Gerardin</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/cpp.html">C++</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/xt.html">XT</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/Xalan-C.html">Xalan-C++</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/XML-Apache.html">The Apache XML Project</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/Xalan-J.html">Xalan-Java</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/jd.xslt.html">jd.xslt</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/JDobler.html">Johannes Döbler</a>
<a href="http://www.garshol.priv.no/download/xmltools/prod/libxslt.html">libxslt</a>
<a href="http://www.garshol.priv.no/download/xmltools/vendor/DVeillard.html">Daniel Veillard</a>
<a href="http://www.garshol.priv.no/download/xmltools/platform/c.html">C</a>
總結
昨天看香港金像獎頒獎典禮沒寫完,今天補上功課.
本文是《HTML重構》讀書筆記的最後一篇,前面我們已經從戰略和戰術的層面了解了HTML重構,真正的HTML重構實踐過程中我們可能在Visual Studio中就可以完成所有的工作,本文介紹的工具僅僅是一個開拓視野作用。
Html重構介紹的差不多了,但是它僅僅是網站重構過程中的其中一個環節而已,前面的路還長着呢
(全文完)
如果你喜歡倒序閱讀,ok,下面是前情提要: