
Transcript
0:00 · all right sorry this is only part one and it’s uh well anyone who was here the very first boost gone yeah there’s like three people for sure because you’ve been to every one yes uh Jeff and Zach and and Marshall and of course they’re not even my friends anymore they went to the other tuck um so thank you one I got one friend
0:28 · that’s good um this is still the best talk uh I mean the whole conference has gone downhill this was like oh you know the first year keynote still the best talk uh you can’t find it online um this is one you can find a sort of version of it online but you can’t find the original um so don’t go watch it right now um but like it was such a good talk that like the whole audience was talking after and it was all about value semantics and everything and uh Dave
0:55 · Abraham’s as you can imagine you know asked was asking questions as he does and he’s like how do you teach this stuff right and that turned into a whole nother conversation and it’s only been 14 years but like this is the start of my answer to how you teach this stuff um and it’s just the start and this was really bad idea don’t go compare my talk to Sean’s like just forget that I mentioned the really good talk but it is the start of you know my answer to this so Sean tends to call it um value
1:26 · semantics and stuff I like to call it value-oriented programming um but it turns out to talk about value-oriented programming I’d only want to talk about values first I want to talk about talk about functions first so we’ll kind of talk about values and objects a little bit but mostly I just want to talk about functions and you know somewhere I had a little Clicker where did I put my clicker oh well
1:47 · right there does it work is it on all right sorry this was that was the uh you know there’s an extra hidden reference in the four dots there I couldn’t decide what colors to use until like yeah you just the point is that you know there’s gonna be a lot of references in in the slides um so um we know the lyrics now right you say you want to write a function well you
2:19 · know oh man I screwed it up now that is a lie it’s Chili Peppers right you don’t want to write a function no one wants the right function you got some code right you’ve already got a function you’ve got a whole bunch of functions and you just want to change the code right you want to add a feature you want to fix a bug you don’t want to you don’t want to write a function you just want to like add an if statement right stick
2:45 · an if statement in there you know like oh I really need to know uh you know this projector is facing north or something so um why do I need to know that who knows but um you know we just get the projector’s orientation from its pose and then it’s like yeah pitch roll or quaternions or whatever you use for your orientation lots of things you could use uh don’t use your pitch roll but that’s what we use it’s the wrong answer
3:09 · um and then you know you might be like North is zero and you want to be like five degrees within North you know close enough to North and you’re like okay this works this fixes my bug and then like a few weeks later it’s like oh wait could be five degrees the other way from North you know that’s okay okay this is all working and then you know if you were you know half decent program maybe you wouldn’t repeat those lines of code and you’d put a variable in but yeah you’re not going to do that right you’re just gonna like cut and paste the code um and then at some point uh you know oh these older projectors they need you
3:41 · know higher tolerance for North um so we got that and uh what is the I can’t even remember what this code we’re smarter than this that’s that’s what that that’s that’s the quote there um and uh Anakin says apparently not
4:01 · um so you know Kate Gregory had a really good talk at CVP North last year you know am I a good programmer and after a while I started to question it right it’s like how did this code get to look it’s it’s not a lot of code right but it’s still already getting ugly I think you know are we the Baddies and so how do we get here right like we
4:21 · got here in 10 seconds on slides but this happens over time like the code just slowly evolves and everyone comes in and just adds one more line to the code and the code just gets longer and longer so we got here one step at a time and um there’s this thing called complecting right and let me explain no there’s not enough time let me sum up
4:47 · those are my the exact words I got that quote right I didn’t get the accent sorry um so complecting uh was a talk by Rich hickey called Simple made easy and simple he likes to go whenever he uses words he likes to Define them go back to Latin and stuff like that simple uh and complex both come from the word plecto and Latin which means to fold our braid like that over there so simple is single fold right can
5:16 · complex as many folds right and easy is a Json it’s like adjacent that’s where it comes from and it means close at hand right it’s right here so simple made easy and complecting is the process of interweaving right and I love that word so I see it all the time in code it’s like you’ve complected our code you’ve entwined it all together
5:41 · and I do the talk I did a lightning talk last two years ago I guess on conflicting made easy because it’s so easy to complect your code it’s what you do naturally right this is what happened you know we just made the code worse but it was the natural and easiest thing to do it’s easier to write this code than to write a function so complecting Made Easy is because almost every step of the way the easiest thing to do makes your code worse
6:07 · like it’s not hard to write a function but it’s harder than not writing a function like even this this is easier than you know making a variable you’re just like I just cut and paste that code over again that’s easier
6:22 · so not writing a function is easier than writing a function that’s why writing a function is a lot you don’t want to write function all right so what are we gonna do about this you know we got this uh we got this if statement here let’s copy this if statement or this comment put some underscores on it put some brackets at the end syntax this baby up right
6:49 · and then we got this right this is like that’s it is actually not that hard to write a function and then we can just remove the comment right well we’ll get to the code but what
7:04 · about the comment not needed anymore yeah but you can you conflated two things in that right because you had all this logic about serial numbers and stuff that has nothing to do with no that’s a good point it’s a good point um but also yeah I wanted this part right like we took away the comment I still don’t know why we’re checking for North right it’s like yeah it’s obvious so we’re gonna check for north and I don’t know why
7:32 · it’s my favorite comment word is otherwise uh I worked with a guy when I was at Adobe and then we both went our separate ways and like five years later he sent me an email saying thanks for otherwise like he’s like I use this now and people you know thank me for my comments and I was like go to the blue like I hadn’t talked to him for five years that was that was it it’s emailed just about that like cool
7:53 · um so my reason might be because I you know don’t have a good talk example it’s all I had um but whatever by the way you know I always like talk about naming uh you don’t need to say projector right it is a projector so it’s kind of obvious
8:09 · like string you don’t say string from it you should say two string you have to put parameter types in the return but not in the you know you need the return type in your function name sometimes but you don’t need the parameter types in your function names well yeah C right I mean this is C plus plus now we’re we’re writing in C plus plus now
8:39 · it kind of fits on it um so there’s our function put it over there um maybe there’s some you know some some things you don’t like of of the cut the cutting line I I’ve been thinking about um writing another uh talk on this where it’s all about the cutting point between two pieces of code and how do you separate and then I would have to do it all in haiku cutting points I you know I might do it um oh well speaking of
9:11 · you know I don’t know sort of related Asian something something I don’t know um Far East uh Cohen’s right everyone know what a Cohen is it’s like a short story it’s it’s from like Zen Buddhism and stuff a short story that uh you know Enlightenment at the end of the short story so um I had a you know not me not me it’s totally not about me um uh the the Padawan uh was asking the you
9:37 · know Sensei um how do I read the config file I need I need to read you know something under the config file how do I do that and the sense I said well there’s a function for that right and so the Padawan was like well what’s what’s the function what’s it called well guess what do you think the function is called
9:55 · man guys good free config file right uh you know maybe other times the config’s not a file I don’t know the file part we can argue about that part but reconfig right and uh the Sensei was like yeah that’s great you should have to pass the file name in right it’s like it’s like okay well how do I get the file name like what’s the path to the file name there’s a function for that of course there’s a function for that too and the pattern was like just to get the config path there’s a function for that so yeah so is it like reconfig file get config
10:25 · file path is that is that what I need to write and uh you know the Sensei is like yes the code is true it didn’t compile but Sensei was gone Enlightenment anyone what’s what’s where’s the enlightenment in this story would you be like English yeah Why didn’t it compile you should
10:50 · write those functions so they compiles yeah the functions don’t exist these functions don’t exist yet but you know convince the uh battle on that yes also this is a race condition thank you it’s a race condition yes I’m sure it is Tony was enlightened yeah uh
11:13 · there is a function for that but there would be or there will be yeah but that’s how you gain Enlightenment if he just gives you the answer you have to go through the pain right you’re like what’s going on here and then the story sinks in all all good coins like you have to feel
11:32 · the pain of the Cohen otherwise it doesn’t stick um so functions are the answers to questions right this is so often in code you’re like ah you know is this predictor facing north you know it’s like well you know write the function you want to see in the world okay you wanted a function for that just yeah just write it if it doesn’t already exist um you know just imagine like oh this would be so much easier if I only had this function
12:02 · um so you know there’s a function that we needed um and basically this is like you know however decades old you know top-down programming there’s no nothing too exciting here um oh another Cohen so in this one uh the master was out
12:21 · walking his dog you know as as they do he or she sorry uh master was out walking their dog and um they decided to stop by on a student right and the student was like oh master I’m so I’m so uh delighted that you came to visit me and I’m honored that you came to visit me and master’s like ah you know I was just out walking my dog yeah by the way well now that I’m here uh your function why does it take big common struck instead of just X and Y right and uh the Padawan was like oh big
12:52 · common struck is where we keep X and Y master and then the dog park it’s like ah don’t worry about the dog you know he’s hungry you know don’t worry about and of course the student was like Wow Master please let me prepare A Feast for your dog like I would be honored to pair a piece for your dog and he’s like no just open the fridge let him take what he wants
13:18 · any well the thing I forgot to mention by the way like this one’s a very old uh cone I don’t know where these come from but uh we found that uh almost all of them all especially the old ones were 140 characters exactly and all the new ones a lot of new ones are 280 characters exactly um any Enlightenment here yeah yeah yeah yeah yeah I think like you
13:45 · know good thanks I didn’t think it was you know I’m kind of hammering in in kind of hard there um so this function takes a projector and it grabs like two things out of out of the projector right it’s like it didn’t need a projector and if you give it a projector eventually someone’s gonna call like show video in is facing north and the
14:04 · sad part is they’ll do it for a good reason right it’ll be like yeah that fixes whatever like why does that fix whatever but it fixes the thing but still it’s like it probably shouldn’t have been there I mean maybe maybe you needed to call that up here like maybe you don’t always need to call show video but in this very important function you know it’s probably not the right right place for this but you made it easy right complecting Made Easy you had the function it was right there just call it bam your bug is fixed and off you go
14:33 · it was close at hand the projector was right there for you to use and worse uh in our code base we have a class called model and model is the world it is everything in model it is actually the only class in our code base in all caps like you have to yell it
14:50 · when you talk about model right it’s like model like this you know and it is it’s you know you end up with the document class it is the document class that holds on to everything but everyone has a pointer to it right it’s like you get a model pointer and you get a model pointer so you know nothing more easy than that
15:07 · if you’ve got a pointer and a model you can do anything you want because you’ve got access to the whole world um so it turns out like if you have a projector you also might have model because we also have back pointers to half the things right and and then you’ve got the whole world close at hand and you have like oh I really needed a Palpatine you know ultimate power unlimited power you know GIF I used to have one um all right
15:35 · so you know we could just pass instead of passing projector into this function we could just pass an orientation and a tolerance right it’s like is this thing close to North that’s all you need to know right and that forms a barrier to complecting right if you have to fix something you might realize you should fix it over here instead of fixing it over there right there you go and maybe you will
16:01 · have to fix it there and maybe you have to pass another parameter or you know things happen but there’s a good chance that it will turn you in the right direction instead of falling into the wrong direction and you know this side of the code has gotten slightly bigger you know not a
16:17 · big deal but slightly bigger uh if you want why not both you can have your is facing north projector but handles the projector stuff because this is very top down right like the problem that you had was like I need to know if this projector’s facing north so you wrote the function is this projector facing north um but what you can do is write top down on the way down and bottom up on the way back up after you’ve written a function you realize it only needs an orientation and tolerance so change the function to take
16:46 · an orientation tolerance and work your way back up either have the wrapper or just change the you know pass the two parameters over here right um and what happens is a lot of people do the top down and they don’t do the way back up so you end up with passing too much stuff into your code
17:06 · and you know uh that’s yeah top down the way down you just end up with this and you got the collecting Made Easy and on the way back up you get rid of that you at least limit it you’ve limited it to a over there but this function is kind of nice and works on its own and you can use it for other things keep your stuff separate it’s the new kiss
17:33 · let’s go I’m going really fast just let’s just gonna sit here for a minute I’m Tony yes I’m sorry but uh there was a five in that two yeah and like that five is terrible we can’t let that go all right I mean the five is there because it fit on the slides okay right but it’s like it just came out of the air obviously yeah yeah uh because I
17:57 · didn’t even check the project yeah I’ve lost that whole story of the projector type okay so you know maybe that does maybe that’s why you have two versions maybe that does go over here um you know it’s it’s it’s such a you know uh what’s the word I’m looking for um artificial example right so it’s kind of hard to say what’s the right way to go with it
18:24 · um what you know this is the point where we can actually talk about values and objects right I up to now I just been saying projector but projector is probably not a value type projector is probably a pointer or a reference or something it’s a big class like it’d be great if like just passing a projector into a function created another projector that would like my company would love that right just like projectors coming out of everywhere um we’d make millions uh but it’s really hard to copy a projector so projector is probably a an object but
18:59 · orientation and tolerance they’re just numbers or orientation is like three or four numbers um and you just treat them like values right so I would like to you know my next talk will be explaining the difference between values and objects but that’s it like you already know the difference between values and objects values you don’t care about you basically don’t care about the identity like the the address um uh uh Rich hickey uh calls it um
19:26 · plop Place oriented programming because it’s like the projector you know has a fixed address and you care about that you care about the values at that address whereas Direction and orientation intolerance you don’t care about where they’re being held you just care about the internals of the of the value or object or whatever you want to call it I mean in C plus plus everything’s in like those are called objects in the standard but I don’t call those objects
19:54 · so also the bottom function you can test it’s safer you don’t have like a dangling pointer um it just you know it’s local it’s just like you can just stare at that one function decide if it does what it’s supposed to do and you don’t have to know anything else about anything to to test and understand that function
20:19 · all right so this is if you want money for brands with all that state right don’t pass in a co-pilot state that you don’t need to pass it into your function I mean you have to wait like forever because I’m just never gonna accept it all right um like I said this is Valiant or programming but it’s about functions not values uh this is what people think of
20:44 · functions right kind of that model or that model what’s the difference between those two conceptual models of a function yeah it’s rotating all right all right anything else
21:12 · I mean it all depends if you guys know uh Dr Seuss right this is from Dr Seuss right this one takes Sneetches obviously and modifies The Sneetches and then you get stitches with stars on them it’s a star on the sheen everyone big Dr Seuss fans are just me um and the other one takes an input produces an output but like 17 is always 17.
21:38 · you can count on it it’s a number you can count on it um so 17 never changes you just get a new value out right where is this you know you’re putting something in you’re changing it you’re modifying it
21:54 · so um there’s a book called rocking Simplicity and it’s all about functional programming um by Eric Norman uh he it’s not exact quote I’ve kind of like compressed this quote into four words separate calculating from doing right calculating tends to look like that over there on the right you just take some values you produce an answer and doing is when you actually take that answer and you know store it in your data structure or modify your snitch or whatever
22:24 · so if we were to put a star on function machine on our Sneetches you know we have to measure the sneech we got to find the belly calculate star positions and then apply Stars onto the snitch oh by the way if you’re still writing functions that return void now you ain’t gonna make it with anyone anyhow um I think returning void is a code smell right I mean obviously there’s going to be a fair number of functions that return void but when I see it I stop and think uh whether you know I it is to me
22:54 · it’s a coat smell at least enough to look and see uh what’s going on in this function so the first three steps of this function are are calculating right you don’t modify anything you let’s see you do this right if you call uh some function that calculates where
23:13 · to put the stars on the snitch and then you get a vector of locations and then you actually put the stars on the sneak on The Sneetches and that calculates start position um is a nice pure function that takes some values and returns some answers and by the way you probably don’t need the whole snitch in that function I should make my own advice you probably just pass the sneaks geometry or some subset of the snitch that you need to know to calculate start positions
23:39 · and then you get your stars and you apply them so um the first function is pure right and this is the conference where we could nitpick what that means let’s not do that um but um you know this is kind of from the Wikipedia definition and um if we wanted to nitpick it we would nitpick uh what does same mean and what
24:05 · does no side effects mean because no side effects you could have like an internal cash or something which no one ever sees the side effect of that unless it’s threaded then you you know but let’s just think of pure functions as they take values they modify nothing and then return an answer nicest functions
24:23 · and because with that that pure functions you can do local reasoning on the function you just have to look at this function you don’t have to understand the whole world of your code base right I can just look at calculate star positions obviously I have to know something about Sneetches or the geometry of Sneetches but I can understand that function I can test that function and I don’t have to worry about anything else and I can test that function without actual you know physical sneeches
24:51 · probably whereas the apply snitch you know might actually change the real stage right because I I actually my code base is actually weird because projectors and cameras like a lot of objects in object-oriented
25:07 · programming or in any kind of code base like if if you’re writing PowerPoint or something you have slides those are objects yeah but they live in memory on your computer my projector objects don’t even live in the computer they’re physical objects you know up there so sometimes you know
25:25 · actually apply thing is changing the physical universe um you know is facing north is a nice pure function you can do local reasoning on you can test it it’s thread safe it’s got all the great properties um anyone know who David John Wheeler is
25:46 · all right don’t don’t tell anyone yeah um but he’s worked with uh Stuart and he’s done some recent breakthrough research on on this problem space the use of subroutines in programs so it’s uh just to to uh two pages it’s
26:05 · a really good uh really good uh paper uh he says uh subroutine is a self-contained part of a program an entity of its own allows the coder to concentrate on one section of the program at a time without overall detailed program uh continually intruding right just like what we’re talking about so this is a great great uh breakthrough research silver chains can be more easily coded and tested in isolation right so you know okay it isn’t quite
26:33 · breakthrough research uh and he was a stewardship’s thesis supervisor actually in Cambridge um but you know we’ve talked about that this industry is Young right it’s like 1951 is kind of recent and I feel it’s like recent because um functions are under use so it must be new right it’s like we don’t use functions enough it must be you know breakthrough research
27:00 · um and I kind of believe functions are the fundamental building bar block of programming um you know if you’re writing an object oriented code you might say objects where the fundamental building block but you know they don’t do much if you don’t have functions so uh I really think functions are way more fundamental than I used to think about um they’re they’re also like a fundamental abstraction and they’re just the fundamental building block yeah um man I know the words to this too item six on the agenda the meaning of life
27:34 · that’s right it’s got a team working on this over the past few weeks and what we’ve got to come up with is two can be reduced to two fundamental concepts one people are not writing enough functions Monty Python fans yes
27:51 · all right let’s talk about member functions um why don’t we make this just a member function of projector right that that solves maybe some of some of the problems of like tolerance and all that kind of stuff we just make this a member function we could also you know cameras they can face North too we can make that a member function sure that’s good hey you know maybe they’re both devices so we could have a base class uh of you know device we
28:22 · actually have a base class called device already in our code we can put is facing north there oh we also have media servers they’re also devices a media server is you know what it does it serves media yes are you gonna have a North class yeah North dot is projector
28:44 · class next time um media servers I mean they pump the video that goes into the projectors that’s what they did they serve media they really are it’s a good name um they don’t have Direction other than out the server into the into the projector
29:03 · um they don’t face in a Direction so um you know we could have directional devices we could also have like the media server is facing our chest return false because it’s like not facing anywhere um or we’re gonna have directional devices and non-directional devices and at some point it’s like Anakin you’re breaking my heart I can’t go down I can’t you’re going down a path I cannot follow you know should I only do four five six is that I should avoid one two three
29:33 · all right all right I can work on that no there’s still another one coming sorry um you know maybe you were doing this because you wanted to share the implementation of facing north or something like that while at the same time allowing them to override it you know it all seems to make sense in object-oriented world but you know a good way of sharing functions is like
29:53 · writing a function it works so well you could just like call it whenever you want it thanks so we could just do that right like camera maybe the way you get orientation from camera is different or something like you just do that um functions are for sharing that’s that’s what they’re for
30:15 · so um what about putting you know we could put we could have a North class like JF suggested but what about just putting is facing north on um orientation right like what’s the difference between these two and in fact to the compiler it’s probably nothing right these are going to get in line and turn into exact same code so does it matter anyone care is it Friday the last Talk of the week
30:45 · I would say these are isomorphic the function pointer if the left hand side is way nicer the function pointer on the left hand side oh yeah one’s a member function pointer yeah which is horrible yeah I mean I always like to ask link about these things
31:04 · so every time you add another function to your class right it just piles onto your class and your class gets heavier and heavier and you walk slower and slower um because classes are made of velcro right you just keep sticking stuff on them and and I just don’t think you need to do that
31:27 · yeah yeah right but you know you probably wouldn’t have a specific function for facing north right um here’s another example this is our camera this is like like I worked at a lot of places and everyone has bad code okay right like don’t don’t hold my company accountable like all the code I’ve ever seen is bad everywhere um this is our camera class it really has all these things in it and I like to separate all these things into different like pieces of the camera class like the
31:54 · one of the weird Parts is you know it does have a pose and a calibration and stuff except for when it doesn’t because when you first start up our program we don’t know where the camera is we have to like take pictures and stuff and figure out where the camera is so it’s like I you know it’s a class that and all these things like half of half of this class is invalid part of the time right it’s it’s one of our worst classes actually but what we’ve done is basically someone said well it’s the camera class all this stuff has to do with the camera so you put it in the camera class right and you
32:23 · form like what I like to call a Nexus like you’ve just taken all this stuff and it’s like a Nexus of complecting you’ve you’ve put all this stuff close together and then say hey use it and how much of your code is gonna like every time you change any function on the camera class you risk chain you know affecting all these other pieces of the camera class
32:47 · so the other difference right this function is going to use an external orientation API right it’s going to use orientation somehow it has to use the external API that one probably just going to access the internals so if we change our orientation from being yaw pitch role XYZ then we changed it to
33:03 · quaternions and then we change it to rotors you know all these functions are going to have to change but not this one if you keep it outside that one will have to change right you change anything about orientation all the member functions have to change or potentially have to change you’re going to miss one and fixing something in orientation here is going to going to break another member function over there so what we want is we want orientation to have like what we like to call a basis Cloud a basis set of functions set of basis functions right of you know the
33:32 · here’s the functions you need in orientation and everything else can be outside of it and I like to say that good code begets good code right um the code could be fine right now but you’re leading the next person into a trap right um the next person who goes to change the orientation class is going to have a harder time so the code might not be bad now but it’s
33:58 · going to become bad and it’s really weird that it turns out that you can’t see what code is good it seems like you can’t see what code is good until years later and then you look back and you go oh yeah well this code actually changed over time and is still robust and everything whereas this code just went downhill it’s like well it’s probably bad to start with you just didn’t see it and also you know if the definition of good code was just begets good code it’s like the same definition of bad code bad code but gets bad code the only difference is good code works
34:31 · so you know I don’t even know if I want to talk about invariance but um yeah every member function has to maintain the invariance of the class you guys all know this it’s preaching to the choir here at this conference um and so this one doesn’t have to worry about invariance they’re not going to be broken even for a moment and this is also 23 years old
34:53 · um Scott Myers has a really good article on this how non-member functions improve encapsulation um you should read it not right now read it later um how many string functions are there [Music] too many functions on stood string or string functions that’s a good question let’s start with how many functions on Stitch string 200 yeah there’s like 200 or something like that it’s way too many but I actually did mean how many string functions are there like you know like this even if we just limited to this right like or functions that take a
35:25 · string or return a string right how many uh did someone say uncountable because my you know my question my first question is is it infinite infinite and my second question is which Infinity
35:43 · right and it depends yeah five useful ones four or five useful ones that’s it yeah the rest are you know but um and this seems to be the right place to discuss the Infinities um well yeah right like in principle your
36:03 · computer is infinite but really your computer is finite so you can only have a finite number of string functions right but if you think in terms of just the programming language you can have an infinite number of string functions right
36:19 · yeah so you know um you know which Infinity is it countable infinity or maybe you could figure out that it’s uncountable Infinity um alif one yeah um there’s a lot right that’s that’s my point you know whether it’s infinity or not doesn’t really matter there’s a lot of string functions how about we put them all as member functions as a standard string right so for some reason we don’t do
36:50 · that right so for some reason we decide to like you know not everything needs to be a member function so you know do does anyone want to vote on this is anyone like who who likes who likes that side great see I don’t have to ask you like this thing I just say no one like the other side and I’m going to assume everyone like this side is everyone like this side yeah it’s pretty I mean this audience you guys are easy
37:15 · um so you know I think is facing north should be a non-member function um do they have anything else to say that yeah not everything should be a member function so that’s this is where we’re at how how far are we through the song anyone following all right about halfway through the song and then maybe a little farther all right so you like link got look how fast he moves without all those functions on him and then you know you gotta tackle the next you know challenge right
37:49 · uh you say you changed the param direction so uh what I want to talk about is like in-out parameters right I like in parameters but sometimes you have you know parameters obviously orientation you probably wouldn’t make it in no perimeter but instead of a function um that takes a vector does some you know some other parameters probably modifies that Vector for some reason right
38:14 · or you could have a function that takes some stuff and returns you a vector right and nowadays with move semantics it’s like one’s just as good as the other pretty much right I really like this one better right um yeah
38:32 · there is a you know a time where this is less efficient than doing this right because in this case you know if you put 100 items in the vector you clear the vector but there’s still a memory for those 100 items and the next time through maybe you do 50 items and there’s no allocation right so there is a time where this is valuable but most of the time I’d prefer the other way and once again why not both right I would make you know I I didn’t mean to
39:02 · say fugly but that’s like like it just I typed it and I was like oh man um I just like you might want to make the one name a little uglier so that everyone tends towards this function because at the end of the day um When I See This you know and you know
39:19 · imagine this dot dot dot is a lot bigger right just you look at this line of code and you’re like oh I wonder what that line of code does it’s kind of hard to tell what that line of code does that line of code like it takes some stuff and it makes a vector I know you have to look at what the function is I can see yeah it takes some stuff to take that function I’m going to especially if I start writing all my code in a in a like pure functional style um I’m going to assume that that doesn’t touch any Global variables or anything whereas this which returns void I’m like
39:47 · ooh what’s it change like maybe I can figure it changes Vector but maybe I’m like oh does this change Global variables does this change is it a member function is this like what’s this changing right that also could be changing Global variables but it’s probably not right so when I’m looking for where the bug is I you know I probably won’t start over there I’ll probably go looking over here right so it might be valuable sometimes but uh
40:11 · it’s harder to read it’s harder to know what’s going on with that function you could also name the function something better than F but yes I mean at this point right is there any I mean if you if you say plus equals
40:26 · on the right hand side yeah plus equals no I don’t want plus equal right well you do because you’re going through the oh right I don’t want to add them up clear every time yeah yeah I was clearing but yeah you know like but you’ve allocated over here right yeah you could yeah Reserve yeah
40:48 · and then like someone could tell me that compilers can figure this out and you know figure out that hey this I could just reuse this Vector wouldn’t that be better I don’t know I think this is a whole other topic um stepping off when he started talking about regular right and he wants he wants in regular being be like int is is regular right and
41:09 · copies are separate um you know if you change the one in the other one doesn’t change they’re not connected in any way um if equal equal does what you think it should do copies are equal you know um and there’s also like less than and stuff but let’s forget about that um wanted to be able to declare your class
41:31 · as regular such that the compiler knew it was regular so the compiler could do more optimization and be like oh you know I’ve got I’ve got this thing and it’s the same value so I can do substitution or I can like uh um sub expression
41:46 · substitution and all this stuff that the compiler does on instant things because it knows what an INT is and they can’t quite do in your class unless it can see into your class and like inline everything but imagine if it couldn’t see inside your class but it just knows your class follows the regular rules then the compiler could suddenly optimize it better so you can imagine like if the compiler knew the rules I mean the pilot because it’s standard Vector could know the rules about Vector better but for any class you could give
42:12 · the compiler more information about you know hey look my class works the way a class should work so you know optimize to it um so you know it’s hard to it’s hard to see this is basically what I already said right it’s easier when I’m debugging I probably won’t go look at that F unless you know Vector is the problem then I’ll be like oh you created the vector what’s going on but you know this one I’m just a little slightly more suspicious of it might only take me 10 seconds to go look at the at the signature of F and C oh it
42:44 · takes the vector and you know the other problem with a function that takes a vector by reference I don’t know if I’m supposed to clear every time or it’s like oh is this function does this function clear for me and you know fill in is it expect an empty vector anyhow so I don’t like out parameters
43:03 · sometimes they’re needed but not not a big fan speaking of names I’m sure somewhere in oh F right I was talking about F I always speak of names so I knew I would have some at some point [Music] um calc star pause you know probably should have been Galaxy Star positions even calculate but
43:23 · you know um I wouldn’t call it get star positions because it actually does work right I you know this is just a little you know because I’m trying to talk about everything about functions when you name your function uh like kevlin Henny doesn’t like the get at all but you know whatever gets okay I just want I just want to make sure if it does something like you know
43:49 · determine determine sounds like I like calc for things that are actually mathematical and stuff but give me a sense that it’s doing work um you know you’re fined I expect fine to be linear at worst right um if your find is um if your find is a uh you know N squared then go home and rethink your life
44:19 · all right also again don’t put parametypes in the name of your functions it’s just unless you’re writing C code all right I know what you’re thinking you’re sitting there and you’re saying to yourself Tony which is a weird thing to say to yourself your name’s not Tony but you’re saying Tony those were all stupid examples they were all fake examples what about some real code right
44:48 · all right here’s some code straight out of you know my code base I tried to hide the actual interesting parts of my code base so that people at work didn’t get pissed off um this really is so what I did I searched for step one it’s a really good thing to do in your code base just search for the string step one and see how many times you find really giant functions and not only that but I found the exact same step one multiple times
45:17 · um so step one it says it turns 2D camera points into 3D points and it really does and then it goes on to do some other things um you know Sean parent no raw Loops maybe a bit extreme but you know this might be a good I like looking at least looking for loops and seeing if it is a
45:35 · good cutting Point sometimes the whole thing is a good cutting point and sometimes I leave the loop and make the internals a function just like Loop over these things and call this function on each item it all depends I really need to do a talk on cutting points but this function does seem like very step one step two there’s a fairly good cutting point between the two and one of the things you’ll you know if I had all the code here you would notice that a bunch of these um maybe I already threw
46:02 · some out but there’s a bunch of local variables that are just useless after this point right they just they they’re still there but they never get used again because they’re only used for step one so you know make a function that’s it’s that simple
46:18 · um hey look validate fit it’s not even called step four it was called validate fit so simple uh here’s another example um and you know I’m not trying to say he’s a bad programmer he’s a good programmer right it’s a really good article you should go read it not right now um uh and it’s about um uh this is um so his whole thing is events like say
46:48 · Foo and bar events and these are receivers of the events like these three receivers have said I you know call me when Foo happens and these ones said call me when bar happens this is a uh map to vectors and that is a multi-map right either one works right and that’s what this whole article is about is like you know which one of these is better
47:10 · I I naturally go to this one but it’s that’s not the point right so um he wrote here’s his code um he wrote this code I added some comments to what’s going on in the code uh part of the reason well I’ll get to that in a second um that’s the case of the map to vector
47:29 · and this is the case of multi-map right multi-map you get back a range you call equal range you get back a range and then you Loop over the range right but the comments are the same so the reason I really found this interesting because like I had just written the same code in my in my code base like the same name I called it mediator he called it event mediator and they’re both taking events like it’s literally the same code this is why chat GPT can write code sometimes right it’s
47:58 · like we’ve all written this code already right um so this is my version of the code calls get listeners and you know for each listener um and I kind of think I was lucky this time that it happened to be written that way I just as easily could have written
48:14 · the other way um I don’t think you need the comments anymore right the code tells you exactly what it’s doing I don’t think you need to you don’t even need a comment about why it’s doing it it’s like the function’s called notify listeners it gets all the listeners and notifies them right
48:32 · um I have a whole talk on why you shouldn’t uh do um The Observer pattern is broken in fret in threaded code no matter how you do it so I still have to do it some way so mine’s called non-blocking notify if you if you like grab a lock or something in there like the whole thing yeah it doesn’t always go in trouble but just please don’t call put a lock inside of that you’ll end up with deadlocks
48:56 · um so which one am I using map of vectors or multi-map s yeah right I don’t know I mean I do know because I wrote it um but it doesn’t matter right it’s like and what I find it happens a lot is that people will write nice you know I wrote my nice class and I’ve got some nice functions and a nice API but as soon as I step into one of my member functions I’m like oh yeah let’s get to the you
49:20 · know bits right it’s like oh you could just you know write functions for yourself inside your class that are just helpful little functions like get listeners right it turns out my get listeners actually like does some filtering or something as well so that’s probably the only reason I put it in a separate function um but you know let’s forget that let’s say I put it that way just because it was like natural for me
49:44 · um you know this is obviously not always true you know you pick the wrong abstraction and your your whole life goes goes down down the drain but um often details will change but like the point of this whole class is you get events and you call listeners that’s part’s gonna stay the same right
50:05 · um so let’s pick on me instead of you know people on the internet uh this is uh you know from slides I did on a lock free unlock free programming way back when uh and this is one big function that does push and especially um lock reprogramming uh
50:27 · you I I have a tendency to write bigger functions I kind of I’ll explain that in a second so first of all you know no raw Loops I’ve got you know four of them I’ve got like triple indented you know Loop there uh but I need to like that’s this is how it works um but in lock reprogramming like in most
50:48 · classes you go into a member function you’re trying to maintain the invariance of the class but you break them inside the member function as long as you restore the invariance before you leave the member function in Lock Free programming you never break the invariance no not
51:03 · even on a single line of code not within a line of code because another thread can come in at any time and sees the state of your data at that point so the state of your of your class has to always be valid whatever your invariants are always have to be there right so I have a tendency when I write lock for code it’s like man I need to know the state of everything right now so that like I don’t mess anything up right but it’s kind of weird because actually you don’t you you can’t do it’s it’s so
51:32 · hard to do local reasoning in Lock Free programming because you can’t just think about the push function you have to think about pop function at the same time because they’re both changing the same data at the same time but but it’s my excuse for why I I wrote this big giant function because I just feel like I need to know what’s going on like don’t don’t hide anything from me but at the same time nothing is ever hidden from you like if I make a function called Fine tail which is what this part of the code is doing
52:01 · you know it would have been great if I put comments in this code um you know but this part’s doing fine tail that fine tail function has to work all the time because you never break the invariance so I can put it over there and just look at that code and say that’s how you find a tail that will always work wherever you call it because it’s Lock Free um except for the fact that it has a precondition um so you know whatever um but most of these functions are like you can think of them in isolation because you have no other choice to like
52:34 · they’re as isolated as they can be whether they’re there or here because you have to have all the functions at the same time in your head and the state of everything in your head because Lock Free programming is weird um so it’s fine you can put them in a little function and think about them in their little function
52:53 · um and you know I don’t know am I a good program is this I don’t even know in this case this is kind of on the line for me whether this is better or the other way is better but like no one knows what’s going on here right but it really is if you try to find it’s a it’s a lock for you trying to find the tail of the queue you try to write the value in the in the at the tail of the queue and if it fails because some other thread was doing something you try again and you have to refine the tail because it could have moved and then you try to write it again it’s pretty simple right this doesn’t look simple
53:25 · all right here’s another one from a Community member we won’t say who um they you know had this question you know why don’t we have a Lambda inserter so when you call a standard sample you are passing an output iterator right and you
53:41 · can do like back inserter to make it call pushback right but it’s like why can I only call pushback why can’t I call any Lambda I want right so if you happen to have a class that doesn’t have pushback instead you have an ad you know you called it add instead of pushback you can’t use a back inserter so either you’re like writing this whole wrapper to have pushback or
54:01 · you know I need to do this instead it’s like no you don’t write the functions you want to see in the world you’re like why don’t we have this and it’s like well just write it right so either right the Lambda inserter or write your own sample function that takes a takes a function per sample just write the functions you want to see in the world
54:22 · um this is straight out of my code base uh this function as you can imagine gathers the image data and the first thing it does is gets the thing out of the state and uses the DS and the rest of the code uses the DS right
54:40 · so first of all um this isn’t a pure function at all what did I want to say here um yeah the reason we we started to refactor this code this code was you know this was a problem that we get the state and get the DS because we wanted to call this code on multiple threads so I want to turn it into a pure function because it’s so much easier to make it thread safe um and you know like this uh Cohen
55:08 · um we’re passing we’re passing too much we’re not even passing it we’ve got M State and we’re we should have been passing DS into this function right uh this is the top down bottom up yeah because you know someone just wanted to gather image data they thought
55:26 · this would do it um but they could have on the way back up realized after you’ve written this function you could realize that look it only uses like literally the rest of the code only uses DS it doesn’t use State obviously uses the parameters but the rest of M State isn’t important so on the way back up after you’ve written this function you should have realized oh I should just pass DS into this function but we made it easy because state was right there for you to get in returning void is coat’s Mill this function gathers image data like I would
55:57 · expect a function that gathers image they would return the image data like that’s what the function does doesn’t do that it sticks it in state that’s what it does um this is another one same sort of idea uh add correspondences um correspondences are this point in the projector matches this point in the camera and that’s how the magic Works um it literally is 150 lines of code that
56:24 · calculates the correspondences and the last line of code pushes it into the member variable right 150 lines of complicated function whatever I don’t care could you please just do this outside of this right and we’ve changed the code because
56:45 · um uh I want to we what the code does now it does uh two or three different ways of calculating the correspondences and picks the best one but um before it’s like you we’re like oh how are we going to do that and immediately you realize if this function didn’t change anything if it only calculated something it’d be so much easier to test and so much easier to reuse this block of code also returning void is coat smell yeah it’s not void but like you know it
57:19 · really maybe it did return false up here somewhere but it’s like you could have returned the set of correspondences and if there was nothing in the set that you know or something return an optional set of correspondences or yeah it’s basically void is what it returned no one looks at the return value anyhow all right so now it looks like this um I would have called it calculate correspondences but you know it’s got a name that suggests that it does a lot of work and then you said it it’s it’s like the same but
57:50 · I can now reuse determined correspondences I can now test determine correspondences so much of it um you know and you could kind of think like well until you needed to reuse it there’s no need to refactor it this way but you could have just like I think it’s more natural to have a function that’s like oh I need to calculate all the correspondences calculate the correspondence return it there that this was no harder to write than this it they’re the same so just
58:21 · write it this way right and that’s kind of my last point is like people sometimes say well it’s like I don’t know how the code’s going to change over time I can’t predict the future what where’s this code gonna go right and I don’t think you need to predict the future right all those examples and
58:39 · like we could have just sat up here and I could have just showed you my code base but you know someone would probably not like me doing that um but I could just show it to my code base or any other code base and found a hundred examples of this I every day I just see like especially the separate calculating from doing it’s all over the code um and it’s pervasive and every time that we
59:01 · try to do anything of the code we realize ah should have been done the other way but like we could have just like there was nothing stopping us from doing it that way right from the start right like return you know separate calculator from doing return to Value you know all these things you don’t have to be like oh I wonder how the code’s going to change over time it’s like no just do that first just do that right away at the beginning that’s not like I’m not saying like
59:26 · figure out your whole um you know your whole abstraction of your whole of your whole uh code base right like sure that’s hard that’ll change over time but if you write a function and it’s a pure function it just sits there that’s probably not going to change over time right like it’s I just uh yeah it bothers me yeah
59:47 · do you acknowledge that it’s easier to not do that let’s say that we should do it oh even though it’s not yeah but it’s the the thing that gets me is that it’s not really you know it’s it’s this much easier to not do it right but it’s so small um it gets it does get bigger when
1:00:08 · um I didn’t talk about this but it gets bigger when you realize you’re like oh I’m just gonna write this function separate then you’re like oh where should I put it right it’s like oh I should put it in no not that header no maybe that header maybe I should make my own CPP file right and it’s like oh my god making a cpv file that’s hard right
1:00:26 · but I’m fine with I often tell people just put it at the top of your whatever whoever’s calling it right now just put it up here just put it at the top and then if it gets reused it’ll migrate higher and it’ll migrate out of here over to someplace else that does risk the chance of you writing that same small function in three different CPP files that’s that’s not the worst thing in the world you’ll probably see that eventually and turn it into one you know um yeah it’s it’s so small amount harder to write a
1:00:57 · function but often often you’re like some of these like this the hard part was determined correspondences like there is no extra effort to separate that yeah it was like the return correspondences was months of work like literally months of work uh what was that about functions again people aren’t writing enough
1:01:29 · that’s it yes you keep saying returning smell you know I can see that if you’re referring to uh Global functions um but especially in the case of member
1:01:47 · functions how is forcefully as in your last example of returning always return true any better than returning void I mean that function actually does something yeah it mutates the local state which is perfectly fine doesn’t limit some Global State this function is a fine void
1:02:05 · function or bull or whatever you want you know it’s a void function that’s fine it does what it you know it puts the correspondences in the class yeah like the other thing that bothers me about this it’s called ad correspondences so you would think one of the parameters would be the correspondences like it’s called add you know it doesn’t add correspondences it creates them out of nothing oh well it creates amount of images and stuff and and you know the real work the real function is determined correspondences but soon as you make determined correspondences which returns a value then you know I
1:02:34 · don’t care that this is void but I see big giant functions that do a whole pile of work and it’s void I’m like I bet 90 of that work wasn’t changing the the modifying the state of the class right it was a free function hiding inside a class yes
1:03:01 · yeah maybe um like if you just I know what you’re saying I know what you’re saying I’m wondering whether I care right I care so much about the first function there that you know I don’t care about the rest like as it turns out um in our case ad correspondences is gone
1:03:22 · that function I I like I literally just typed this in today um because we are calling determined correspondences multiple times and figuring out certain things about the state of the world to figure out like oh we should go down this path this this gets us the best correspondences right um so yeah in our case you call that multiple times in a loop or so I forget how it works um and then push back once at the end so it’s
1:03:56 · the performance the implication of creating the set of Correspondence correspondences in this case so I think that what this requires is more than encapsulating what uh the original programmers wanted to avoid into its own function just something harder even which is to change the logic so that uh the thing has a
1:04:21 · different name or whatever which would be like a update correspondences as opposed to uh the thermal correspondences because very clearly I see this anti-pattern many many times which is like a some programmers think that creating an
1:04:39 · intermediate a temporary with a set of something is going to be less efficient than doing it in C2 and then there are all of the complications of usability of doing things in Cedar lack of local reasoning Etc yeah um what what how do I summarize that in reply um and I might not even call it all because it’s Friday um there’s a couple things right like this returns a thing
1:05:09 · um it’s it’s so it’s not in situ um and I don’t care if there’s any performance hit to return it shouldn’t because it moves semantics but I don’t care if I create more data temporarily because the term correspondences is the thing that takes time um the other thing you were saying I do see and maybe you’re going in a different direction I do see a lot of times developers who like
1:05:35 · um like I’ve seen code where it’s like find find the max value in this set of things and how does this work they um they they generate a bunch of like it’s generating values and finding the highest one so they generate them all put them in a set and then then find the highest one it’s like you could have thrown it out soon as you knew it wasn’t the highest one right and so you do get a lot of times where people like create temporary data in the middle
1:06:04 · um it all depends right sometimes I don’t care like I we we all care about performance but I actually for most of us in you know sure if I’m writing games or something but most code doesn’t most the code in my application doesn’t need to be fast there’s only certain Paths of code that need to be fast and I will do all the tricks to make that fast everything else I’m like do whatever looks cleanest right yeah just know like first of all let’s let’s not have bugs and then you know
1:06:35 · so I didn’t know if I answered your question very well sorry I was just making the comment like a more than a question like uh this also happens with yeah yeah you get a whole line uh
1:06:56 · yeah okay yeah I mean in things like that maybe it’s better to pass in your function that you want to iterate over the lines and then you you never you know you go through the buffer or the line or whatever um in place with string View and you never leak you never even leaked the line out you pass in the function that you want to do per line
1:07:26 · [Music] values because that is the logic that they have or to the architect the the work so that they do something different if they the existence of the temporary would be an issue yeah I mean so the
1:07:44 · real question is what do we do with those correspondences after right yes yeah but that is um very disjoint from that what we’re gaining there is the separation right the code that takes the correspondences there’s like five different things we might want to do with the correspondences so we could you
1:08:08 · know pass that in as a function to the set of correspondences but we actually want to keep them around for certain reasons so yes yes so I’m all in favor of Bali semantics and what you call Value oriented but I will reserve it to things that leave abstractions that live entirely inside the machine in some sense if you’re controlling something on the outside like it’s your example is your chapter yeah there is something about reference event that makes sense because it’s outside right yeah you’re
1:08:37 · referencing something like you can suddenly not copy that for sure yeah and suddenly projector is now a reference and and it has a value there right yes some value of conception that’s what I’m saying yeah and if you want to simulate the perspective then you have simulating projector which is a different thing you might have a lot in common and you might convert one into the other or manipulate one from the other but it’s like reference semantics has some value on what is something external to the machine you don’t have any other option yeah completely yeah our our projector
1:09:09 · class is is classic object oriented right we’ve got a base projector class I mean we really do have a base device class like you know maybe we’ve gotten it we can argue about the the details but camera and projector share a lot of device there’s a device at the bottom
1:09:24 · um and we have multiple different models of projectors they all you know thankfully now they mostly work the same way but at the time it was like you’ve got to talk to this one this way you got to talk to this one the other way and we do have a simulated projector we have a whole full simulation environment that fakes the cameras fix the projectors has a ray Tracer to get the light doing the right thing and it’s awesome but to me
1:09:47 · it looks like a projector and it’s a it’s running on a separate server it’s like web-based and everything it’s the coolest thing um and I just talked to it thinking I’m talking to projectors um and yeah it’s classic polymorphism in classic object oriented um you know Sean’s not gonna be my friend anymore that I said this but uh it it’s a decent use of polymorphism you still have and I’ve been trying to
1:10:12 · figure out ways of avoiding passing this pointer around everywhere right and we end up with a lot of uh functions that didn’t really need it they needed the ID of the projector but they get a projector right and then it’s like who even owns this thing who’s going to delete it like all these kind of problems and sure shared pointers shared pointers is good as a global variable um but like there is an owner to the projector it’s the model it owns everything um and so much of our code so I now have
1:10:41 · a projector ID which is its own you know it’s just a string but it’s a strong type rejectors IDs and Camera IDs can’t be you can’t mix them up um and a whole bunch of codes like look you only need an ID and then somewhere along the way someone’s gonna be like I need to turn the ID into a projector just for now and to a certain extent that could maybe be a reference instead of a pointer um you know or yeah except for the case
1:11:05 · where you don’t get one back but you could deal with that um and then we could not have projector pointers all over our code base right yeah yeah so regarding void functions like a little function s what they do is first they allocate the vector which is some size and they then they feel effective yep and the second part would be moved into a separate function which takes a span
1:11:38 · yeah yeah um yeah I like I have realized that um I’ve tried this in the past of like I shouldn’t assume it’s a vector right and then I realized no I use Vector
1:11:55 · everywhere like it’s just what I use like it’s going to be a vector it’s never going to be a list it’s never going to be a thing or another thing or another thing so yeah I think you’re right like you could have sometimes you’ll be like look this function could be even more generic if it went over a span or if it went over a you know iterator that you know like we could turn it into a template or but I’ve got functions that are way too big to be turning them into templates and I and I finally just said look I know it’s a vector 20 years from now it’s still going to be a vector almost guaranteed or I write my own vector or something if I finally you know but it’s yeah
1:12:27 · um and so you know maybe it’s even if even if it was like half the function should be void right now it feels like 80 of my functions are void and like I don’t know what the you know I didn’t want half I think it should be 20. it’s 80 20 it should be 20 80. right or something like that so it’s obviously you know a function that draws a button on a screen you know it doesn’t return anything the output went out of the computer or out
1:12:55 · of the program onto the screen right there’s a lot of functions that are going to be void but not as many as we got right now anything else basically
1:13:12 · yeah a lot of uh every a lot of things are actually Common Sense yeah and uh they’re not done because they’re not not as easy or because there’s not we’re not uh you know mindset of uh like introspections and I wonder what you think uh like the tools or tooling yeah uh is part like you can have in those uh in this area
1:13:38 · yeah like to summarize a bit um a lot of it’s common sense right and and it’s just how do you convince people to just do it and and get in the habit of doing it right um I forgot to mention at the beginning the reason I put up Sean’s thing there and everything was like I mean it’s this this talk is is almost
1:13:58 · not for this audience right we’re the ones who tell everyone else like really like this this conference is kind of special right we have it we tend to be the people who are telling the rest of the rest of your team how to do things um so my real goal here is just to give you stuff right and like literally to
1:14:15 · give you really short words to just be like look separate calculating from doing like I at work I’ll just be like dog fridge like remember the dog in the fridge and then they’re like oh yeah dog and fridge okay Tony whatever you say um but it’s like like it’s I think there’s value in like pithy little you know like hey just separate calculator like
1:14:40 · you know it changes every week to week but lately separating calculator from doing is my favorite like I just keep going back to that because it doesn’t fail me it never it’s never a bad idea it’s just like oh yeah great so yeah that’s like the actual point of this talk is to just like hey steal my phrases you know anyone yep
1:15:03 · yeah the projector you know what real the real reason for a projector facing north I I don’t like giving the same talk twice but I gave this talk at CPP North so I needed an excuse to I needed a function you know yeah I you know maybe the sunlight something no we don’t have you know in the real code we have no idea that projector is facing north or whatever all we ever figure out is where is the
1:15:26 · projector relative to the thing we’re projecting on that yeah yeah good point yeah um yes if it’s a pre-function then you may put it in arbitrary file like separate from the projector yeah suppose you have a concept of a thing
1:15:49 · that knows about North and for a projector this concept value would change you depending on whether you included Your pre-function or not oh what do they think about this problem yeah I mean just don’t do that um
1:16:10 · I mean you should never write code that changes dependent depending on whether you included this or didn’t right you know including something or not should only say it compiles or not basically hopefully it doesn’t change the meaning of next to anything um uh but related to that you do end up
1:16:27 · with this this thing where you end up with a projectorutils.h and CPP it’s like you got the projector class and then you got like here’s a bunch of functions and people are like why aren’t they just on projector and it’s like because all these functions don’t change when you change projector not all of them but like a lot of them are just projector utils and they are fairly stable the way they are and you can change projector and put in different projectors and I don’t
1:16:53 · know it just works out better it people just don’t want to write the first projector util function because then you have to make a new class and it’s harder to find right so we don’t you know projector Dot and then your IDE fills in a function get a better IDE I don’t know
1:17:14 · the the north concept I don’t know Norse not a concept but you know hey we can talk about it later my brains my brain’s too uh it’s Friday it’s the end of the day um maybe I could yeah let’s talk about it later anything else yeah well still going on about tolerance
1:17:39 · program committee was just part what like yeah um I should have put up the slide the next part is called part five because it’s part V for values it’s called Return of the values and then you’re going to tell me that’s not episode five like I know I know but it’s just the way it works out so it’ll I mean well come to
1:18:06 · come to CPP North sorry okay sure but uh what I was gonna say as well yeah thanks again the calculating from doing that is I feel like you know really a brilliant uh uh somehow escaped all of a sudden but what I was going to say is exhausting to me that that here we are
1:18:26 · 14th year we’re still talking about this topic yeah we were talking about this topic the first year because so like apparently well it will die right like apparently there’s something important yeah there’s something there and like literally what I’ve been trying to do is like I want to talk about value semantics right and Sean talks about value semantics in them but every time I start talking about it I end up talking about functions so I was like okay just get that out of the way and then I can talk about classes right so and I’m scared to give
1:18:57 · the second talk like I actually wanted my goal was to switch talks here like just show up here and be like pretend you’re giving the second talk and write it because that’s what I do I write my talks while I’m here right we all know that um and then it’s like it just didn’t have the real pressure so I didn’t do it right so but of all my talks it’s the
1:19:17 · one I’m most it’s hard like it’s like Dave ass he’s like how do you teach it he’s trying to teach it Sean’s trying to teach it and it’s just like it’s simple things hard to teach so yeah that’s why we haven’t got there yet some of us you know some people are there I’m trying to get there
1:19:34 · well I mean I still think we yeah I mean I still think how to unify the whole space and it didn’t occur to me until your talk here but oh yeah we have to examine the intersection of value types and functions and it’s not just yeah it’s a lot about functions because it’s it’s local reasoning it’s I mean go read stepping off right like sure sure yeah but guys I wanted a quote it from
1:20:01 · like he hates objects like it literally hates objects yeah so Step It Up hates objects with lots of pointers yeah yeah he hates other people loves pointers which is you know now hard it’s like should we change How We Do iteration right but that’s a whole nother topic anyone else let’s be done [Applause]