WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:00.236 --> 00:00:03.696 align:middle
Everybody's got their caffeine?

00:00:04.966 --> 00:00:13.096 align:middle
I know it's the last session of the
first day, so, everybody needs it, right?

00:00:14.716 --> 00:00:19.356 align:middle
No? Somebody can live without coffee.

00:00:19.526 --> 00:00:23.606 align:middle
I need some help with how to do that.

00:00:25.436 --> 00:00:33.946 align:middle
So, first off, I see a lot of young faces in
the crowd, so, do you know what this thing is?

00:00:34.126 --> 00:00:40.106 align:middle
That's how old when I started
developing professionally.

00:00:40.566 --> 00:00:42.886 align:middle
So, almost 20 years now.

00:00:43.656 --> 00:00:47.956 align:middle
So, I started off doing small
websites because at

00:00:47.956 --> 00:00:51.326 align:middle
that time people just wanted
to have some internet presence.

00:00:52.226 --> 00:00:59.056 align:middle
And far away from any kind of rocket science,
even by those days, and for most of you today,

00:00:59.346 --> 00:01:02.226 align:middle
it would be like, yeah, really
what's the problem there?

00:01:02.226 --> 00:01:09.796 align:middle
But that was the time that we didn't have cool
things like frameworks, templating engines,

00:01:10.436 --> 00:01:13.836 align:middle
database abstraction layers or ORMs.

00:01:14.756 --> 00:01:20.176 align:middle
We had to handle all of that ourselves, but
this was actually the fun part of the job.

00:01:20.906 --> 00:01:25.426 align:middle
The problems started when you
had to make it work for things

00:01:25.426 --> 00:01:28.936 align:middle
like Netscape or Internet explorer 5.5.

00:01:29.626 --> 00:01:35.846 align:middle
And if any of you are doing front-end these
days and think you're screwed, trust me.

00:01:37.636 --> 00:01:45.356 align:middle
And, I got so uninterested in
development that I actually went back

00:01:45.356 --> 00:01:50.336 align:middle
to university doing some freelance
on the side, earning some money.

00:01:50.336 --> 00:01:56.526 align:middle
But about 10 years ago I found a team, I
found a company, I found a really great job.

00:01:56.526 --> 00:01:58.586 align:middle
It was a small product.

00:01:58.586 --> 00:02:02.826 align:middle
It started off, let's say, like a
dog house - really, really small.

00:02:04.006 --> 00:02:10.916 align:middle
As we kept working on it, it kept growing
in both features, customers, money.

00:02:12.206 --> 00:02:15.536 align:middle
So, I was good with, let's say, carpentry.

00:02:16.166 --> 00:02:23.546 align:middle
So, in few months we had a shed, which
meant more and more people could fit in.

00:02:23.736 --> 00:02:26.316 align:middle
They wanted more and more,
more money was coming in,

00:02:26.316 --> 00:02:28.726 align:middle
more customers, more content, more everything.

00:02:29.896 --> 00:02:31.006 align:middle
So it's grew again.

00:02:32.276 --> 00:02:36.866 align:middle
You understand that you can't use
wood to build skyscrapers, right?

00:02:37.326 --> 00:02:38.556 align:middle
You have to change your base.

00:02:39.076 --> 00:02:44.186 align:middle
So yes, I had to learn how to use
concrete to get a big, better stuff done.

00:02:45.646 --> 00:02:51.136 align:middle
But what actually, my code
looked like, something like this.

00:02:51.306 --> 00:02:55.796 align:middle
You know, and to be honest,
probably, in this case,

00:02:56.136 --> 00:02:58.806 align:middle
this was done by somebody
and then by somebody else.

00:02:58.976 --> 00:03:02.076 align:middle
And for most of it was us, us.

00:03:04.736 --> 00:03:07.806 align:middle
And, okay, it was ugly, but it worked.

00:03:08.786 --> 00:03:14.466 align:middle
But what our customers wanted was bigger
and bigger and nicer and not now concrete.

00:03:14.936 --> 00:03:17.606 align:middle
It's aluminum, it's glass, it's shiny.

00:03:18.086 --> 00:03:24.166 align:middle
But as we kept growing, we kept failing.

00:03:24.316 --> 00:03:28.556 align:middle
Because, hey, I didn't have the
experience needed for that project.

00:03:29.826 --> 00:03:37.066 align:middle
I used to work in small websites, small
apps, not 100 million user visits a month.

00:03:37.126 --> 00:03:46.146 align:middle
And what customers actually paid and what I
thought was, oh, this is what we're doing.

00:03:46.686 --> 00:03:55.166 align:middle
But in honesty, most of the developers don't
understand that businesses want a nice feature,

00:03:55.466 --> 00:03:59.566 align:middle
another nice feature, they really really
want something to just glue them together.

00:04:00.646 --> 00:04:04.356 align:middle
By design, because businesses
don't know always what they want.

00:04:05.346 --> 00:04:09.556 align:middle
So, this project has took
about five years of my life.

00:04:10.476 --> 00:04:16.456 align:middle
And the next project that I came on,
yeah, it's going to grow like that, right?

00:04:16.456 --> 00:04:21.066 align:middle
It's going to be that small product
is going to be the biggest thing ever.

00:04:21.856 --> 00:04:25.176 align:middle
Unfortunately, what I was suffering
from was Stockholm Syndrome.

00:04:26.126 --> 00:04:31.066 align:middle
Because in reality, not every
project or product becomes big.

00:04:32.396 --> 00:04:36.196 align:middle
So, let's say that you want to buy
a dog house, like a real dog house.

