Email or username:

Password:

Forgot your password?
Luci for dyeing

oblique strategies for programmers:

hardcode everything

do repeat yourself

you probably don’t need that

optimise early, it’s fun

try a new language feature

maybe you can do this entirely with tags and filters

try turning your program inside out

restate the problem

the naïve algorithm is probably fast enough

it is easier to ask forgiveness than permission

it is easier to correct a wrong program than to write a correct program

create a new programming language for this

66 comments
Deborah Pickett

@zens Tag yourself, I’m Optimize Early, It’s Fun.

jakintosh

@futzle @zens it’s me, “write a new programming language to specifically let you manage all your data with only tags and filters”

Brian Kephart

@futzle @zens I'm definitely Play Zelda and Wait for the Solution to Come"" 😂

EaterOfSnacks

@zens definitely "reinstate the problem" 😁

Adam Nelson

@zens i'm in this picture and i don't like it

Luci for dyeing

@arnelson i am saying these strategies are good and we should do them. reject arbitrary notions of programming morality

Luci for dyeing

@arnelson we might have a different notion of what makes a “good” program- but these notions are irrelevant to the process of creating a program in the first place. it is easier to correct a wrong program than to create a program perfectly from blank canvas

Josh Jersild

@zens @arnelson I am definitely team "the naive implementation is probably fast enough"

MarjorieR

@JoshJers @zens @arnelson "the naive implementation is probably fast enough" - not when it's bubble sort it isn't.

Josh Jersild

@marjolica @zens @arnelson bubble sort is great if you only have like 20 items, or the list is nearly sorted already 😃

Josh Jersild

@marjolica @zens @arnelson also if it's not fast enough it'll show up on the profiler and you'll fix it

MarjorieR

@JoshJers @zens @arnelson Correct: I found that the bubble sort was the reason it took so long by profiling the program.

MarjorieR

@JoshJers @zens @arnelson back in 1974 I inherited a large Fortran program (about 2000 punch cards) that ran on IBM370 mainframes. The purpose was to calculate the UK power stations fuel use. It used to take 2 minutes of CPU time to run the entire program. It included a bubble sort to put the list of the power stations into 'merit order'. There were about 3000 items in the list. When I replaced bubble sort by quick sort I reduced the total run time to 2 seconds with big savings to our budget.

Josh Jersild

@marjolica @zens @arnelson Yeah, 3000 is definitely the wrong number of elements for bubble sort to be a good choice, *especially* in 1974 😁

MarjorieR

@JoshJers @zens @arnelson the program used to run in a 150kb partition. 2 minutes CPU cost about £100 (1974 prices) for each run.

Luci for dyeing

@marjolica @JoshJers @arnelson well, the rule of thumb is “probably” not “definitely”. sometimes we work ourselves up about scaling problems that just never happen

Josh Jersild

@zens @marjolica @arnelson exactly! The ultimate point is "write it the most straightforward way you can to start, then fix performance problems when they become apparent"

Luci for dyeing replied to Josh

@JoshJers @marjolica @arnelson and also, once again, these are strategies for when you get stuck, not general rules of thumb

Going T. Maine

@zens good idea, might just need a bunch of xkcd panels on note cards, Randall Munroe is leaving money on the table

void friend

Hot take: a couple of these aren't even oblique!

Rowan :trans_furr_white:​

@zens these are genuinely good suggestions, thank you for sharing them

Luci for dyeing

oblique strategies for programmers 2:

don’t worry about the tests, failure is subjective

delete the framework, see what doesn’t break

consider goat farming

quack quack

you’re probably using the wrong version of a dependency

check it in anyway, it’s someone else’s problem now

try and refactor it, then lose all your unsaved work in a kernel panic, it really gives you perspective.

play zelda for a while, the solution will come to you upon collecting your 68th restless cricket

Jaycie

@zens I feel incredibly targeted here and not just because I've been taking Tears of the Kingdom breaks between pairing sessions.

Soulfiremage

@zens get stuck, argue with randoms about random stuff until the answer magic morphs into your neurons.

Luci for dyeing

getting some people who think this is a joke. No! I am entirely serious! let me explain.

“Oblique Strategies” is a card deck by Brian Eno designed for getting him and his friends unstuck creatively, when they reach a creative block.

Programmers get stuck too, and when we do, often it is because we have some unbreakable and unstated rule we’re holding in our heads uncriticially.

Luci for dyeing

We exclude a heap of solutions as “invalid” without trying them because we believe the solutions are not good enough according to some arbitrary standard.

