Settings

Theme

Walter Bright: Crafting Self-Evident Code with D [video]

youtube.com

19 points by open-source-ux 2 years ago · 2 comments

Reader

peter_d_sherman 2 years ago

There is some serious programming wisdom in this video! For that reason, it is worth re-watching in the future. What follows is a highly abridged list of some of the relevant takeaways from various time points in the video:

06:54 Don't try to make one language look like another

07:34 Don't reinvent bool

10:36 Code flows from left to right, top to bottom

13:31 Reduce conditionals

14:59 Avoid negation

19:31 Simplify compound if conditionals

21:39 Reduce the number of casts

22:57 Use self-documenting language features

25:56 Pass an abstract sink for a function's output

27:58 Pass files as buffers rather than filenames to be read

30:34 The caller, not the callee, should call the environment

31:45 Callee writes to buffer, caller writes to file

32:30 Use function pointers (or templates)

34:10 Functions should be in one of two categories, not both

35:48 Line things up

36:43 Use ref instead of *

Of these, I think I find:

"25:56 Pass an abstract sink for a function's output" -- the most potentially interesting...

Why? Because it can almost be thought of as borderline functional programming -- within an Imperative and/or Object-Oriented programming language... at least as far as the function using this method goes... it also has a wide variety of applications, i.e., instead of having a function do memory allocation (requiring that memory to be freed somewhere else in the program), why not pass such a function an additional memory allocator function pointer or object -- where the allocation (and subsequent deallocation) of memory -- is managed in some other well-defined place in the code...

Anyway, it's a great video! Well worth watching!

  • teleforce 2 years ago

    At the beginning of the talk there is an anology of a pervasive aeroplane landing gear lever with a wheel on top inside a cockpit for self-evident example of human machine interface (HMI) technology, pretty awesome and intuitive comparison I'd say.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection