SlideShare a Scribd company logo
1 of 56
SOFTWARE ENGINEERING:
various concepts around
- implementation
- testing
- debugging
- development rules
O. Teytaud
I will here give a list of rules that
one can meet as a developer.

I don't claim that all these rules are
Good. In fact, I keep only some of
them for myself.

It also depends on the context in
which you develop.

Make your own choice :-)
Various sayings around software development (1)


     Debugging and maintaining takes
    much more time than implementing.
   ==> good development saves up time.

      Typesetting is a very small part of
              implementation.

    Data structures are more important
  than codes/algorithms ==> discuss data
        structures more than codes
Various sayings around software development (2)



          Premature optimization is
            the source of all evil.

           Slow bug-free code is often ok.
      Only a few parts of the program are worth
                  being optimized.

    People who never code don't know.
     Trust only people who code. If the
  boss does not code, don't trust the boss.
ASSERT

         We already discussed this,
           do you remember ?

Function tralalaItou(.....)
{
  …
  x=a/b;
  …
  y=log(z);
  ...
}
ASSERT

         We already discussed this,
           do you remember ?

Function tralalaItou(.....)
{
  …
  assert(b!=0); x=a/b;
  …
  assert(z>0); y=log(z);
  ...
}
UNIT TESTS

            Anyone who knows
            what is a unit test ?

                  Example:
I implement a function “half(x) {return x/2}”
               Its unit test is
        ===================
                y=drand48()
          assert(half(y)==y/2);
        ===================
         Principle of unit tests:
        unit tests for all functions.
NO OBESE CODE (1)
   Implement only the methods
    which are really necessary.

   Many programs die (no users,
   no maintenance, …) because
 they are too big and unreadable.

          Keep it simple.

     Four small classes/files
are better than one huge class/file.
NO OBESE CODE (2)



  Do not include a code which is not
           extremely useful.

                Because:
- license issues
- maintenance issues
- compatibility/portability issues
MAINTENANCE RULES

               If you find a bug,

- first, correct the bug :-)

- put several asserts which prevent the
   bug from coming back

- if unit testing, build the unit test
    corresponding to the bug
PREMATURE OPTIMIZATION
         is the source of all evil.
     Do you understand what I mean
             by “optimization” ?


    1) Implement with slow functions

    2) Find where you should optimize
                 (how ?)

3) Optimize this place only; possibly, then,
              go back to (2)
Find where your program is
                  slow
                   Profiling:

       Finding where and why your
             program is slow.

      Possible tool: instrumentation
t1=clock();
…some code...
t2=clock();
timeSpent=t2-t1;
Find where your program is
                  slow
                Profiling:
       Finding where and why your
             program is slow.

       Possible tool: instrumentation

static timeSpent=0;<== do you understand this ?
t1=clock();
…some code...
t2=clock();
timeSpent+=t2-t1; // cumulated time matters!
Or profiling with instrumentation

           Valgrind is just great!

1. valgrind –tool=callgrind ./myprogram
2. kcachegrind

First line: runs your program (slower than
  without valgrind)
Second line: displays a graphical interface,
  showing where the run has spent time.
Pair coding

 Typesetting is a small part of the job.

          So a second person,
in front of the keyboard, is not useless.

Two pairs of eyes are better than one.

    Also very good for transferring
    knowledge and competencies.
Release often

Do not keep a new version private during
       all months of development.
    Release intermediate versions.

                Because:
- earlier feedback on usefulness
- earlier feedback on bugs
- happy users
Intellectual property


Think about open source; keep only
a proprietary interface to
specialized applications.

Because
 - No security cost (this is a huge benefit).
 - Free feedback / help.
 - Motivation by wide diffusion
Management (very personal
            opinion)     (1)
Big developments are a team-work.

People afraid of being fired produce
unreadable code so that they become
necessary.

People afraid of problems will just decide
not to code anything which is important.

Don't kill motivation.
Management (very personal
            opinion)   (2)


Big developments are a team-work.

Hierarchy among developers is bad;
when people are civilized,
discussion/democracy
is better than hierarchy.
Software development methodologies


                What is a SDM ?
        A list of stages, for going from an
      idea of software to the software itself.

             Is there only one SDM ?
                        No:
- Structured Programming
- Object Oriented Programming (focus on data)
- Scrum
- Extreme Programming
- ...
Software development methodologies




      Are all these SDM contradictory ?
                      No.
E.g. you can do “extreme programming” (XP)
 for object-oriented programmming and with
      structure programming (no “goto”).
Example 1: Waterfall development (Royce 1970)


          Dividing the project into phases

        First phases = specification, detailed
                    specification

              Specify dates for phases

             Extensive documentation

     Strong checking at the end of each phase.

              = a “linear” methodology
Example 2: Prototyping


          Quickly doing a first version:
 - possibly incomplete;
 - possibly with some features missing.

                         Ideas:
 - see problems early (thanks to prototype)
 - release early so that people can test.
 - prototype can be discarded or evolved to final model.

= an “iterative” process (variants: “agile”, “extreme”...)
Example 2: Prototyping


              Remark on prototyping:
  - specification does not matter “so much”;
  - software matters much more;
  - I like that, because it gets rid of
      false contributions like philosophical
      remarks on high-level specifications;
  - stupid people/lazy people can discuss
      on high-level specifications.

(please do not understand this as
“dirty programming” without thinking...)
Example 3: “incremental development”



                Idea = combining both.
                Becomes a bit unclear.
E.g.:

- Do detailed specifications as in “waterfall”

- Then implement each block in a prototyping manner

- Release quicky as in the prototyping approach
Other examples

     You can find various methodologies on internet:

  - spiral development

  - many variants of prototyping,
     with plenty of philosophical
     pictures which don't always
    look serious

==> suggests that
     prototyping is a good idea
==> not sure we need a lot of
    theory on this idea
Other examples




          So many examples now...
          See e.g. Unified Process
    (based on Unified Modeling Language).

   With plenty of non-convincing graphs with
boxes, circles, arrows, philosophical statements.
In my opinion:

- know SVN (and/or other such tools)

- read and understand object-oriented programming
      (like it or not, but you will see it
      in your professional life...)

- maybe give a try to functional programming

- and do prototyping-approaches (whenever you don't call
     it prototyping: fast release, no premature optimization,
      prefer the easy way first)
What is software testing ?


- unit tests (each functions does
  what it is intended to do)
- global test (the program does
  what it is intended to do)
- performance test (is the program
  fast enough / does it save up
  resources)
Should we have testings ?

      Yes, very often.

 Well, some people say that
you should not, and that you
 should prove correctness
         (good luck).
Should we have testings ?

   But not necessarily yourself:
- have users (release often) with
    automatic upgrades
- use open source
- include automatic bug report
   in case of “assert”
     (e.g. “core” files;
     do you remember ?)
Terminology of testing



Unit testing: remember ?

Real-time testing: assert!
Terminology of testing


     Functional testing

choose a functionality
in the documentation and test it.
= testing high-level feature, and
  only features included in doc.
Terminology of testing


     Non-functional testing:

  check something which is not
in the doc, but which might be
Important: scalability (w.r.t
number of cores, or memory, or
size of problem, or compatibility...)
Static testing


    Re-read the code.

Re-read the specifications.

Two readers: very efficient.
Dynamic testing



   Debugger.

    Profiler.
Black box, white box

            Black-box:
     testing without knowing
   any thing about how it works.

   White-box: testing with the API
or using internal pieces of codes for
            driving tests.
Regression testing



Checking that the program
 performs at least as well
 as the previous version.
Greek letters


  Alpha-testers: testers from
       your company.

Beta-testers: testers who accept
a possibly highly unstable code.
Usability testing: is it easy to use ?




Security testing: can we cheat for getting
           confidential data ?
How to have plenty of free testers ?



          Cloud development:
  if the code is mainly on your side
(on your cluster), then you can easily
switch some users to a new version.

             E.g.: gmail
How to have plenty of free testers ?




        Automatic updates:
   Linux, Windows, many codes.

Incidentally: bugfixes are immediately
         spread everywhere.
How to have plenty of free testers ?



            Open source:
when using is free, you get many users.

 When they can see the source, they
     might even find the bug.
Related stuff

      Software verification:
    includes testing; answers
  the question “does it work” ?
Also includes “program proving”.

       Software validation:
   Is it really what we need ?
Integration by the customer ok ?
Related stuff

 Warranty: should you give some warranty
              to your user ?

