Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Part5 - enforcing coding standard and best practices with jas forge v1.0

2,221 views

Published on

Part 5: Enforcing coding standards and best practices process in JEE Development using JasForge project

Published in: Technology
  • Be the first to comment

Part5 - enforcing coding standard and best practices with jas forge v1.0

  1. 1. Part 5: Enforcing coding standards and best practices process March 2011 Santa Clara Karim DJAAFAR CO of Jasmine Conseil
  2. 2. OBJECTIVES <ul><li>In this fifth part of our trip concerning the management of an agile process in our daily development, we focuses our attention on the quality part of the development </li></ul>Automated testing Automated code quality Build Tool
  3. 4. What is CI (Continuous Integration) ? <ul><li>“ Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (includingtest) to detect integration errors as quickly as possible.” </li></ul><ul><li>Martin Fowler. </li></ul>
  4. 5. Why do we need CI ? <ul><li>Increased productivity </li></ul><ul><ul><li>Enables shorter feedback cycle when changes are made </li></ul></ul><ul><ul><li>Code is kept in a “releasable” state </li></ul></ul><ul><ul><li>Code gets back into the hands of testers quickly </li></ul></ul><ul><ul><li>Frees the team to do more interesting and valuable work </li></ul></ul><ul><ul><li>Improves morale, making it easier to retain good developers </li></ul></ul><ul><ul><li>Enables more frequent releases with new features </li></ul></ul>
  5. 6. Why do we need CI ? <ul><li>Reduced Risk </li></ul><ul><ul><li>Reduces uncertainty greatly because at all times the team knows what works, what does not, and what the major issues are. </li></ul></ul><ul><li>Improved quality </li></ul><ul><ul><li>Makes it easier to find and remove defects because frequent integration and testing identifies bugs as they are introduced. </li></ul></ul><ul><ul><li>Multi-platform builds help in finding problems that may arise on some, but not all, versions of the supported platform. </li></ul></ul>
  6. 7. <ul><li>A CI scenario starts with the developer committing source code to the repository. </li></ul><ul><li>On a typical project, people in many project roles may commit changes that trigger a CI cycle: </li></ul><ul><ul><li>Developers change source code, </li></ul></ul><ul><ul><li>database administrators (DBAs) change table definitions, </li></ul></ul><ul><ul><li>build and deployment teams change configuration files, </li></ul></ul><ul><ul><li>interface teams change DTD/XSD specifications, </li></ul></ul><ul><ul><li>and so on… </li></ul></ul>Continuous Integration (CI) scenario
  7. 8. The components of a CI system Commit changes Compile Source Code, Integrate Database, Run Tests, Run Inspections, Deploy Software Feedback Mechanism Generate feedback SCM Server (Svn, Git, …) CI Server
  8. 9. Build Tools Automation in a agile scenario CI Build Server Automated testing Automated code quality Build Tool
  9. 10. JASFORGE © PROJECT QUALITY METRIC TOOLS
  10. 11. What is JasForge ? <ul><li>Jasforge is an Open Source project to build a scalable Team collaboration platform for Integrating work across the phases of the development lifecycle </li></ul><ul><li>Available: </li></ul><ul><ul><li>Community Edition (Eclipse Public License) </li></ul></ul><ul><ul><li>Enterprise Edition </li></ul></ul>
  11. 12. JasForge Tools Quality Metric Tools
  12. 13. QUALITY METRIC TOOLS
  13. 14. What is ‘Code quality platform’? <ul><li>A quality platform much manage and covers 7 main axes of code quality: </li></ul><ul><ul><li>Architecture & Design </li></ul></ul><ul><ul><li>Comments </li></ul></ul><ul><ul><li>Coding rules, </li></ul></ul><ul><ul><li>Potential bugs, </li></ul></ul><ul><ul><li>Complexity, </li></ul></ul><ul><ul><li>Unit tests, </li></ul></ul><ul><ul><li>Duplications. </li></ul></ul>
  14. 15. Why using Quality Metric Tools? <ul><li>Provide quantitative assessment of the source code quality </li></ul><ul><li>Good indicators of: </li></ul><ul><ul><li>performance, </li></ul></ul><ul><ul><li>maintainability, </li></ul></ul><ul><ul><li>extensibility, </li></ul></ul><ul><ul><li>reusability </li></ul></ul><ul><ul><li>Testability </li></ul></ul><ul><li> of the application </li></ul>
  15. 16. Software quality metrics <ul><ul><li>Captured during the design or build phase </li></ul></ul>When use QM ?
  16. 17. What is Sonar? “ Sonar is the central place to manage code quality, offering visual reporting on and across projects and enabling to replay the past to follow metrics evolution” source: http://www.sonarsource.org/ <ul><li>http://sonar.codehaus.org/ </li></ul>
  17. 18. Sonar: the better quality managment platform <ul><li>Sonar has been a very popular quality management platform. </li></ul><ul><li>The platform is billed as to continuously analyze and measure the code quality </li></ul><ul><li>Sonar is an aggregate tool for complex source code management and quality measures </li></ul><ul><li>It uses : Clover2, Cobertura, PMD, Checkstyle, and Findbugs under the hood. </li></ul><ul><li>Sonar is a agregate of quality tools which JasForge project natively support to enhance quality process </li></ul>
  18. 19. Sonar features <ul><li>Many l anguages are covered (Java, C, .Net, Flex, PHP, PL/SQL, Cobol, JSP, JSF, Visual Basic 6 </li></ul><ul><li>Extend ed with plugins </li></ul><ul><li>All quality in one central place; </li></ul><ul><li>Web-based application and everything is in 3 clicks; </li></ul>
  19. 20. Build results Code complexity Sonar Features
  20. 21. Code violations Time machine Sonar Features
  21. 22. Sonar : Maven configuration <profile> <id> run-profile </id> <properties> <sonar.jdbc.url> jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8 </sonar.jdbc.url> <sonar.jdbc.driver> com.mysql.jdbc.Driver </sonar.jdbc.driver> <sonar.jdbc.username> sonar </sonar.jdbc.username> <sonar.jdbc.password> s0n4rU53r </sonar.jdbc.password> </properties> </profile>
  22. 23. Sonar How it works ?
  23. 24. SONAR METRICS
  24. 25. Findbugs <ul><li>Findbugs performs static analysis for the Java byte-code to identify software bugs. </li></ul><ul><li>By providing early feedback about certain (potential) errors in the coding it helps the developer to quickly identify problems in his coding. </li></ul><ul><li>http://findbugs.sourceforge.net/ </li></ul>
  25. 26. Checkstyle <ul><li>Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. </li></ul><ul><li>It automates the process of checking Java code to spare humans of this boring (but important) task. </li></ul><ul><li>This makes it ideal for projects that want to enforce a coding standard. </li></ul><ul><li>http://checkstyle.sourceforge.net/ </li></ul>
  26. 27. PMD <ul><li>PMD scans Java source code and looks for potential problems like: </li></ul><ul><li>Possible bugs - empty try/catch/finally/switch statements </li></ul><ul><li>Dead code - unused local variables, parameters and private methods </li></ul><ul><li>Suboptimal code - wasteful String/StringBuffer usage. </li></ul><ul><li>http://pmd.sourceforge.net/ </li></ul>
  27. 28. <ul><li>Corbetura is a free Java tool that calculates the percentage of code accessed by tests. </li></ul><ul><li>It can be used to identify which parts of your Java program are lacking test coverage. </li></ul><ul><li>http://cobertura.sourceforge.net/ </li></ul>Corbetura
  28. 29. Maven Surefire Plugin <ul><li>The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates reports in 2 different file formats: </li></ul><ul><li>Plain text files (*.txt) </li></ul><ul><li>XML files (*.xml) </li></ul>
  29. 30. EXAMPLE: USING CHEKSTYLE PLUGIN IN JASFORGE
  30. 31. Example: Using chekstyle Plugin <ul><ul><li>Quality dashboard </li></ul></ul>
  31. 32. Example: Using chekstyle Plugin <ul><ul><li>List of Rules </li></ul></ul>
  32. 33. <ul><li>Detail of violation </li></ul>Example: Using chekstyle Plugin in Jasforge
  33. 34. Example: Using chekstyle Plugin in Jasforge <ul><ul><ul><li>Code detail : </li></ul></ul></ul>
  34. 35. <ul><li>Demo: </li></ul>
  35. 36. Thank you for your Attention Jasforge: A Jasmine Conseil concept http://www.jasmineconseil.com Need More information ? [email_address] Download the Presentation:

×