Quality - Learning, Measurement & Awareness

926 views
782 views

Published on

This presentation is all about software quality and it is specially prepared for the event named "Quality Conscious Day, 2011" organized by Vizrt Bangladesh Ltd. In this presentation, we will learn about quality, we will learn how to measure code quality and finally, we will try to grow our awareness on good quality code.

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

  • Be the first to like this

No Downloads
Views
Total views
926
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
41
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • As you can see, this presentation is all about QUALITY.In this presentation, we will learn about quality,we will learn how to measure qualityfinally, we will try to grow our awareness on quality
  • Tony Hoare is a British computer scientist best known for the development of Quicksort algorithm, one of the world's most widely used sorting algorithms.KISS strategies:Break down your tasks into sub tasks, that you think should take no longer than 4-12 hours to codeBreak down your problems into many small problems. Each problem should be able to be solved within one or a very few classesKeep your methods small, each method should never be more than 30-40 lines. Each method should only solve one little problem, not many uses cases. If you have a lot of conditions in your method, break these out into smaller methods.Keep your classes small, same methodology applies here as we described for methods.Solve the problem, then code it. Not the other way around. Many developers solve their problem while they are coding, and there is nothing wrong doing that. But I personally prefer the first option.If you follow these principles, then not only will this be easier to read and maintain, but you will find bugs a lot faster.
  • 1. Don’t be clever, instead be clear
  • Quality - Learning, Measurement & Awareness

    1. 1. Q U A L I T YLearning - Measurement - Awareness
    2. 2. Super Heroes…
    3. 3. CodeMan• There is also a super hero inside you!• Being as a… Code Man• Because you can CODE!!! Note: the idea of CodeMan is borrowed from one of my ex-colleagues, Hasan
    4. 4. CodeMan has Super Responsibility But… Super natural power comes with Super responsibility! Because… Power without control hardly has any value.
    5. 5. Responsibilities of a CodeMan Learn how to control power Measure the quality of work Awareness for quality work
    6. 6. What is QUALITY ? Oxford American Dictionary says - the standard of something as measured against other things of a similar kind. It is NOT easy to define Quality. ―You may not know how to define it, but you know it when you see it.‖ - Erik Doernenburg, Head of Technology, ThoughtWorks Europe
    7. 7. CodeMan – Story 1- Manager asks CodeMan to upload his profile picture in Wiki.- The CodeMan quickly uploads one of his photos. - Now, imagine the immediate reaction of the manager!!!
    8. 8. CodeMan – Story 2The CodeMan wrote a method and committed it to VCS as soon as he tested it successfully:Few months later, a critical bug is found in this code.While going through the code, the second CodeMan hardly gets any idea what this piece ofcode block is doing.And the immediate reaction that pops up in his mind: WTF !!!
    9. 9. Measuring Code Quality – WTFs / minute
    10. 10. Measuring Code Quality  It is very important to measure the QUALITY of your CODE.  If you don’t know whether your code quality is GOOD or BAD, then you can never improve your code.
    11. 11. Why Quality Code ?Single purposeChangeability – keeping your code changeable3 key factorsReadability: only easily readable code can easily be understood and thereforechanged―Programs MUST be written for people to read, and only incidentally for machines toexecute.‖ - Abelson and SussmanSimplicity: simple is always easier to change than complicatedTestability: only automatically tested code can be changed without fear of breakingexisting behavior.
    12. 12. How to Improve CODE Quality? How can we improve our CODE QUALITY? How can we minimize the number of WTFs in our CODE?
    13. 13. How to Improve CODE Quality? 1. Code conventions 2. KISS - keeping it stupid simple 3. No RUSH 4. Code reviews 5. Pair programming 6. Automatic build and deployment 7. Incorporating QA process 8. Improve your own quality
    14. 14. Code Conventions Every programming language has some set of guidelines. Things you should strictly follow: - Naming conventions - Coding style guidelines - Exception handling guidelines - Unit testing principles - Principles of object oriented design Configure your IDE, use necessary plugins. These tools eliminate the need for reviews focusing on coding style and basic design. They allow us to put our energy into higher concepts of quality.
    15. 15. KISS - Keep it Stupid SimpleDon’t build Rube Goldberg Machines – something complex to do simple things
    16. 16. KISS - Keep it Stupid Simple There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies - Sir Charles Antony Richard Hoare AKA Tony HoareKISS principles: 1. Split your task into smaller subtasks 2. Break down a complex problem into many smaller and simple problems 3. Keep your methods small, should not more than 30~40 lines 4. Keep your classes small – same methodology as for methods. Follow OOP principles. 5. Solve the problem first, then code it.
    17. 17. Don’t be too clever , No RUSH Be not Clever too CleverClear, Clear, not Don’t code in a Hurry — ‖Haste is Waste‖ Take your time to read the code and see if it is what you meant Take your time to write tests — make sure the code does what you meant, not what you typed Code defensively Act in haste and repent at leisure… Code too soon and debug forever…
    18. 18. Code ReviewsPeriodic inspection of selected parts of the code.Normally, only critical code should be reviewed extensivelyCompare the code at hand with the clean code guidelines and other quality goals.Everyone writes bad code from time to time, but having code reviews eliminates a lotof it. Always try to be nice to your colleagues, and never think that you know better. Be humble since its actually easy to be wrong about stuff. :-) Constructively propose changes. Say positive things, what you really like. Instead of ―that’s lousy long method‖ say, ―why don’t you split that method...‖Code reviews doesnt only eliminate poor code written by team members (andyourself), but is a great way to learn new things from each other.Tools: Crucible, Sonar etc.
    19. 19. Code Reviews - Crucible
    20. 20. Code Reviews - Sonar
    21. 21. Pair Programming Pair programming is a key practice to quality. Advantages: 1. The code is already reviewed by a second developer. 2. The code is built with the combined technical excellence of two developers. This includes the advantages that it is more likely that alternatives are discussed and a better solution results than in the case of a single developer working on the task. 3. Know-how is transferred between the pairing developers. Know-how about the problem domain, technical excellence and even tool usage is shared
    22. 22. Continuous Build and DeploymentEarly build and deploy => Early discover bugs => Early FixWhenever a developer commits/checks-in code into the VCS, thecontinuous integration server starts checking the code.A typical scenario consists of1. building the source code,2. running all automated unit and acceptance tests,3. checking coding guidelines automatically as far as possible4. creating an installer package5. finally deploying the installer package of the application on a test system for additional manual testing.
    23. 23. Incorporating the QA processTraditional software development process:1) finish most of the developments first2) then QA engineers start testingBut this doesn’t work:1) QA engineers doesn’t get enough time2) software is released with lots of untestedfunctionalityWhat actually works:1) Incorporate QA process withdevelopment2) QA process starts as soon as a very smallfunctionality implemented.
    24. 24. Improve your own Quality Improve yourself first. Minimize the number of bugs. well, this a not a critical bug. I can fix it within few minutes. Ask 3 questions before fixing your bug: 1. Have I made this error anywhere else? 2. What happens when I fix the bug? 3. How can I change my ways to make this kind of bug impossible?
    25. 25. 3 Simple TipsQUALITY should be possessed in your MIND, not only in your CODE.QUALITY has to be possessed in your MIND, not only in your CODE. QUALITY must be possessed in your MIND, not only in your CODE.
    26. 26. THANK YOUFerdous Mahmud ShaonSenior Consultant,Professional Services, VizrtEmail: fmshaon@vizrt.comtwitter: @fmshaon

    ×