==> quite dangerous.
==> if your user looses 15 billions
    US dollars and can claim that it is
    because your software
    had a bug, you have a trouble
==> limited warranty at most.
Want to test your programming skills ?


    Enter a programming contest.

   Often possible just by internet.

     E.g.: 24 hours, 3 persons
     for developing a program
    which performs a given task.

     You get celebrity if you win,
   you get experience if you loose.
    I'll organize one soon, join :-)
DISCLAIMER (1)
These slides might be biased by my personal experience.
Many programs in real life are incredibly dirty and buggy.
A brief sample of my experience:
   - nobody wanted to be responsible of anything (afraid
      of troubles; so people prefer
      coding minor unimportant easy stuff);

   - someone was angry, and decided to make
        it impossible to get rid of bugs;

   - the crucial person who could make it work
          has gone away (happens often);

   - no time for testing, because everybody had to
          justify that he is very very fast;
DISCLAIMER (2)


- bugs were considered as features, because
      nobody really wanted to maintain a dirty obese code;

- delays were unrealistic, because the guy who
      decides has no idea of what it is about (the
      boss is often not a developper);

- everything was blocked by intellectual property people
   (when there's no use protecting a code, they protect it
   anyway just because they must justify that they work).
PERSONAL CONCLUSION (1)
    I think there's much more respect than 10 years
ago for developpers in software companies (e.g. Google)
Switching from “waterfall” to “prototyping” illustrates this.
               My take-home message:
        I think that “assert” is great, as well as
            test suites, profiling, debuggers,
   automatic upgrades, open source, pair coding, cool
                       atmosphere.

       Many sophisticated philosophical discussions
           on software development are (for me...)
  a little bit useless and just a posteriori rationalization
            of what people actually decided to do.
PERSONAL CONCLUSION (2)


                Think of specialized languages

- Matlab / Octave: fast
      prototyping / modelization with maths

- R for statistics / machine learning

- Cobol for business applications

- Bash/Perl for fast prototyping of file manipulation
Do you know the COBOL language ?

     A main victim of the year 2000 problem
(because it is dedicated to business applications).

    COBOL is also a self-modifying language:
           “Alter X to proceed to Y”
      means: “goto X” becomes “goto Y”.

     Original COBOL had no local variable;
        no while; no dynamic allocation.


     A nice challenge for software testing:
    who had guessed the year 2000 problem
            10 years in advance ?
“Testing can only prove the presence of
defects, never their absence.”
                                    E. Djikstra
         (author of« A Case against the GOTO
                                 Statement »)

             (militant against software testing)
“Object-oriented programming is an
exceptionally bad idea which could only
have originated in California.”

-- Edsger Dijkstra

I do not consider that object oriented
programming is always a good idea.
Don't say this in a job interview; OOP is
now politically correct.
“It is practically impossible to teach good
programming to students that have had a
prior exposure to BASIC: as potential
programmers they are mentally mutilated
beyond hope of regeneration.”

-- Edsger W. Dijkstra, SIGPLAN Notices,
Volume 17, Number 5

(I started programming with Basic...)
“The use of COBOL cripples the mind;
its teaching should, therefore, be
regarded as a criminal offense.”

Edsger W. Dijkstra
Don't consider that programming
       languages will never change.
      In old programming languages:

- lines had a number;
    impossible to concatenate
    two functions.
- variables should be written
   with two letters at most.
- there were “goto” everywhere.
And some people, at that time, claimed that
  extending variable names to 3 or more
      characters was a stupid idea.

More Related Content

What's hot

Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentDhaval Dalal
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easierChristian Hujer
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010guest5639fa9
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And RefactoringNaresh Jain
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Developmentguestc8093a6
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven DevelopmentJohn Blum
 
Lecture 7 program development issues (supplementary)
Lecture 7  program development issues (supplementary)Lecture 7  program development issues (supplementary)
Lecture 7 program development issues (supplementary)alvin567
 
Testing and TDD - KoJUG
Testing and TDD - KoJUGTesting and TDD - KoJUG
Testing and TDD - KoJUGlburdz
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In ActionJon Kruger
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)Brian Rasmussen
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit TestingShaun Abram
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) CodeOps Technologies LLP
 
Test Driven Development by Denis Lutz
Test Driven Development by Denis LutzTest Driven Development by Denis Lutz
Test Driven Development by Denis Lutzjazzman1980
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentMireia Sangalo
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven DevelopmentTung Nguyen Thanh
 
Design For Testability
Design For TestabilityDesign For Testability
Design For TestabilityWill Iverson
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)nedirtv
 

What's hot (20)

Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Lecture 7 program development issues (supplementary)
Lecture 7  program development issues (supplementary)Lecture 7  program development issues (supplementary)
Lecture 7 program development issues (supplementary)
 
Testing and TDD - KoJUG
Testing and TDD - KoJUGTesting and TDD - KoJUG
Testing and TDD - KoJUG
 
TDD Best Practices
TDD Best PracticesTDD Best Practices
TDD Best Practices
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit Testing
 
A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD) A Not-So-Serious Introduction to Test Driven Development (TDD)
A Not-So-Serious Introduction to Test Driven Development (TDD)
 
Test Driven Development by Denis Lutz
Test Driven Development by Denis LutzTest Driven Development by Denis Lutz
Test Driven Development by Denis Lutz
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Design For Testability
Design For TestabilityDesign For Testability
Design For Testability
 
Testing 101
Testing 101Testing 101
Testing 101
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 

Viewers also liked

Artificial intelligence for power systems
Artificial intelligence for power systemsArtificial intelligence for power systems
Artificial intelligence for power systemsOlivier Teytaud
 
Keywords and examples of machine learning
Keywords and examples of machine learningKeywords and examples of machine learning
Keywords and examples of machine learningOlivier Teytaud
 
Bias and Variance in Continuous EDA: massively parallel continuous optimization
Bias and Variance in Continuous EDA: massively parallel continuous optimizationBias and Variance in Continuous EDA: massively parallel continuous optimization
Bias and Variance in Continuous EDA: massively parallel continuous optimizationOlivier Teytaud
 
Réseaux neuronaux profonds & intelligence artificielle
Réseaux neuronaux profonds & intelligence artificielleRéseaux neuronaux profonds & intelligence artificielle
Réseaux neuronaux profonds & intelligence artificielleOlivier Teytaud
 
Fuzzy control - superfast survey
Fuzzy control - superfast surveyFuzzy control - superfast survey
Fuzzy control - superfast surveyOlivier Teytaud
 
Monte Carlo Tree Search in 2014 (MCMC days in Marseille)
Monte Carlo Tree Search in 2014 (MCMC days in Marseille)Monte Carlo Tree Search in 2014 (MCMC days in Marseille)
Monte Carlo Tree Search in 2014 (MCMC days in Marseille)Olivier Teytaud
 
Combining games artificial intelligences & improving random seeds
Combining games artificial intelligences & improving random seedsCombining games artificial intelligences & improving random seeds
Combining games artificial intelligences & improving random seedsOlivier Teytaud
 
Disappointing results & open problems in Monte-Carlo Tree Search
Disappointing results & open problems in Monte-Carlo Tree SearchDisappointing results & open problems in Monte-Carlo Tree Search
Disappointing results & open problems in Monte-Carlo Tree SearchOlivier Teytaud
 
Simple regret bandit algorithms for unstructured noisy optimization
Simple regret bandit algorithms for unstructured noisy optimizationSimple regret bandit algorithms for unstructured noisy optimization
Simple regret bandit algorithms for unstructured noisy optimizationOlivier Teytaud
 
Planning for power systems
Planning for power systemsPlanning for power systems
Planning for power systemsOlivier Teytaud
 
Simulation-based optimization: Upper Confidence Tree and Direct Policy Search
Simulation-based optimization: Upper Confidence Tree and Direct Policy SearchSimulation-based optimization: Upper Confidence Tree and Direct Policy Search
Simulation-based optimization: Upper Confidence Tree and Direct Policy SearchOlivier Teytaud
 
Examples of operational research
Examples of operational researchExamples of operational research
Examples of operational researchOlivier Teytaud
 
Bias correction, and other uncertainty management techniques
Bias correction, and other uncertainty management techniquesBias correction, and other uncertainty management techniques
Bias correction, and other uncertainty management techniquesOlivier Teytaud
 

Viewers also liked (16)

Artificial intelligence for power systems
Artificial intelligence for power systemsArtificial intelligence for power systems
Artificial intelligence for power systems
 