00:04:36.196 --> 00:04:38.606 align:middle
You have a dog and you want to buy a dog house.

00:04:39.756 --> 00:04:43.976 align:middle
How would you feel if I came to
you and told you that the price

00:04:44.016 --> 00:04:49.216 align:middle
for this nice small dog house
includes something like this?

00:04:50.546 --> 00:04:56.946 align:middle
Because it's going to be a skyscraper so I want
to do it before and avoid all of the problems.

00:04:57.676 --> 00:05:03.416 align:middle
Right? Found yourself any
time in that situation?

00:05:05.736 --> 00:05:11.526 align:middle
So, Donald Knuth said: Premature
optimization is the root of all evil.

00:05:12.786 --> 00:05:17.936 align:middle
And, that's why I want to talk to you
about when testing makes no sense.

00:05:18.546 --> 00:05:19.566 align:middle
My name is Miro Svrtan.

00:05:19.626 --> 00:05:21.686 align:middle
You can find me on Twitter using this handle.

00:05:21.686 --> 00:05:27.606 align:middle
So why am I talking about buildings and testing?

00:05:28.586 --> 00:05:29.486 align:middle
What's the connection?

00:05:30.616 --> 00:05:34.286 align:middle
So, who here is testing?

00:05:34.826 --> 00:05:36.806 align:middle
It's an easy question, right?

00:05:37.606 --> 00:05:41.436 align:middle
Okay. Who here isn't testing?

00:05:41.566 --> 00:05:46.486 align:middle
Again, so, this was a partially loaded question.

00:05:46.826 --> 00:05:47.516 align:middle
Sorry for that.

00:05:48.036 --> 00:05:50.186 align:middle
But actually all of us test.

00:05:50.656 --> 00:05:57.336 align:middle
You write some code, you open your browser,
you check that it works - it's also a testing.

00:05:57.336 --> 00:06:02.286 align:middle
So, I hope nobody just writes the
code and pushes it to production.

00:06:04.316 --> 00:06:06.656 align:middle
To be honest, I did it few times.

00:06:06.656 --> 00:06:10.946 align:middle
But not as a normal way of working.

00:06:12.426 --> 00:06:16.076 align:middle
So, let's say that we have a small website.

00:06:17.166 --> 00:06:20.166 align:middle
No Mars rover thing, just a small website.

00:06:21.076 --> 00:06:21.966 align:middle
And we have a bug.

00:06:22.966 --> 00:06:28.306 align:middle
How much time do you think after somebody
reports it will take us to fix it?

00:06:29.656 --> 00:06:30.496 align:middle
Five minutes?

00:06:30.836 --> 00:06:33.876 align:middle
An hour? Half a day?

00:06:35.816 --> 00:06:38.006 align:middle
How much time does it take you to deploy?

00:06:39.716 --> 00:06:42.236 align:middle
Probably 5 to 10, maybe 15 minutes.

00:06:42.756 --> 00:06:49.446 align:middle
Right? So, why would we test
and invest in testing

00:06:49.446 --> 00:06:52.026 align:middle
when we can fix something
quickly and deploy it everywhere?

00:06:53.086 --> 00:07:00.526 align:middle
But the problem was that about 7-8 years ago, a
lot of web developers became phone developers.

00:07:02.116 --> 00:07:03.396 align:middle
Been there, done that.

00:07:03.396 --> 00:07:08.146 align:middle
A few of my colleagues went that way, but
they didn't have the mindset of testing.

00:07:09.296 --> 00:07:14.886 align:middle
Which is pretty nice for Google
store because it takes about 3 days

00:07:14.886 --> 00:07:16.946 align:middle
after you fix it for people to get it.

00:07:17.846 --> 00:07:20.636 align:middle
But what if it's an iPhone?

00:07:20.636 --> 00:07:25.766 align:middle
iOS app? 6-7 years ago it would
take from 2 weeks to 3 weeks,

00:07:25.766 --> 00:07:29.036 align:middle
sometimes even a month to fix something.

00:07:29.526 --> 00:07:33.446 align:middle
What if you're doing desktop applications?

00:07:33.816 --> 00:07:39.206 align:middle
You have a bug and now all of your
customers have to be somehow contacted

00:07:39.356 --> 00:07:42.276 align:middle
to download the new version because, okay,

00:07:42.636 --> 00:07:47.386 align:middle
maybe Mac users do have App store,
but Windows users not so much.

00:07:48.736 --> 00:07:51.056 align:middle
How hard does it then to fix a bug?

00:07:51.636 --> 00:07:54.966 align:middle
It might not be a critical
bug, but it might be something

00:07:55.166 --> 00:07:57.336 align:middle
that bothers your customers, your users.

00:07:58.856 --> 00:08:00.836 align:middle
Hey, we have hardware.

00:08:01.836 --> 00:08:03.566 align:middle
But that's at least easy, right?

00:08:03.616 --> 00:08:07.356 align:middle
Because, this is a router, so
it's connected to internet, right?

00:08:07.356 --> 00:08:08.736 align:middle
So it's easy to fix it.

00:08:09.146 --> 00:08:13.036 align:middle
If we have a bug, we can just
ship it to all the routers.

00:08:13.506 --> 00:08:18.906 align:middle
What if the bug is in the piece
of code getting the update?

00:08:21.396 --> 00:08:26.216 align:middle
Are you going to send all of your
staff to the whole continent,

00:08:26.216 --> 00:08:29.346 align:middle
to the whole world to fix people's routers?

00:08:31.356 --> 00:08:32.526 align:middle
What if it's...

