4 ms·
Lots of good advice from a long-time programmer (https://en.wikipedia.org/wiki/Rob_Pike https://en.wikipedia.org/wiki/Rob_Pike). I have bookmarked these notes b
by combatentropy 10y ago
Lots of good advice from a long-time programmer (https://en.wikipedia.org/wiki/Rob_Pike https://en.wikipedia.org/wiki/Rob_Pike). I have bookmarked these notes before, because his simple but effective tips resonate with me. From the article:
> Algorithms, or details of algorithms, can often be encoded compactly, efficiently and expressively as data rather than, say, as lots of if statements.
I have read elsewhere about moving your code complexity to your data. But I can't find that other article. It's hard to find mention at all of this strategy. But I have found it to be true. Moving details from PHP into the database results in shorter code overall. The first example that comes to mind is replacing a bunch of if-statements with one or more columns in the database, like for some kind of categorization.
- mjevans 10y agoGeneralize the business logic in to things you do all the time, with data that you lookup as part of the context. In that way your program is actually more flexible, there aren't magic numbers or magic things that happen only in some cases. Those have been moved to co-residence with the data they belong with.
- ycmbntrthrwaway 10y ago> I have read elsewhere about moving your code complexity to your data. But I can't find that other article. http://www.catb.org/esr/writings/taoup/html/ch01s06.html#id2878263 http://www.catb.org/esr/writings/taoup/html/ch01s06.html#id2... ESR actually references Pike's "Notes on C Programming".