All the rules of programming are made up. mostly by white dudes looking to sell a seminar. If you can solve the problem and follow all of the rules you wanna follow? cool, good for you. this isn’t for you.

but if you’re getting stuck because you’re hung up on an algorithm being suboptimal, even though it’s barely used?

maybe let it go

Matt Stine

@zens I non-ironically suggested "maybe we should just keep the COBOL" this week

Mx Autumn :blobcatpumpkin:

@zens the number of times I’ve reviewed a pull request and approved with comments such as “this isn’t ideal but it’s got the job done and we need this out pronto” is pretty high.

Sometimes good enough code is what’s required even when we endeavour for perfect.

Paul Souders

@zens THANK YOU for this thread

there is so much Cargo Cult nonsense around programming

Paul Souders

@zens

a regex is only one problem

spaghettify your code

mix your concerns

nest another loop

don’t collaborate

be imperative; the computer is just here to do your bidding

Luci for dyeing

oblique strategies for programmers 3:

replace a hard problem with a much harder problem

what would forth do?

ask an expert in something other than programming

rename all your variables after your children

rewrite it from scratch in godot

can you use the UI while you’re high?

count your blessings, then curse twice that amount

hilbert curves are neat. See if you can use a hilbert curve somehow.

A Star is the wrong solution for this.

GOTO considered helpful

Matt Stine

@zens am less successful with this list...

Flatbush Gardener 🌈

@zens
I like it! A few that come to me.

What if you didn't?

Are you sure?

How do you know?

Defer the decision [e.g. last responsible moment].

Get rid of one thing.

Take a shortcut.

Relax an assumption.

Code like nobody's watching.

rezmason

@zens Every correct program is just an incomplete wrong program

Programming's greatest effect is showing people what they can accomplish when they misapply themselves

satvrn

@zens "you probably dont need that" is me fr, i have deleted code i later realized i still needed on multiple occasions

massive functions too. fun stuff.

AlgoCompSynth by znmeb

@zens

Do it all with regular expressions

Write it in Arm Cortex M0+ assembly - a Raspberry Pi Pico is only four bucks

yumaikas/sakiamu

@zens @codefolio

Test the implementation

Metaprogram against your better judgement

Change your editor's font

Read the stdlib source

Debug at a lower level

Debug at an even lower level

Ask the wrong question as publicly as you can get away with

Re-code the same project over and over

Read a related book

Read an unrelated book

Luci for dyeing

@sakiamu @codefolio if I were to make a free pdf card deck template available would you mind if I included these?

Fred Moyer

@zens great advice actually if you work in a startup

Soulfiremage

@zens write code generators for things you can type in minutes, and code generators to make code generators when you get stuck, bored or both.

TobTobXX

@zens

> It's easier to ask forgiveness than permission.

Lol. I don't know in which context you meant this, but it's excellent in many contexts:
- Cookies
- File Access
- Tracking
- Camera Access
- Quitting without saving

Imagine closing a prgram an then seeing a popup: "We're sorry, we didn't save your work." <Close> <Ok>

SteeleDynamics λ

@zens Oblique Programming Strategies sounds like a book that needs to be written.

Each chapter covers a strategy with both imperative programming and functional programming examples.

Luci for dyeing

@SteeleDynamics and also logical, constraints, quantum, mechanical, and analog examples

Luci for dyeing

@SteeleDynamics let’s see if you can solve the problem using only beads and matchboxes

SteeleDynamics λ

@zens

Example 4.3:

Suppose you need to augment a program such that the interface is additive. (i.e., Allowing for the easy addition of additional operations which lookup the correct procedure to call based on the types of arguments supplied. This is usually called Argument Dependent Lookup or ADL.)

Rewrite the program to use an additive interface and create new procedures that get called using ADL.

Answer 4.3:

Question significant choices you've made in your life.

Matt Stine

@zens have done 100% of these... finally cracked "create a new programming language for this" this week

travis

@zens DRY is overrated, my code is WET (Write Everything Twice)

band

@travis @zens for me it is often rewritten three times ....

travis

@band @zens WETT (write everything three times)

𒀭𒂗𒆠

@zens

BTW, another technique I've personally found useful (with the same general vibe as this thread):

write it in the stupidest / least clever way possible; only once that solution works do you optimize/clean up

Helge Rausch

@enkiv2 @zens Or, as Kent Beck put it: "Make it work, make it right, make it fast."

Ada Hashtag

@zens is there a web page or style guide with these on somewhere so I can use it to nudge my team into less over-engineering?

Go Up