00:08:32.526 --> 00:08:34.266 align:middle
what if it's a washing machine?

00:08:35.056 --> 00:08:42.156 align:middle
Hopefully, it's not connected to internet,
but you find out that you shipped some of it

00:08:43.066 --> 00:08:46.306 align:middle
and you can't wash cotton on 60 degrees.

00:08:47.776 --> 00:08:52.666 align:middle
So, you now have to call all of your
mechanics, all of your service departments,

00:08:53.266 --> 00:08:56.296 align:middle
to contact the customers to
flash the washing machine.

00:08:57.456 --> 00:09:03.806 align:middle
So, when should we write tests?

00:09:03.956 --> 00:09:05.946 align:middle
When it's a high cost to fix?

00:09:06.476 --> 00:09:16.736 align:middle
Because, maybe, sometimes it's cheaper to
test than to try to fix it once it happens.

00:09:16.736 --> 00:09:19.366 align:middle
Maybe when the cost is larger.

00:09:19.746 --> 00:09:23.386 align:middle
Let's go back to the website.

00:09:24.546 --> 00:09:25.906 align:middle
So, should we ever test websites?

00:09:25.906 --> 00:09:27.976 align:middle
We can fix it easily, right?

00:09:29.076 --> 00:09:29.886 align:middle
Yep. Right?

00:09:30.286 --> 00:09:31.556 align:middle
Anybody? Nobody?

00:09:32.006 --> 00:09:33.386 align:middle
Everything test?

00:09:35.296 --> 00:09:37.966 align:middle
But banks do use websites as well.

00:09:39.326 --> 00:09:49.496 align:middle
I mean I hope you don't experience a bug where
you send the money instead of receiving it.

00:09:50.446 --> 00:09:53.886 align:middle
The other way around, probably, you'd like it.

00:09:55.696 --> 00:09:59.396 align:middle
Right? So, let's maybe look
at it as when it brings value.

00:10:00.076 --> 00:10:07.816 align:middle
Because value is not just the money, it's
how much your consumers love the product,

00:10:08.076 --> 00:10:11.576 align:middle
how much your clients are happy with your work.

00:10:12.516 --> 00:10:19.316 align:middle
Maybe for you, if you're a development company,
maybe because of, maybe, it would bring value

00:10:19.316 --> 00:10:23.676 align:middle
in the sense of people not leaving the company
often because they would be more happy?

00:10:25.336 --> 00:10:30.306 align:middle
There's a lot of cost when a
disgruntled employee decides to leave

00:10:30.976 --> 00:10:33.706 align:middle
because then you have to get somebody in.

00:10:34.296 --> 00:10:39.266 align:middle
It might take about 6 months
to get the new person in.

00:10:42.076 --> 00:10:47.116 align:middle
So, let's define the value
as benefit minus the cost.

00:10:47.226 --> 00:10:55.066 align:middle
So, what I'm trying to say that if, let's say,
you have a tomato farm that produces a lot

00:10:55.066 --> 00:10:59.596 align:middle
of tomatoes, you probably
shouldn't use the same tactic -

00:11:00.506 --> 00:11:10.366 align:middle
you might use on your own tomato garden.

00:11:10.526 --> 00:11:16.746 align:middle
You maybe like your tomatoes a lot, but
would you, um, would you create a whole lab?

00:11:16.746 --> 00:11:18.996 align:middle
Would you test it every day?

00:11:20.346 --> 00:11:27.136 align:middle
Probably for tomato farm you would because
if one goes down - you might lose everything.

00:11:27.816 --> 00:11:29.456 align:middle
Everything, if you get the disease.

00:11:30.496 --> 00:11:34.906 align:middle
In case of your tomatoes in the garden,
you can just go to a farmer's market

00:11:34.906 --> 00:11:37.096 align:middle
or a supermarket and get some others.

00:11:37.666 --> 00:11:43.736 align:middle
Okay? So, value is benefit minus the cost.

00:11:44.126 --> 00:11:48.396 align:middle
Of course, I do understand that some
people might invest a lot of money

00:11:48.506 --> 00:11:53.926 align:middle
into their tomato gardens because it's a
hobby and we tend to spend a lot of money

00:11:53.956 --> 00:11:56.796 align:middle
on our hobbies, but let's
look at it as a business.

00:11:57.326 --> 00:11:59.296 align:middle
The benefit minus the cost.

00:12:00.036 --> 00:12:07.726 align:middle
So there is some, before I go further, there
are lots of different things about testing.

00:12:08.156 --> 00:12:14.806 align:middle
So what I'm going to try to focus on
is writing test, automating the tests,

00:12:15.306 --> 00:12:21.236 align:middle
the ones that help you ensure that
the app does what was expected?

00:12:22.026 --> 00:12:27.756 align:middle
Okay? So, who here writes tests in that way?

00:12:27.926 --> 00:12:30.936 align:middle
Okay. Who tests everything?

00:12:35.646 --> 00:12:37.886 align:middle
Okay. 6 to 7 hands.

00:12:38.616 --> 00:12:41.566 align:middle
So, actually, can you raise your hands up?

00:12:42.616 --> 00:12:43.736 align:middle
Who tests everything?

00:12:44.576 --> 00:12:46.176 align:middle
How much security testing do we do?

00:12:47.536 --> 00:12:50.566 align:middle
Performance testing?

00:12:50.676 --> 00:12:52.176 align:middle
Visual regression testing?

00:12:53.016 --> 00:12:54.076 align:middle
That all is testing, right?

00:12:55.326 --> 00:13:02.136 align:middle
So, why I decided to do this
talk was people came to a stage

