Video summary
Bjarne Stroustrup addresses the challenge of achieving what he terms an "Einstein level simplification" in software development, questioning whether code quality can be strictly regulated or if it requires a unique spark of inspiration. He acknowledges that while experienced developers can often identify when code is messy or "smells," recognizing true beauty and elegance is significantly harder because such qualities may stem from innovative approaches that are not immediately obvious to the average observer. Stroustrup notes that just as one cannot regulate artistic genius in painting, it is impossible to mandate inspiration through rules; however, developers can certainly learn to recognize when they have failed to reach a standard of clarity and simplicity. To bridge the gap between what is technically possible in a language like C++ and what constitutes good practice, Stroustrup emphasizes the importance of established guidelines rather than relying solely on individual intuition or legacy constraints. He introduces the "C++ Core Guidelines" as his current formulation for defining high-quality code, which serves to limit potential mistakes and damage without guaranteeing masterpiece-level results by itself. These rules focus on how a programmer utilizes language features in specific contexts, distinguishing between capabilities that are necessary only in certain situations versus those maintained merely due to thirty-year-old legacy code that cannot be easily discarded. Stroustrup draws a parallel between software craftsmanship and the work of famous painters like Michelangelo, arguing that while technical proficiency with tools is essential for creating important works of art or programs, it does not automatically produce greatness without an additional element of inspiration. He suggests that just as great craftsmen in history could express their ideas effectively using their mediums, modern developers must strive to master their coding tools well enough to create a "really good piece of code." However, he maintains that the final leap from competent craftsmanship to inspired creation remains beyond the reach of regulation and depends on an intangible gift or understanding. The discussion concludes with the observation that identifying ugly or buggy code is relatively straightforward because such flaws share common characteristics like complexity and confusion, whereas beauty in code often arises from unusual innovations that require thoughtful appreciation to recognize. While guidelines can help developers avoid obvious pitfalls and adhere to best practices, they cannot force a programmer to produce elegant solutions; instead, they provide a framework for minimizing errors while leaving room for the necessary human element of inspiration. Ultimately, Stroustrup posits that good programming is an art form where technical rules set the foundation, but true excellence relies on recognizing when code has transcended mere functionality into something clean and appreciable.
Read the full video transcript
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