Keywords and examples of machine learning
Keywords and examples of machine learningKeywords and examples of machine learning
Keywords and examples of machine learning
 
Bias and Variance in Continuous EDA: massively parallel continuous optimization
Bias and Variance in Continuous EDA: massively parallel continuous optimizationBias and Variance in Continuous EDA: massively parallel continuous optimization
Bias and Variance in Continuous EDA: massively parallel continuous optimization
 
Réseaux neuronaux profonds & intelligence artificielle
Réseaux neuronaux profonds & intelligence artificielleRéseaux neuronaux profonds & intelligence artificielle
Réseaux neuronaux profonds & intelligence artificielle
 
Power systemsilablri
Power systemsilablriPower systemsilablri
Power systemsilablri
 
Fuzzy control - superfast survey
Fuzzy control - superfast surveyFuzzy control - superfast survey
Fuzzy control - superfast survey
 
Monte Carlo Tree Search in 2014 (MCMC days in Marseille)
Monte Carlo Tree Search in 2014 (MCMC days in Marseille)Monte Carlo Tree Search in 2014 (MCMC days in Marseille)
Monte Carlo Tree Search in 2014 (MCMC days in Marseille)
 
Combining games artificial intelligences & improving random seeds
Combining games artificial intelligences & improving random seedsCombining games artificial intelligences & improving random seeds
Combining games artificial intelligences & improving random seeds
 
Disappointing results & open problems in Monte-Carlo Tree Search
Disappointing results & open problems in Monte-Carlo Tree SearchDisappointing results & open problems in Monte-Carlo Tree Search
Disappointing results & open problems in Monte-Carlo Tree Search
 
Direct policy search
Direct policy searchDirect policy search
Direct policy search
 
Simple regret bandit algorithms for unstructured noisy optimization
Simple regret bandit algorithms for unstructured noisy optimizationSimple regret bandit algorithms for unstructured noisy optimization
Simple regret bandit algorithms for unstructured noisy optimization
 
Planning for power systems
Planning for power systemsPlanning for power systems
Planning for power systems
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Simulation-based optimization: Upper Confidence Tree and Direct Policy Search
Simulation-based optimization: Upper Confidence Tree and Direct Policy SearchSimulation-based optimization: Upper Confidence Tree and Direct Policy Search
Simulation-based optimization: Upper Confidence Tree and Direct Policy Search
 
Examples of operational research
Examples of operational researchExamples of operational research
Examples of operational research
 
Bias correction, and other uncertainty management techniques
Bias correction, and other uncertainty management techniquesBias correction, and other uncertainty management techniques
Bias correction, and other uncertainty management techniques
 

Similar to Debugging

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do itMartin Sykora
 
When develpment met test(shift left testing)
When develpment met test(shift left testing)When develpment met test(shift left testing)
When develpment met test(shift left testing)SangIn Choung
 
Waterfallacies V1 1
Waterfallacies V1 1Waterfallacies V1 1
Waterfallacies V1 1Jorge Boria
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).pptjerlinS1
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...jeyasrig
 
War of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlowWar of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlowPVS-Studio
 
Writting Better Software
Writting Better SoftwareWritting Better Software
Writting Better Softwaresvilen.ivanov
 
Chelberg ptcuser 2010
Chelberg ptcuser 2010Chelberg ptcuser 2010
Chelberg ptcuser 2010Clay Helberg
 
Testing practicies not only in scala
Testing practicies not only in scalaTesting practicies not only in scala
Testing practicies not only in scalaPaweł Panasewicz
 
DevOps interview questions and answers
DevOps interview questions and answersDevOps interview questions and answers
DevOps interview questions and answersHopeTutors1
 
DevOps - Boldly Go for Distro
DevOps - Boldly Go for DistroDevOps - Boldly Go for Distro
DevOps - Boldly Go for DistroPaul Boos
 
Matlab for a computational PhD
Matlab for a computational PhDMatlab for a computational PhD
Matlab for a computational PhDAlbanLevy
 
30 days or less: New Features to Production
30 days or less: New Features to Production30 days or less: New Features to Production
30 days or less: New Features to ProductionKarthik Gaekwad
 
Successful Software Projects - What you need to consider
Successful Software Projects - What you need to considerSuccessful Software Projects - What you need to consider
Successful Software Projects - What you need to considerLloydMoore
 