00:13:02.136 --> 00:13:04.266 align:middle
like this and said we test everything.

00:13:04.676 --> 00:13:11.906 align:middle
And a lot of people understood that, yeah, to
be a good developer you have to test everything.

00:13:11.906 --> 00:13:18.476 align:middle
And they started testing, but they
started testing the wrong things.

00:13:18.656 --> 00:13:19.696 align:middle
I've done it that way.

00:13:20.206 --> 00:13:29.966 align:middle
And, 6 months ago I did this talk in Amsterdam
and I spoke to another speaker afterwards.

00:13:29.966 --> 00:13:34.556 align:middle
He wasn't at my talk, but he was interested in
what I was talking about and he told me: Hey,

00:13:34.556 --> 00:13:39.816 align:middle
yeah, well no, you shouldn't be talking about
when not to test because we test everything.

00:13:41.136 --> 00:13:43.606 align:middle
I said: Okay, so performance?

00:13:43.856 --> 00:13:45.766 align:middle
Oh, no. Security?

00:13:46.426 --> 00:13:48.146 align:middle
Some. Visual regression?

00:13:48.486 --> 00:13:50.746 align:middle
Nah, we actually TDD everything.

00:13:51.226 --> 00:13:53.836 align:middle
Wait, you're using Symfony
and you TDD everything?

00:13:54.146 --> 00:14:02.376 align:middle
Yes. I was really interested because I found TDD
to be very wrong for Symfony, the Symfony part,

00:14:02.736 --> 00:14:05.456 align:middle
like using the Forms, using the
Doctrine and stuff like that.

00:14:06.346 --> 00:14:09.096 align:middle
And I was wondering, okay, how do you do that?

00:14:09.306 --> 00:14:10.496 align:middle
Oh, we don't.

00:14:12.616 --> 00:14:21.296 align:middle
So, wait, you just told me you test everything
and you do it TDD way, but you don't do the UI,

00:14:21.366 --> 00:14:24.616 align:middle
the infrastructure and stuff like that?

00:14:24.616 --> 00:14:27.196 align:middle
Nope, that's the UI.

00:14:27.286 --> 00:14:32.546 align:middle
So if I wasn't really interested in
that part, like how do you do that?

00:14:33.456 --> 00:14:38.286 align:middle
I would think, yeah, I'm the stupid
one because I don't test everything.

00:14:39.146 --> 00:14:40.826 align:middle
Please, don't be.

00:14:41.446 --> 00:14:43.266 align:middle
There are a lot of fallacies with testing.

00:14:47.056 --> 00:14:54.286 align:middle
6 or 7 years ago, when I wanted to start writing
tests, one of the biggest problems I had,

00:14:54.286 --> 00:14:58.216 align:middle
I was a team lead at the time, was...

00:14:58.436 --> 00:15:03.076 align:middle
So similar feature was about 100 hours.

00:15:03.796 --> 00:15:10.916 align:middle
Now I need to set an estimate of
about 150 hours because, well,

00:15:12.186 --> 00:15:15.496 align:middle
writing the code, writing the tests, right?

00:15:15.746 --> 00:15:19.546 align:middle
So it's gonna take more money from the clients.

00:15:19.596 --> 00:15:20.836 align:middle
They're not going to be happy.

00:15:22.136 --> 00:15:28.906 align:middle
What I didn't think of - do
you charge for manual testing?

00:15:29.006 --> 00:15:36.656 align:middle
So, do we say: Hey, it's gonna take me 7
hours to write the code and X amount of hours

00:15:36.656 --> 00:15:40.476 align:middle
to run it in the browser as I
click save on the code every time.

00:15:41.056 --> 00:15:46.406 align:middle
We think of it as the same
thing, it's part of development.

00:15:48.156 --> 00:15:56.126 align:middle
And, if you have to explain to anybody,
try to explain to them the bugs cost too.

00:15:56.926 --> 00:16:05.086 align:middle
So most of the companies should
have, should solve the bugs for free.

00:16:06.016 --> 00:16:11.716 align:middle
Right? I mean I know of companies
whose whole business plan is

00:16:12.266 --> 00:16:15.596 align:middle
to charge for bugs, for bug fixing.

00:16:15.596 --> 00:16:21.686 align:middle
But you might notice that that's a pretty
bad business model because somehow they want

00:16:21.686 --> 00:16:25.606 align:middle
to produce more bugs because
that means more work for them.

00:16:26.146 --> 00:16:30.746 align:middle
Right? Anybody here has a car?

00:16:32.056 --> 00:16:33.416 align:middle
A new car maybe?

00:16:33.546 --> 00:16:34.906 align:middle
Or somebody's buying a new car?

00:16:35.626 --> 00:16:41.156 align:middle
Recently? So, let's say you
want to buy this car.

00:16:41.726 --> 00:16:46.356 align:middle
You go to, I think it's an Opel dealership,
and you say: Hey, I want this one.

00:16:46.626 --> 00:16:47.366 align:middle
How much does it cost?

00:16:47.366 --> 00:16:54.246 align:middle
Oh, 20,000 euros, let's say, I have no
idea, please, don't get me on the numbers.

00:16:55.216 --> 00:16:57.026 align:middle
Okay. So, it's tested, right?

00:16:57.636 --> 00:16:59.536 align:middle
Yeah. So can I get the version that's not?

00:16:59.686 --> 00:17:02.586 align:middle
It's going to be cheaper, right?

00:17:03.476 --> 00:17:05.706 align:middle
Because why would I pay for testing?

00:17:06.876 --> 00:17:11.226 align:middle
So products don't come out without those things.

