text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
so it's not wrong but this is again
7,804.639
5.56
evidence of maybe bad design not so much
7,806.76
5.959
with this small program but this is an
7,810.199
4.081
example again of code smell like
7,812.719
3.121
something smells a little off here like
7,814.28
2.76
this is probably going to get us in
7,815.84
4
trouble by separating related
7,817.04
4.679
functionality so again it's a design
7,819.84
4.96
principle not a correctness concern but
7,821.719
5.48
class methods allow us to address this
7,824.8
4.839
too let me go ahead and do this I'm
7,827.199
4.201
going to delete get student alog
7,829.639
4.801
together leaving only main as my other
7,831.4
5.48
function here and inside of my student
7,834.44
4.759
class I'm going to do this I'm going to
7,836.88
4.44
define a function even more simply
7,839.199
5.081
called get and by nature of how class
7,841.32
4.72
methods work it's going to take in the
7,844.28
3.799
name of the class itself or reference
7,846.04
4.159
there too as an argument and I'm going
7,848.079
3.721
to move the functionality from get
7,850.199
3.4
student into the student class and I'm
7,851.8
4.68
going to do this name equals input quote
7,853.599
6.161
unquote name uh house equals input quote
7,856.48
6.52
unquote house and then what this
7,859.76
7.08
function is going to do is return a new
7,863
7.119
student object by calling class which
7,866.84
6.04
again is just an automatically passed in
7,870.119
5.801
reference to the class itself passing in
7,872.88
6.199
name and house and I will admit this
7,875.92
5.48
syntax seems a little strange that now
7,879.079
4.721
I'm calling CLS and I'm passing in these
7,881.4
4.12
arguments but let me do one final fix
7,883.8
3.399
here let me go to the top of this
7,885.52
3.88
function and more explicitly say this is
7,887.199
5.161
a class method this solves a potential
7,889.4
4.92
chicken in the egg problem so to speak
7,892.36
4
whereby one needs to come before the
7,894.32
4.16
other potentially so what am I doing
7,896.36
5.279
here inside of my student class I now
7,898.48
6.36
have a function called get it is I shall
7,901.639
5.6
claim a class method what does that mean
7,904.84
5.399
it just means I can call this method
7,907.239
6.121
without instantiating a student object
7,910.239
5.44
first there in lies the potential
7,913.36
4.08
Chicken and the Egg problem and if
7,915.679
3.48
unfamiliar that's an expression meaning
7,917.44
3.92
well did the world have chickens first
7,919.159
4.201
that laid eggs or was there an egg that
7,921.36
4.56
then Bor uh yielded the chickens but how
7,923.36
4.08
did the egg get there it's this sort of
7,925.92
3.04
weird circular problem and that's what
7,927.44
4.159
we're facing here it would be weird if
7,928.96
5.84
you had to create a student object in
7,931.599
6.08
order to call get in order to get
7,934.8
5.319
another student object like that sounds
7,937.679
6.241
messy let's just get a student via a
7,940.119
6.281
class method that by definition does not
7,943.92
4.679
require you to create a student object
7,946.4
4.159
first just like the Hat in its final
7,948.599
5.241
form we use the Hat class to just say
7,950.559
5.761
hat Capital h.s sort we didn't need to
7,953.84
4.2
create a hat first we just used the
7,956.32
4.279
class itself so what am I going to do
7,958.04
5.199
here now let me go down to Main and
7,960.599
4.921
instead of saying get student notice
7,963.239
5.92
what I can now do student. get and
7,965.52
6.44
everything else can stay the same all
7,969.159
5.641
I've done now is I've migrated all of my
7,971.96
4.84
logic from get student which was this
7,974.8
4.319
own Standalone function but clearly
7,976.8
5.08
related to students by name I've moved
7,979.119
6.52
the same code really to inside of the
7,981.88
6.319
student class in a more simply named
7,985.639
4.201
function called get but I could still
7,988.199
3.321
call it get student if I want it just
7,989.84
3.48
sees a little redundant to call it get
7,991.52
3.599
student in a student class so I'm
7,993.32
4.16
simplifying so I have a method called
7,995.119
5.12
get but I'm calling it a class method to
7,997.48
4.88
avoid that chicken in the egg problem I
8,000.239
4.88
want to be able to call get without
8,002.36
5.52
having a student object in my universe
8,005.119
5.881
already and the Syntax for that is at
8,007.88
5.679
class method the convention is to give
8,011
4.36
this method at least one argument by
8,013.559
4.281
convention called CLS for class which is
8,015.36
3.6
just going to be a reference to the
8,017.84
3.719
class itself lines 11 and 12 are
8,018.96
4.36
identical to what they've always been
8,021.559
4.401
and get student the only new syntax here
8,023.32
4.68
is this but this again is one of the
8,025.96
4.52
features of object-oriented programming
8,028
4.32
you can now
8,030.48
5.04
instantiate a student object by just
8,032.32
6.279
using CLS that's passed in I technically
8,035.52
5.36
could use student capital S but it turns
8,038.599
4.12
out I'm doing what's more conventional
8,040.88
3.759
because this will both solve and avoid
8,042.719
3.4
problems down the line with more
8,044.639
4