Software Testing - Day One
Software Testing - Day OneSoftware Testing - Day One
Software Testing - Day OneGovardhan Reddy
 

Similar to Debugging (20)

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do it
 
Raising the Bar
Raising the BarRaising the Bar
Raising the Bar
 
When develpment met test(shift left testing)
When develpment met test(shift left testing)When develpment met test(shift left testing)
When develpment met test(shift left testing)
 
Waterfallacies V1 1
Waterfallacies V1 1Waterfallacies V1 1
Waterfallacies V1 1
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).ppt
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...
 
War of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlowWar of the Machines: PVS-Studio vs. TensorFlow
War of the Machines: PVS-Studio vs. TensorFlow
 
Agile
AgileAgile
Agile
 
Writting Better Software
Writting Better SoftwareWritting Better Software
Writting Better Software
 
Chelberg ptcuser 2010
Chelberg ptcuser 2010Chelberg ptcuser 2010
Chelberg ptcuser 2010
 
Testing practicies not only in scala
Testing practicies not only in scalaTesting practicies not only in scala
Testing practicies not only in scala
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 
DevOps interview questions and answers
DevOps interview questions and answersDevOps interview questions and answers
DevOps interview questions and answers
 
01.intro
01.intro01.intro
01.intro
 
DevOps - Boldly Go for Distro
DevOps - Boldly Go for DistroDevOps - Boldly Go for Distro
DevOps - Boldly Go for Distro
 
Matlab for a computational PhD
Matlab for a computational PhDMatlab for a computational PhD
Matlab for a computational PhD
 
30 days or less: New Features to Production
30 days or less: New Features to Production30 days or less: New Features to Production
30 days or less: New Features to Production
 
Tdd
TddTdd
Tdd
 
Successful Software Projects - What you need to consider
Successful Software Projects - What you need to considerSuccessful Software Projects - What you need to consider
Successful Software Projects - What you need to consider
 
Software Testing - Day One
Software Testing - Day OneSoftware Testing - Day One
Software Testing - Day One
 

