Living with The Legacy Code: A very Short Guide

80 367 1
Living with The Legacy Code: A very Short Guide

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Definition of Legacy Code: Code without tests. Code youve “inherited” Code noone understands. Technical debt Aim to understand the concepts and motivations. Get it into version control. Identify the inflection point. Create integration acceptance tests. Set up your continuous integration environment

with L e g a c y C o d e L i v i n g @rowan_m @rowan_m Ibuildings Plusnet What is “Legacy Code”? Code without tests Code you've “inherited” Code no-one understands Technical debt What is “Legacy Code”? Who has never created Legacy Code? M y o w n s t o r y l i t t l e M y o w n s t o r y l i t t l e P r a g m a t i c , n o t i d e a l i s t i c Starting a project Aim to understand the concepts and motivations [...]... using the application Find and then read any / all documentation Official: Project brief Requirements Tech Spec ( ) ( ) ( ) Actual: Emails Meeting notes ( ) ( ) Progress: Gant charts Burndowns Overtime logs ( ) ( ) ( ) Quality: Bug tracker Complaints User Forums ( ) ( ) ( ) Che c kli st Talk to the original developers Talk to the users … especially the “different” ones Approaching the code Catalogue the. .. platform & environment Recreate it! Deploy the code PHP: php.ini PEAR / PECL modules Compile options Patches ( ( ( ( ) ) ) ) The Rest: OS Package manager Web server Web server modules Site config Database Cache JS libraries Firewall rules Proxies Services running ( ( ( ( ( ( ( ( ( ( ( ) ) ) ) ) ) ) ) ) ) ) Che c kli st Time to enter The Code Time to enter The Code Reading Static analysis Dynamic analysis... standard=Zend Exception.php FILE: /home/rowan/Dev/ZendFramework-1.9.4/library/Zend/Service/Exception.php -FOUND 1 ERROR(S) AND 2 WARNING(S) AFFECTING 3 LINE(S) -17 | WARNING | Line exceeds 80 characters; contains 87 characters 32 | WARNING | Line exceeds 80 characters; contains 87 characters 36 | ERROR | Opening class brace... 'Sweet Application' \ -pp -o HTML:Smarty:PHP \ -d Libraries \ -t Docs Style Code in here Docs out here! Beware of type-hiding! Type-hinting /** * @param array $opts Current options * @return array Options with flag set */ function setFlag(array $opts) { $opts['flag'] = true; return $opts; } Type-hiding /** * @param int $fullPence Full price in pence * @return float Discounted price in pence */ function applyDiscount($fullPence)... here # edit at least this OUPUT_DIRECTORY # play with the rest cd ~/dev/project doxygen ~/doxy.conf Docs out here http://www.stack.nl/~dimitri/doxygen/ c gs ta http://ctags.sourceforge.net/ Code in here #!/bin/bash Tags out here cd ~/Dev/ && ctags-exuberant -f ~/.vimtags \ -h ".php" -R \ exclude="\.git" \ links=no \ totals=yes \ tag-relative=yes \ PHP-kinds=+cf \ regex-PHP='/abstract\s+class\s+([^... regex-PHP='/interface\s+([^ ]+)/\1/c/' \ regex-PHP='/(public\s+|static\s+|abstract\s+|protected\s+|private\s+) ↵ function\s+\&?\s*([^ (]+)/\2/f/' Voodoo ml ou b http://bouml.free.fr/ ml ou b http://bouml.free.fr/ ml ou b http://bouml.free.fr/ ml ou b http://bouml.free.fr/ ml ou b http://bouml.free.fr/ ml ou b http://bouml.free.fr/ ml ou b co er ff ni es d rowan@swordbean:~/Dev/ZendFramework-1.9.4/library/Zend/Service$... 32 | WARNING | Line exceeds 80 characters; contains 87 characters 36 | ERROR | Opening class brace must be on a line by itself 36 | ERROR | Closing brace must be on a line by itself http://matrix.squiz.net/developer/tools/php_cs uous t in Con io n grat Inte http://www.phpundercontrol.org/ http://hudson-ci.org/ Decisi on tim e!

Ngày đăng: 10/07/2014, 16:03

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan