Bjarne Stroustrup: Recognizing Beautiful Code
pnWkj6Caelc • 2019-11-10
Transcript preview
Open
Kind: captions Language: en so how do you inspire or ensure that the Einstein level simplification is reached so okay can you do code review can you look at code is there if I gave you the code for the Ford f-150 and said here is this a mess or is this okay is it possible to tell is it possible to regulate an experienced developer can do it code and see if it smells you know I'm mixed metaphors deliberately yes the the point is that it is hard to generate something that is really obviously clean and can be appreciated but you can usually recognize when you haven't reached that point and so if I I've never looked at me if 150 code so I wouldn't know but but I know what I ought to be looking for there I'll be looking for some tricks that correlates with bugs and elsewhere and I have tried to formulate rules for what good code looks like and the current version of that is called the C++ core guidelines one thing people should remember is there's what you can do in a language and what you should do in a language you have lots of things that is necessary in some context but not in others as things that exist just because there's 30 year old code out there and you can't get rid of it but you can't have rules it says when you create it try and follow these rules this does not create good programs by themselves but it limits the damage and off for mistakes it limits the possibilities of a mistake and basically we are trying to say what is it that a good programmer does at the fairly simple level of where you use the language and how you use it now I can move all the rules for chiseling in ma marble it doesn't mean that somebody who follows all of those rules can do a masterpiece by Michel Angelo that is there something else to write a good program just is there something else to create important work of art that is there's some kind of inspiration understanding gift but we can approach the sort of technical the the craftsmanship level of it the the famous painters the famous cultures was among other things superb craftsmen they could express their ideas using their tools very well and so these days I think what I'm doing what a lot of people are doing we are still trying to figure out how it is to use our tools very well for a really good piece of code you need a spark of inspiration and you can't I think regulate that you you you cannot say that I'll take a picture only I'll buy your picture only if you're at least then go there are things you can regulate but not the inspiration I think that's quite beautifully put it is true that there is there's an experienced programmer when you see code that's inspired that's like Michelangelo you know it when you see it and the opposite of that is code that is messy code that smells you know when you see it and I'm not sure you can describe it in words except vaguely through guidelines and so on yes it's easier to recognize ugly than to recognize beauty in code and so the reason is that sometimes beauty comes from something that's innovative and unusual and you have to sometimes think reasonably hard to appreciate that on the other hand the misses have things in common you
Resume
Categories