1
00:00:01,320 --> 00:00:05,340
Well done for completing today's course and challenges.

2
00:00:05,970 --> 00:00:14,430
Now, one of the questions I often see students ask in the Q&A is, "Okay, so I've written this code,

3
00:00:14,430 --> 00:00:18,120
this is my solution, but what's the right solution?"

4
00:00:18,750 --> 00:00:21,750
And this is something that I want to talk about today.

5
00:00:22,700 --> 00:00:28,500
And the really important thing for you to understand is that there is no right solution.

6
00:00:28,850 --> 00:00:30,310
It is your solution.

7
00:00:30,320 --> 00:00:34,220
It's about your thinking process and how you got there.

8
00:00:35,180 --> 00:00:41,390
And when you're looking at the solution, when you're looking at your code, the most important thing

9
00:00:41,390 --> 00:00:46,910
is not how fast does it run, or how few lines of code you use,

10
00:00:47,090 --> 00:00:48,530
how efficient is the code.

11
00:00:49,310 --> 00:00:55,940
To quote the godfather of computer programming, Donald Knuth, the guy who wrote The Art of Computer

12
00:00:55,940 --> 00:01:04,129
Science and many other books that are super influential, super hard to understand, but what he says is

13
00:01:04,700 --> 00:01:05,510
premature

14
00:01:05,510 --> 00:01:08,670
optimization is not a great thing.

15
00:01:09,140 --> 00:01:13,320
Don't try to make your code the most efficient as possible.

16
00:01:13,790 --> 00:01:17,080
Instead, what you should aim for is readability.

17
00:01:17,630 --> 00:01:23,750
So if another programmer comes along, if another student takes a look at your code, can they understand

18
00:01:23,750 --> 00:01:26,870
what you did immediately without a lot of effort?

19
00:01:27,290 --> 00:01:30,070
Well, if that's true, then you've succeeded.

20
00:01:30,470 --> 00:01:31,670
That is the goal.

21
00:01:31,680 --> 00:01:36,000
That is the bar that you should measure your code by. Now,

22
00:01:36,020 --> 00:01:42,470
when I was in university and I had to write a lot of essays, especially during the year when I was

23
00:01:42,470 --> 00:01:51,230
doing neuroscience as a degree, and when I first started writing essays, I thought, "You know what?

24
00:01:51,590 --> 00:01:54,380
Good essays are ones with big words.

25
00:01:54,380 --> 00:01:59,120
They're the ones with like, you know, the ones in the dictionary that like nobody ever uses."

26
00:01:59,660 --> 00:02:01,870
And they had to be really complex.

27
00:02:01,880 --> 00:02:03,620
It made me sound super smart.

28
00:02:04,460 --> 00:02:12,290
But then I had a professor who was somebody who really was very influential in my life.

29
00:02:12,290 --> 00:02:14,780
And he took one look at my essay and says,

30
00:02:15,880 --> 00:02:23,740
"This is not how you write. You write so that other people understand what you're trying to say."

31
00:02:25,070 --> 00:02:31,490
And it's actually the same thing with code. It's not about writing big words, it's not about shortening

32
00:02:31,490 --> 00:02:40,700
your code to the shortest number of lines. It's about making your code expressive, readable and as easily

33
00:02:40,700 --> 00:02:43,370
understood by as many people as possible.

34
00:02:44,420 --> 00:02:49,550
Once you've gotten there, eventually, you know, once you become a senior developer, you'll have

35
00:02:49,550 --> 00:02:57,350
your own ideas about style and syntax. But at this stage, optimize for readability.