00:17:11.836 --> 00:17:16.316 align:middle
I mean, when you buy food, you
expect it to be tested, right?

00:17:17.506 --> 00:17:18.856 align:middle
You don't want to be poisoned.

00:17:23.036 --> 00:17:25.406 align:middle
Try to ask for forgiveness, not permission.

00:17:26.296 --> 00:17:28.096 align:middle
Just try to do it.

00:17:28.636 --> 00:17:30.966 align:middle
Try to do it in a small way.

00:17:31.176 --> 00:17:32.746 align:middle
Start building up your tests.

00:17:33.886 --> 00:17:37.366 align:middle
Every new feature, add more tests.

00:17:37.986 --> 00:17:43.186 align:middle
You don't have to do everything the first time.

00:17:43.406 --> 00:17:50.146 align:middle
Another fallacy is that it takes a lot of time.

00:17:50.316 --> 00:17:56.856 align:middle
That might be true for a first timer.

00:17:57.036 --> 00:17:58.816 align:middle
Because there is a cost of learning.

00:18:00.286 --> 00:18:05.026 align:middle
I mean, I guess, most of you that
had a car that are driving had

00:18:05.026 --> 00:18:07.286 align:middle
to go to school for driving, right?

00:18:07.286 --> 00:18:09.846 align:middle
It took like 20 to 40 hours.

00:18:10.226 --> 00:18:19.446 align:middle
Right? So, you don't take that into the
cost of every time you go to the shop.

00:18:19.446 --> 00:18:21.946 align:middle
Right? It's learning.

00:18:22.926 --> 00:18:28.896 align:middle
Yes when your first project, it's going to cost
you, your company, your product team, whatever.

00:18:29.276 --> 00:18:30.216 align:middle
But it's learning.

00:18:30.816 --> 00:18:31.656 align:middle
You wish don't learn.

00:18:36.516 --> 00:18:42.206 align:middle
It takes extra time writing
the code, writing the test.

00:18:42.676 --> 00:18:46.856 align:middle
Right? So, if I rock, if
I write 10 lines of code,

00:18:47.226 --> 00:18:49.996 align:middle
I need to write some lines of tests as well.

00:18:49.996 --> 00:18:52.156 align:middle
So, that takes time, right?

00:18:52.986 --> 00:18:56.866 align:middle
Manual testing takes time as
well because you have to Alt+Tab

00:18:56.866 --> 00:18:59.846 align:middle
or Ctrl+Tab something, check your browser.

00:19:00.446 --> 00:19:05.386 align:middle
So, if you write your tests
as you're writing your code,

00:19:05.946 --> 00:19:08.566 align:middle
you don't have to do that manual check.

00:19:09.076 --> 00:19:16.396 align:middle
You can just run the test and it will
tell you that, what you expected, works.

00:19:19.506 --> 00:19:27.186 align:middle
So, for some years I thought that if I
implement something that's ready for production,

00:19:27.466 --> 00:19:34.006 align:middle
let's say, you want to implement a new
social login or a new payment gateway

00:19:34.976 --> 00:19:42.386 align:middle
and you get one PHP file where you see
that it works, then that's it, right?

00:19:42.656 --> 00:19:48.276 align:middle
But actual feature lifecycle
is the part where you explore.

00:19:48.796 --> 00:19:50.766 align:middle
You look how that system works.

00:19:51.296 --> 00:19:53.376 align:middle
It could be a library, it
could be a new database,

00:19:53.376 --> 00:19:56.446 align:middle
it can be a third party integration,
it could be whatever.

00:19:56.596 --> 00:19:59.426 align:middle
That is the part where you don't test.

00:20:00.606 --> 00:20:05.966 align:middle
You should explore, you should enjoy,
you should understand what you're doing.

00:20:07.176 --> 00:20:08.596 align:middle
Then you start modeling.

00:20:09.776 --> 00:20:16.656 align:middle
Again, we're not testing, you're using tests
but you're not testing - you're modeling.

00:20:17.776 --> 00:20:21.836 align:middle
And this is a very confusing thing,
when I try to explain it to people.

00:20:22.636 --> 00:20:24.926 align:middle
If I'm writing tests, right?

00:20:25.726 --> 00:20:27.026 align:middle
How is that not testing?

00:20:28.256 --> 00:20:33.276 align:middle
So, if you are in a car, it doesn't
mean that you are the driver.

00:20:35.016 --> 00:20:40.886 align:middle
Okay? Uber and Taxi doesn't work that way.

00:20:41.046 --> 00:20:46.176 align:middle
Okay? So, yes you could be using
tests just like you use a car,

00:20:46.176 --> 00:20:49.126 align:middle
but that doesn't mean you're driving it.

00:20:51.476 --> 00:20:57.396 align:middle
The third part is development and
that's where testing needs to be done.

00:20:57.696 --> 00:20:58.476 align:middle
A lot of it.

00:20:58.966 --> 00:21:03.376 align:middle
Because you're not sure about all
of the edge cases that could happen.

00:21:04.076 --> 00:21:06.366 align:middle
Here tests have a great value.

00:21:07.566 --> 00:21:13.946 align:middle
And usually, when I go to
production, I delete some of the tests.

00:21:14.086 --> 00:21:17.906 align:middle
Because when I was writing
them in the previous phase,

00:21:18.496 --> 00:21:26.516 align:middle
I wasn't sure which of the tests will have
value later and I don't want my tests to run

00:21:26.586 --> 00:21:32.616 align:middle
for hours just because during the development
phase I wasn't sure if that can break or not.

00:21:33.506 --> 00:21:39.666 align:middle
I'm not saying delete all
of the tests, but be...

