WEBVTT

00:00:02.090 --> 00:00:04.310 align:middle
In this session, 
I’d like to complete the one

00:00:04.477 --> 00:00:08.230 align:middle
about the debugger and
show you how to detect a bug.

00:00:08.397 --> 00:00:12.440 align:middle
Let’s imagine we change
the decrement definition

00:00:13.610 --> 00:00:14.350 align:middle
and we make a mistake.

00:00:14.660 --> 00:00:17.950 align:middle
Here, I put an addition instead
of a substraction.

00:00:19.160 --> 00:00:22.000 align:middle
When I run my tests, the
TestDecrement returns false.

00:00:22.157 --> 00:00:26.440 align:middle
I execute it, I look at the 
execution and I notice

00:00:26.607 --> 00:00:30.550 align:middle
that indeed count returns
9 instead of 5.

00:00:30.717 --> 00:00:33.540 align:middle
So it shows that I do have 
an error among these

00:00:33.707 --> 00:00:36.120 align:middle
expressions, if I consider that
the counter has been created.

00:00:36.690 --> 00:00:38.520 align:middle
Here I’d like to execute

00:00:38.800 --> 00:00:42.930 align:middle
the code and stop just after

00:00:43.630 --> 00:00:46.200 align:middle
the Counter creation to see
which methods

00:00:46.720 --> 00:00:47.840 align:middle
have a problem.

00:00:48.650 --> 00:00:51.400 align:middle
i add Self halt, this is one of
the ways to propose a

00:00:51.567 --> 00:00:55.040 align:middle
break point in Pharo. I compile
again the method, I do

00:00:55.207 --> 00:00:59.630 align:middle
Proceed, the code is executed
and stops on the halt method.

00:01:00.580 --> 00:01:01.710 align:middle
So now I click on “Over”.

00:01:02.370 --> 00:01:04.850 align:middle
I can decide to go inside

00:01:05.017 --> 00:01:07.110 align:middle
the count method, that’s
what I do for example,

00:01:07.277 --> 00:01:09.790 align:middle
I can see that count value is
nil and Integer value is 7

00:01:13.500 --> 00:01:17.910 align:middle
like here, and there I can click
on “Over”.

00:01:20.770 --> 00:01:22.580 align:middle
I go back, I have decrement.

00:01:22.747 --> 00:01:25.730 align:middle
I’m going to look inside it

00:01:25.897 --> 00:01:27.540 align:middle
because the problem must be there,
and here

00:01:27.707 --> 00:01:29.680 align:middle
I can see that decrement is 
equal to -1.

00:01:33.070 --> 00:01:35.680 align:middle
I modify it, “Over”.

00:01:39.170 --> 00:01:41.000 align:middle
And now I can click on “Proceed”.

00:01:42.620 --> 00:01:47.530 align:middle
When I click on “Proceed” the debug
is left, I remove it,

00:01:47.697 --> 00:01:51.490 align:middle
I click on “Proceed” and my test is green.

