Lightning Talk: Whitespace: A Humorous Short Talk - Dan Curran - CppCon 2023

Поділитися
Вставка
  • Опубліковано 23 кві 2024
  • cppcon.org/
    ---
    Lightning Talk: Whitespace: A Humorous Short Talk - Dan Curran - CppCon 2023
    github.com/CppCon/CppCon2023
    i want a holy war over whitespace. the most productive discussion.
    ---
    Dan Curran
    working in finance. i like to experiment in language design, and implement proposals for c++ in clang. sometimes.
    ---
    Videos Filmed & Edited by Bash Films: www.BashFilms.com
    UA-cam Channel Managed by Digital Medium Ltd: events.digital-medium.co.uk
    ---
    Registration for CppCon: cppcon.org/registration/
    #cppcon #cppprogramming #cpp
  • Наука та технологія

КОМЕНТАРІ • 20

  • @MatthewWalker0
    @MatthewWalker0 Місяць тому +5

    This is my preferred style as well

  • @sephirostoy
    @sephirostoy Місяць тому +6

    I hate that clang-format default to push everything on the right. There are few options to push things back to the left, but it's several options, and they do not cover every cases. There should be a single option for this preference.

  • @AnthonyDentinger
    @AnthonyDentinger Місяць тому +3

    Between tabs and spaces, one is obviously superior. So obviously superior that I won’t say which one 😁

  • @sprytnychomik
    @sprytnychomik Місяць тому +2

    Voice of reason.

  • @TheMaidenOnes
    @TheMaidenOnes Місяць тому +1

    Nice talk :) I do agree with most, except the return type, that is where you pivoted from super hero to villian ;)

  • @VrajPandya
    @VrajPandya Місяць тому +1

    .clang-format where?

  • @bloodgain
    @bloodgain Місяць тому +1

    Kevlin Henney has an excellent talk from 2016 on this with some discussion empirically determining what's more readable:
    ua-cam.com/video/SUIUZ09mnwM/v-deo.htmlsi=3d0i6gBJgnQb12wX
    I'm not the first person to say so, but I think 80 characters is a good target, but _just a few extra_ is OK if it prevents wrapping. I go with "soft 80, hard 90" for wrapping: if it's less than 90 characters (and readable as-is), it can go on one line, but if you have to wrap, wrap at 80. If you can't _wrap_ at 80 characters, that's a code smell.
    That rule plus "functions should fit on roughly 1 screen length, ~50 lines max" has improved my code in every language I've used. It's not so much about the rules themselves as it is about the fact that good code _tends toward readability in the first place._

  • @therealvbw
    @therealvbw Місяць тому

    If we're following the patent specification for toilet roll use, surely we should use K&R + C++ standards' formatting? ;)

  • @KrzysiekPierczyk-uq1du
    @KrzysiekPierczyk-uq1du Місяць тому

    Okay, after a few years of working as a (clean-code-loving) C++ developer, watching all of these crazy formatting standards in various code bases (because it's standard LLVM/Google/... style, dude) and suffering from not being able to even configure clang-format to obtain such a nice, clean, intuitive formatting I've started to think that something is seriously wrong with my code esthetics. Thanks for telling me that I'm not the only one 😆

  • @fburton8
    @fburton8 Місяць тому +1

    Putting the toilet roll open edge to the back is a perverse as sitting on the toilet while facing the tank/cistern. I mean, why would you do it??

  • @AtomicAndi
    @AtomicAndi Місяць тому

    There are only two hard problems in CS:
    Formatting code and naming things.

  • @ibbles
    @ibbles Місяць тому

    I agree.

  • @Saragan
    @Saragan Місяць тому

    I do make sure things end on the same indent as the start, it just makes sense, the return type on its own line was a bit much but I would accept it, however the toilet roll in my house will always be at the back :P

  • @usrnm9076
    @usrnm9076 Місяць тому +1

    120 characters per line and I'll agree. All on one line is better then what clang does but if EVERYTHING is all on one line bwcause you only have 80 characters per line then it gets cumbersome to scroll.

  • @ShaunYCheng
    @ShaunYCheng Місяць тому

    Not sure if I agree that it’s more readable.
    His suggestion reduces horizontal eye movement but it increases vertical eye movement.

    • @sprytnychomik
      @sprytnychomik Місяць тому

      Hint: Books are mostly vertical. Women too.

    • @DwayneRobinsonMS
      @DwayneRobinsonMS 5 днів тому

      More or less "readable" is tougher to debate, but one can say that compared to ragged z wrap, that all horizontal or all vertical are linearly scannable in a single visual scan (whereas ragged z shape costs more eye saccades and more time to read) and yields a cleaner diff in code reviews.

  • @UrSoMeanBoss
    @UrSoMeanBoss Місяць тому

    Mate, you bit off more than you could chew, but I like the idea. For anyone who wants to learn more about this subject: Kevlin Henney has done a few great talks about this where he discusses "lines of attention", visual blocking, and so on; focusing on the experience of the reader and educating the audience about common elements of design. Explaining not only what matters, but how and why. Whitespace and style matter more than people think.
    I feel like this was a poor choice for a lightning talk because the subject definitely needs more time for education, and elaboration. Even if the goal is just to leave breadcrumbs that people can follow up after the talk, it's extremely difficult to do without a very tight script and an extremely skilled presenter. It's not surprising that you fumbled a bit.