00:21:40.106 --> 00:21:44.796 align:middle
feel free to delete some of
those that you do not need.

00:21:45.796 --> 00:21:51.656 align:middle
100% code coverage is something
that I had a lot of problems with.

00:21:51.976 --> 00:21:54.136 align:middle
And I hear from the others.

00:21:58.896 --> 00:22:05.726 align:middle
If I don't check the code coverage, how
would I know if something is tested or not?

00:22:07.416 --> 00:22:12.766 align:middle
So you want to go and have 100 percent because
in that case you know your app is tested.

00:22:14.066 --> 00:22:21.196 align:middle
So, what usually people start is, well, let's
get the code coverage as high as we can,

00:22:21.436 --> 00:22:26.526 align:middle
as cheap as we can, which means
testing getters and setters.

00:22:31.496 --> 00:22:39.526 align:middle
It can be fun for like one or two
entities, five-ish is Ballmer's peak.

00:22:40.756 --> 00:22:42.876 align:middle
Oh, need of Ballmer's peak.

00:22:43.856 --> 00:22:48.446 align:middle
About 10 - I'm happy if everybody
doesn't quit their company.

00:22:50.456 --> 00:22:58.326 align:middle
So, should we test something like this?

00:22:58.526 --> 00:23:02.726 align:middle
I really don't see the value.

00:23:02.726 --> 00:23:06.456 align:middle
When I moved to using commands and
events, command and handler events,

00:23:06.456 --> 00:23:11.526 align:middle
command handler patterns, I
found that I spent a lot of time

00:23:11.526 --> 00:23:14.516 align:middle
on testing those setters
and getters, once again.

00:23:15.716 --> 00:23:20.886 align:middle
What now I usually do is if I do use code
coverage, I just put all of the commands

00:23:20.886 --> 00:23:23.096 align:middle
and event namespaces into ignore.

00:23:23.926 --> 00:23:24.926 align:middle
And I just don't care.

00:23:25.716 --> 00:23:32.456 align:middle
I want to achieve the higher percentage, but
I don't want to know about those DTO classes.

00:23:32.756 --> 00:23:39.076 align:middle
We have tests.

00:23:39.236 --> 00:23:43.306 align:middle
I've heard some people complaining
a few years ago about they wanted

00:23:43.306 --> 00:23:46.686 align:middle
to participate in open source project.

00:23:49.176 --> 00:23:54.786 align:middle
And they implemented the changes because
implementing those changes was rather easy,

00:23:55.456 --> 00:23:59.436 align:middle
but making all of the tests
work was the hard part.

00:24:01.136 --> 00:24:07.146 align:middle
You don't want you and your fellow
developers to be in the position that,

00:24:07.516 --> 00:24:11.056 align:middle
to change the code, is so
hard because of the tests.

00:24:11.596 --> 00:24:16.896 align:middle
Because people in that case will not test.

00:24:16.896 --> 00:24:21.946 align:middle
I mean if you have a car on the bottom
of a lake, what's the value of it?

00:24:23.876 --> 00:24:29.326 align:middle
I mean, and that most often comes
from: Let's write tests later,

00:24:31.816 --> 00:24:34.656 align:middle
which is most often coming from management.

00:24:35.136 --> 00:24:43.236 align:middle
And as a disgruntled developer, I might
come, I might build the whole feature.

00:24:43.296 --> 00:24:50.286 align:middle
I know everything works and before merging it,
my manager comes and says: where are the tests?

00:24:50.436 --> 00:24:52.016 align:middle
We're not merging that without tests?

00:24:52.786 --> 00:24:54.266 align:middle
No. Everything works.

00:24:54.926 --> 00:24:55.536 align:middle
I don't care.

00:24:55.536 --> 00:24:56.226 align:middle
Everything works.

00:24:56.556 --> 00:25:01.086 align:middle
No. You have to write those tests.

00:25:01.236 --> 00:25:02.136 align:middle
What do you think?

00:25:02.136 --> 00:25:04.846 align:middle
What kind of tests am I going to write?

00:25:04.846 --> 00:25:08.216 align:middle
I'm just going to look.

00:25:08.526 --> 00:25:09.806 align:middle
I'm going to split my screen.

00:25:10.406 --> 00:25:14.656 align:middle
I'm just going to look at the code on the
left side and replicate it on the right side.

00:25:15.656 --> 00:25:17.346 align:middle
Because that's going to get shit done.

00:25:19.536 --> 00:25:28.346 align:middle
So, yea, I'm just gonna add a
simple case for this, maybe.

00:25:30.976 --> 00:25:36.566 align:middle
Who here knows what TDD is?

00:25:37.746 --> 00:25:39.526 align:middle
Anybody practicing it?

00:25:40.516 --> 00:25:52.356 align:middle
Okay. If I say, if I say test
driven development - is that TDD?

00:25:52.446 --> 00:25:54.136 align:middle
No, sorry, another loaded question.

00:25:55.396 --> 00:25:56.966 align:middle
Test driven design.

00:25:57.526 --> 00:26:01.796 align:middle
Not development, design.

00:26:02.506 --> 00:26:08.446 align:middle
You're supposed to use TDD to build
your architecture, to model it.

00:26:09.996 --> 00:26:15.546 align:middle
You can write your tests first and
then your code - that's not TDD.

00:26:16.726 --> 00:26:23.476 align:middle
TDD is that small red, green, refactor,
red, green, refactor, red, green, refactor.

00:26:26.556 --> 00:26:31.886 align:middle
Anybody's remembering this tweet?

