High maitainablesoftware

278 views

Published on

Published in: Software, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
278
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

High maitainablesoftware

  1. 1. HIGH MAINTAINABLE SOFTWARE Nguyen Cuong viet @ Septeni Technology Ha noi - 12/2013 make it changeable
  2. 2. ABOUT ME  8 years- experiences software developer, basically base on LAMP environment  ..  Tratu.soha.vn  Go.vn  Pyxis-social.com
  3. 3. AGENDA 1. Understanding the important of “maintainability” 2. How to improve  Design patterns  Code refactor  Jenkins 3. Discussion
  4. 4. I. WHAT, WHO, WHEN, WHY
  5. 5. THE MAINTAINABILITY PROBLEM  Software systems are built under high pressure to meet deadlines, and with initial emphasis on performance, reliability, and usability.  The software attributes relating to later changes in the software => maintainability
  6. 6. SOFTWARE QUALITY FACTORS  ISO 9126
  7. 7. SOFTWARE QUALITY FACTORS  ISO 9126 ->WHO ?
  8. 8. WHEN - DEPENDENCIES  Do you need to care about Maintainability? It depend on: Project size Life time of project Quality of code Design
  9. 9. THE MAINTAINABLE CODE CHECKLIST..
  10. 10. PYXIS USECASE  20 developers  +2 years  10 lines of code/days x 20 x365 = 70.000 line of code/ year?
  11. 11. COMPLAINS..  Bug fixes: ask Mr.A because he developed it!!  Readable: New Member?  understand project business by researching source code ?  everyone is new member with other modules!  Simple development still has a lot of bugs!  Throw it away, let rebuild this function!
  12. 12. SO.. • Imagine about our source code this time next year.. READABLE? CHANGEABLE?
  13. 13. HOW TO Design pattern Refactoring source code Jenkins..
  14. 14. DESIGN PATTERNS Design patterns can speed up the development process by providing tested, proven development paradigms
  15. 15. PATTERNS
  16. 16. CODE REVIEW Bad Smells in Code ..
  17. 17. CODE SMELLS ..  Duplicated Code  Long Method  Large Class  Long Parameter list  Divergent Change  Shotgun Surgery  Feature Envy  Feature Envy  Data Clumn ..  Primitive bsession  Switch tatements  Parallel  Inheritance  Hierarchies Lazy  Class Speculative  Generality  Temporary Field  Message Chains ..
  18. 18. REFACTOR - EXAMPLE String foundPerson(String[] people){ for (int i = 0; i < people.length; i++) { if (people[i].equals ("Don")){ return "Don"; } if (people[i].equals ("John")){ return "John"; } if (people[i].equals ("Kent")){ return "Kent"; } } return ""; } String foundPerson(String[] people){ List candidates = Arrays.asList(new String[] {"Don", "John", "Kent"}); for (int i=0; i &lt; people.length; i++) if (candidates.contains(people[i])) return people[i]; return ""; } source refactored
  19. 19. REFACTOR - EXAMPLE void printOwing(double amount) { printBanner(); //print details System.out.println ("name:" + _name); System.out.println ("amount" + amount); } void printOwing(double amount) { printBanner(); printDetails(amount); } void printDetails (double amount) { System.out.println ("name:" + _name); System.out.println ("amount" + amount); } source refactored
  20. 20. JENKINS Automation tool..
  21. 21. JENKINS  CHECKSTYLE(for processing PHP_CodeSniffer logfiles in Checkstyle format)  CLOVER(for processing PHPUnit code coverage xml output)  DRY(for processing phpcpd logfiles in PMD-CPD format)  JDepend (for processing PHP_Depend logfiles in JDepend format)  PMD (for processing PHPMD logfiles in PMD format)  Violations (for processing various logfiles)  xUnit (for processing PHPUnit logfiles in JUnit format)
  22. 22. JENKINS - SAMPLE  Duplication
  23. 23. JENKINS - SAMPLE  Duplication
  24. 24. JENKINS- SAMPLE: JDEPEND  JDepend traverses Java class file directories and generates design quality metrics for each Java package. JDepend allows you to automatically measure the quality of a design in terms of its extensibility, reusability, and maintainability to manage package dependencies effectively.
  25. 25. JDEPEND REPORT
  26. 26. REFERENCE  Maintainbility in software engineering  http://codebetter.com/jeremymiller/2006/12/06/on- writing-maintainable-code/ (check list)  A practice model for mesuaring maintainability  http://sourcemaking.com/ very good resource for high quality code  http://jenkins-php.org/
  27. 27. THANK YOU! Discussion..

×