Recently uploaded

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Recently uploaded (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Debugging

  • 1. SOFTWARE ENGINEERING: various concepts around - implementation - testing - debugging - development rules O. Teytaud
  • 2. I will here give a list of rules that one can meet as a developer. I don't claim that all these rules are Good. In fact, I keep only some of them for myself. It also depends on the context in which you develop. Make your own choice :-)
  • 3. Various sayings around software development (1) Debugging and maintaining takes much more time than implementing. ==> good development saves up time. Typesetting is a very small part of implementation. Data structures are more important than codes/algorithms ==> discuss data structures more than codes
  • 4. Various sayings around software development (2) Premature optimization is the source of all evil. Slow bug-free code is often ok. Only a few parts of the program are worth being optimized. People who never code don't know. Trust only people who code. If the boss does not code, don't trust the boss.
  • 5. ASSERT We already discussed this, do you remember ? Function tralalaItou(.....) { … x=a/b; … y=log(z); ... }
  • 6. ASSERT We already discussed this, do you remember ? Function tralalaItou(.....) { … assert(b!=0); x=a/b; … assert(z>0); y=log(z); ... }
  • 7. UNIT TESTS Anyone who knows what is a unit test ? Example: I implement a function “half(x) {return x/2}” Its unit test is =================== y=drand48() assert(half(y)==y/2); =================== Principle of unit tests: unit tests for all functions.
  • 8. NO OBESE CODE (1) Implement only the methods which are really necessary. Many programs die (no users, no maintenance, …) because they are too big and unreadable. Keep it simple. Four small classes/files are better than one huge class/file.
  • 9. NO OBESE CODE (2) Do not include a code which is not extremely useful. Because: - license issues - maintenance issues - compatibility/portability issues
  • 10. MAINTENANCE RULES If you find a bug, - first, correct the bug :-) - put several asserts which prevent the bug from coming back - if unit testing, build the unit test corresponding to the bug
  • 11. PREMATURE OPTIMIZATION is the source of all evil. Do you understand what I mean by “optimization” ? 1) Implement with slow functions 2) Find where you should optimize (how ?) 3) Optimize this place only; possibly, then, go back to (2)
  • 12. Find where your program is slow Profiling: Finding where and why your program is slow. Possible tool: instrumentation t1=clock(); …some code... t2=clock(); timeSpent=t2-t1;
  • 13. Find where your program is slow Profiling: Finding where and why your program is slow. Possible tool: instrumentation static timeSpent=0;<== do you understand this ? t1=clock(); …some code... t2=clock(); timeSpent+=t2-t1; // cumulated time matters!
  • 14. Or profiling with instrumentation Valgrind is just great! 1. valgrind –tool=callgrind ./myprogram 2. kcachegrind First line: runs your program (slower than without valgrind) Second line: displays a graphical interface, showing where the run has spent time.
  • 15. Pair coding Typesetting is a small part of the job. So a second person, in front of the keyboard, is not useless. Two pairs of eyes are better than one. Also very good for transferring knowledge and competencies.
  • 16. Release often Do not keep a new version private during all months of development. Release intermediate versions. Because: - earlier feedback on usefulness - earlier feedback on bugs - happy users
  • 17. Intellectual property Think about open source; keep only a proprietary interface to specialized applications. Because - No security cost (this is a huge benefit). - Free feedback / help. - Motivation by wide diffusion
  • 18. Management (very personal opinion) (1) Big developments are a team-work. People afraid of being fired produce unreadable code so that they become necessary. People afraid of problems will just decide not to code anything which is important. Don't kill motivation.
  • 19. Management (very personal opinion) (2) Big developments are a team-work. Hierarchy among developers is bad; when people are civilized, discussion/democracy is better than hierarchy.
  • 20. Software development methodologies What is a SDM ? A list of stages, for going from an idea of software to the software itself. Is there only one SDM ? No: - Structured Programming - Object Oriented Programming (focus on data) - Scrum - Extreme Programming - ...
  • 21. Software development methodologies Are all these SDM contradictory ? No. E.g. you can do “extreme programming” (XP) for object-oriented programmming and with structure programming (no “goto”).
  • 22. Example 1: Waterfall development (Royce 1970) Dividing the project into phases First phases = specification, detailed specification Specify dates for phases Extensive documentation Strong checking at the end of each phase. = a “linear” methodology
  • 23. Example 2: Prototyping Quickly doing a first version: - possibly incomplete; - possibly with some features missing. Ideas: - see problems early (thanks to prototype) - release early so that people can test. - prototype can be discarded or evolved to final model. = an “iterative” process (variants: “agile”, “extreme”...)
  • 24. Example 2: Prototyping Remark on prototyping: - specification does not matter “so much”; - software matters much more; - I like that, because it gets rid of false contributions like philosophical remarks on high-level specifications; - stupid people/lazy people can discuss on high-level specifications. (please do not understand this as “dirty programming” without thinking...)
  • 25. Example 3: “incremental development” Idea = combining both. Becomes a bit unclear. E.g.: - Do detailed specifications as in “waterfall” - Then implement each block in a prototyping manner - Release quicky as in the prototyping approach
  • 26. Other examples You can find various methodologies on internet: - spiral development - many variants of prototyping, with plenty of philosophical pictures which don't always look serious ==> suggests that prototyping is a good idea ==> not sure we need a lot of theory on this idea
  • 27. Other examples So many examples now... See e.g. Unified Process (based on Unified Modeling Language). With plenty of non-convincing graphs with boxes, circles, arrows, philosophical statements.
  • 28. In my opinion: - know SVN (and/or other such tools) - read and understand object-oriented programming (like it or not, but you will see it in your professional life...) - maybe give a try to functional programming - and do prototyping-approaches (whenever you don't call it prototyping: fast release, no premature optimization, prefer the easy way first)
  • 29. What is software testing ? - unit tests (each functions does what it is intended to do) - global test (the program does what it is intended to do) - performance test (is the program fast enough / does it save up resources)
  • 30. Should we have testings ? Yes, very often. Well, some people say that you should not, and that you should prove correctness (good luck).
  • 31. Should we have testings ? But not necessarily yourself: - have users (release often) with automatic upgrades - use open source - include automatic bug report in case of “assert” (e.g. “core” files; do you remember ?)
  • 32. Terminology of testing Unit testing: remember ? Real-time testing: assert!
  • 33. Terminology of testing Functional testing choose a functionality in the documentation and test it. = testing high-level feature, and only features included in doc.
  • 34. Terminology of testing Non-functional testing: check something which is not in the doc, but which might be Important: scalability (w.r.t number of cores, or memory, or size of problem, or compatibility...)
  • 35. Static testing Re-read the code. Re-read the specifications. Two readers: very efficient.
  • 36. Dynamic testing Debugger. Profiler.
  • 37. Black box, white box Black-box: testing without knowing any thing about how it works. White-box: testing with the API or using internal pieces of codes for driving tests.
  • 38. Regression testing Checking that the program performs at least as well as the previous version.
  • 39. Greek letters Alpha-testers: testers from your company. Beta-testers: testers who accept a possibly highly unstable code.
  • 40. Usability testing: is it easy to use ? Security testing: can we cheat for getting confidential data ?
  • 41. How to have plenty of free testers ? Cloud development: if the code is mainly on your side (on your cluster), then you can easily switch some users to a new version. E.g.: gmail
  • 42. How to have plenty of free testers ? Automatic updates: Linux, Windows, many codes. Incidentally: bugfixes are immediately spread everywhere.
  • 43. How to have plenty of free testers ? Open source: when using is free, you get many users. When they can see the source, they might even find the bug.
  • 44. Related stuff Software verification: includes testing; answers the question “does it work” ? Also includes “program proving”. Software validation: Is it really what we need ? Integration by the customer ok ?
  • 45. Related stuff Warranty: should you give some warranty to your user ? ==> quite dangerous. ==> if your user looses 15 billions US dollars and can claim that it is because your software had a bug, you have a trouble ==> limited warranty at most.
  • 46. Want to test your programming skills ? Enter a programming contest. Often possible just by internet. E.g.: 24 hours, 3 persons for developing a program which performs a given task. You get celebrity if you win, you get experience if you loose. I'll organize one soon, join :-)
  • 47. DISCLAIMER (1) These slides might be biased by my personal experience. Many programs in real life are incredibly dirty and buggy. A brief sample of my experience: - nobody wanted to be responsible of anything (afraid of troubles; so people prefer coding minor unimportant easy stuff); - someone was angry, and decided to make it impossible to get rid of bugs; - the crucial person who could make it work has gone away (happens often); - no time for testing, because everybody had to justify that he is very very fast;
  • 48. DISCLAIMER (2) - bugs were considered as features, because nobody really wanted to maintain a dirty obese code; - delays were unrealistic, because the guy who decides has no idea of what it is about (the boss is often not a developper); - everything was blocked by intellectual property people (when there's no use protecting a code, they protect it anyway just because they must justify that they work).
  • 49. PERSONAL CONCLUSION (1) I think there's much more respect than 10 years ago for developpers in software companies (e.g. Google) Switching from “waterfall” to “prototyping” illustrates this. My take-home message: I think that “assert” is great, as well as test suites, profiling, debuggers, automatic upgrades, open source, pair coding, cool atmosphere. Many sophisticated philosophical discussions on software development are (for me...) a little bit useless and just a posteriori rationalization of what people actually decided to do.
  • 50. PERSONAL CONCLUSION (2) Think of specialized languages - Matlab / Octave: fast prototyping / modelization with maths - R for statistics / machine learning - Cobol for business applications - Bash/Perl for fast prototyping of file manipulation
  • 51. Do you know the COBOL language ? A main victim of the year 2000 problem (because it is dedicated to business applications). COBOL is also a self-modifying language: “Alter X to proceed to Y” means: “goto X” becomes “goto Y”. Original COBOL had no local variable; no while; no dynamic allocation. A nice challenge for software testing: who had guessed the year 2000 problem 10 years in advance ?
  • 52. “Testing can only prove the presence of defects, never their absence.” E. Djikstra (author of« A Case against the GOTO Statement ») (militant against software testing)
  • 53. “Object-oriented programming is an exceptionally bad idea which could only have originated in California.” -- Edsger Dijkstra I do not consider that object oriented programming is always a good idea. Don't say this in a job interview; OOP is now politically correct.
  • 54. “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5 (I started programming with Basic...)
  • 55. “The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense.” Edsger W. Dijkstra
  • 56. Don't consider that programming languages will never change. In old programming languages: - lines had a number; impossible to concatenate two functions. - variables should be written with two letters at most. - there were “goto” everywhere. And some people, at that time, claimed that extending variable names to 3 or more characters was a stupid idea.