00:26:32.066 --> 00:26:34.906 align:middle
Anybody's remembering the
shit storm coming after it?

00:26:36.176 --> 00:26:39.796 align:middle
Where everybody came with: Haha,
you see, testing makes no sense.

00:26:40.356 --> 00:26:41.946 align:middle
You shouldn't test anytime.

00:26:42.446 --> 00:26:45.366 align:middle
Why were you forcing me to test?

00:26:45.366 --> 00:26:50.456 align:middle
People don't understand the TDD and
testing are completely different things.

00:26:50.826 --> 00:26:55.846 align:middle
Uh, do you all know who DHH is?

00:26:57.136 --> 00:26:59.336 align:middle
So, he's an author of Ruby on Rails framework.

00:27:00.256 --> 00:27:05.786 align:middle
He works for a small company called
Basecamp, used to be called 37 signals

00:27:05.786 --> 00:27:10.936 align:middle
and they have a few small products, really,
really small products, really cool products,

00:27:11.006 --> 00:27:15.796 align:middle
but really, really small products, that they
have been building for about 10 or 15 years.

00:27:16.976 --> 00:27:21.866 align:middle
What kind of modeling would they need
when they know what they're doing?

00:27:22.356 --> 00:27:26.146 align:middle
There's no modeling in it.

00:27:27.076 --> 00:27:30.406 align:middle
They just need to test that
what they want works.

00:27:31.186 --> 00:27:32.606 align:middle
It's not really modeling.

00:27:33.206 --> 00:27:38.436 align:middle
And, just to try to explain to you, that's
one of the rare companies that would come

00:27:38.436 --> 00:27:44.116 align:middle
to their clients, when they would
ask for features, they told them: No.

00:27:45.176 --> 00:27:49.346 align:middle
We have our product, we love
it, as simple as it is.

00:27:49.856 --> 00:27:52.466 align:middle
If you want more features - use Jira.

00:27:52.466 --> 00:27:53.896 align:middle
Use this, use that.

00:27:54.386 --> 00:27:54.826 align:middle
Thank you.

00:27:54.936 --> 00:27:55.626 align:middle
Here's the door.

00:27:58.156 --> 00:28:03.306 align:middle
So, don't forget the environment
that this comes from.

00:28:03.856 --> 00:28:06.596 align:middle
They don't build that many features.

00:28:11.496 --> 00:28:18.996 align:middle
If you ever looked into TDD, one of the things
that even the people who invented it said,

00:28:18.996 --> 00:28:21.046 align:middle
you have to do everything the TDD way.

00:28:21.046 --> 00:28:28.966 align:middle
Only in the last few years they
started saying: Well, we were wrong.

00:28:29.176 --> 00:28:35.466 align:middle
Because trying to build everything
TDD way takes a lot of time.

00:28:35.976 --> 00:28:42.426 align:middle
And if you're yet another payment gateway,
yet another CMS, yet another E-commerce

00:28:42.686 --> 00:28:47.496 align:middle
and you know how everything has to look,
what part of modeling do you have to do?

00:28:48.426 --> 00:28:50.236 align:middle
It's yet another house.

00:28:51.916 --> 00:28:55.456 align:middle
Maybe has another color, but that's about it.

00:29:00.056 --> 00:29:04.956 align:middle
I'm going to guess that some of you
changed the company a few times.

00:29:05.386 --> 00:29:07.646 align:middle
Have you ever come...

00:29:07.906 --> 00:29:15.886 align:middle
have you ever changed it to
company that has good tests?

00:29:16.046 --> 00:29:17.126 align:middle
Whoa. Really?

00:29:17.626 --> 00:29:19.446 align:middle
Wow. Three hands.

00:29:21.436 --> 00:29:33.766 align:middle
Wow. So, my previous employer had such a great
coverage that I started shipping the next day.

00:29:34.256 --> 00:29:37.086 align:middle
I came on Monday and started working on Tuesday.

00:29:37.236 --> 00:29:45.626 align:middle
Because it was easy to onboard me because
I could have gone through the tests

00:29:45.956 --> 00:29:51.216 align:middle
to understand what and why are things
happening and even if I screw it up,

00:29:51.926 --> 00:29:58.806 align:middle
because it's my second day, people, the
CI says: Hey, this doesn't work anymore.

00:30:01.846 --> 00:30:07.476 align:middle
It's much easier to add new features because
you know that you didn't break older ones.

00:30:08.706 --> 00:30:11.306 align:middle
You know that the older ones still work.

00:30:11.826 --> 00:30:17.436 align:middle
So, what do we had?

00:30:17.736 --> 00:30:19.776 align:middle
This, the previous exam?

00:30:20.416 --> 00:30:21.166 align:middle
We know this suck.

00:30:21.166 --> 00:30:22.936 align:middle
We have to add a feature now.

00:30:25.236 --> 00:30:31.716 align:middle
The feature is that if you're not from, um, from
that European Union country, I'm using Portugal

00:30:31.716 --> 00:30:38.316 align:middle
since we're here, you shouldn't
charge a VAT if it's a company.

00:30:38.386 --> 00:30:43.266 align:middle
So, maybe this is the point
where you should test.

00:30:43.456 --> 00:30:49.266 align:middle
Switching from rather simple if, to another.

00:30:53.736 --> 00:30:55.916 align:middle
What if you have to refactor something?

00:30:56.726 --> 00:30:58.136 align:middle
So you have all of your tests.

00:30:58.376 --> 00:31:03.216 align:middle
They run, you just change the code and all
of your tests say: Hey, it still works.

00:31:03.376 --> 00:31:03.926 align:middle
Still works.

00:31:04.216 --> 00:31:06.406 align:middle
It's okay, everything's good.

00:31:08.676 --> 00:31:17.606 align:middle
So let's make this bit more
readable to avoid nested ifs.

00:31:18.186 --> 00:31:20.686 align:middle
So this is what happened.

00:31:21.116 --> 00:31:22.506 align:middle
This is what I have.

00:31:23.316 --> 00:31:25.466 align:middle
Can anybody spot the bug?

00:31:27.276 --> 00:31:27.946 align:middle
Where? Here?

00:31:27.946 --> 00:31:45.986 align:middle
Nope. You always have to
charge VAT for that country

00:31:46.256 --> 00:31:49.716 align:middle
if you're selling something in your country.

00:31:50.216 --> 00:31:53.186 align:middle
Any others?

00:31:54.386 --> 00:32:12.186 align:middle
So, I just wasted two minutes of your life
trying to understand if this was okay or not.

00:32:13.796 --> 00:32:22.336 align:middle
So if we had tests for this,
you don't have to look at this.

00:32:22.816 --> 00:32:25.376 align:middle
You know it works.

00:32:25.726 --> 00:32:28.946 align:middle
It's easier to rewrite things.

00:32:28.946 --> 00:32:50.486 align:middle
And running tests means that we can
do some fun while they're running.

00:32:50.486 --> 00:33:00.176 align:middle
I mean at least for us in PHP world
because we don't have compile times,

00:33:01.176 --> 00:33:04.306 align:middle
which I'm something that I'm actually missing.

00:33:04.386 --> 00:33:05.926 align:middle
But that's a long story.

00:33:07.016 --> 00:33:08.386 align:middle
Cleaner code.

00:33:09.596 --> 00:33:15.556 align:middle
Trust me, it's really hard to test shitty code.

00:33:16.516 --> 00:33:22.586 align:middle
If you write your tests as you're writing
your code, you'll will write cleaner code.

00:33:23.746 --> 00:33:32.166 align:middle
Because for a 15 line code, 15 lines of
code, you might have 300 lines of test.

00:33:32.816 --> 00:33:36.376 align:middle
And then you add an if, which means 600.

00:33:40.236 --> 00:33:43.066 align:middle
But maybe if you're building a small app,

00:33:43.486 --> 00:33:48.096 align:middle
something that you have built
often and that you understand.

00:33:49.446 --> 00:33:52.876 align:middle
I don't think that testing brings any value.

00:33:53.386 --> 00:34:01.486 align:middle
Let's say you are bringing,
you're building a one-off app.

00:34:01.756 --> 00:34:04.716 align:middle
Again, you can easily manually test it.

00:34:05.446 --> 00:34:06.046 align:middle
That's okay.

00:34:06.876 --> 00:34:17.386 align:middle
You know it works, but what happens a lot
is, that simple app becomes a bigger one

00:34:17.746 --> 00:34:19.256 align:middle
and a bigger one and a bigger one.

00:34:20.286 --> 00:34:26.516 align:middle
When that one-off app for one concert in
Lisbon becomes an app for all the concerts

00:34:26.516 --> 00:34:30.336 align:middle
of that group in the world or
all the concerts in the world

00:34:30.336 --> 00:34:34.706 align:middle
for every group, you can't
use the same thinking.

00:34:35.936 --> 00:34:40.446 align:middle
When you're exploring something, if you're
trying to learn a new language, a new library,

00:34:40.446 --> 00:34:46.106 align:middle
a new framework, a new something
- don't waste time testing.

00:34:46.726 --> 00:34:50.376 align:middle
Enjoy it, learn how to use it.

00:34:50.616 --> 00:34:57.906 align:middle
Last but not least: job security.

00:34:59.616 --> 00:35:06.246 align:middle
If you're a key person in your company and
you have no tests, you cannot be fired.

00:35:08.196 --> 00:35:13.366 align:middle
You can ask for whatever
you want - you'll get it.

00:35:14.156 --> 00:35:18.886 align:middle
I want a new car, I want the best Mac,
I want 5 month vacation - you'll get it.

00:35:20.206 --> 00:35:28.786 align:middle
What people keep forgetting is that at
some point they might look for another job

00:35:29.706 --> 00:35:33.666 align:middle
because they're not happy where they
are or they have to move to another city

00:35:34.356 --> 00:35:40.276 align:middle
or they get the shitty manager because their
previous one decided to go somewhere else.

00:35:41.936 --> 00:35:46.606 align:middle
You will not find a senior position that says

00:35:47.616 --> 00:35:52.826 align:middle
that doesn't have listed testing
experience, testing knowledge.

00:35:53.206 --> 00:36:00.526 align:middle
I didn't trust people when they started telling
me that 6-7 years ago, but for last 3 years,

00:36:00.786 --> 00:36:06.866 align:middle
no senior position ad that I saw,
came without testing experience.

00:36:07.346 --> 00:36:13.226 align:middle
So, it's gonna be really, really
hard to move to find a new job

00:36:13.226 --> 00:36:17.916 align:middle
and it's just getting worse and worse and worse.

00:36:19.716 --> 00:36:24.646 align:middle
So if you're like, my grandma
had a few chickens.

00:36:24.996 --> 00:36:29.096 align:middle
No fancy lab to test them.

00:36:29.346 --> 00:36:38.126 align:middle
Please, don't think that you can use the
same principles to have a chicken farm.

00:36:50.706 --> 00:36:54.156 align:middle
It's different mindset.

00:36:54.156 --> 00:36:54.576 align:middle
Thank you.

