Lurker News
I recently realized that certain kinds of knowledge allow one to be significantly more productive when solving a large class of problems.

For example,
* Regular expressions for simple text processing.
* Parser combinators for parsing.
* Parser generators (esp. packrat variety) for parsing.
* The concept of fuzzing and property testing for testing code.
* Calculus for solving all sorts of problems.
* MCMC for solving a huge class of probability problems.
* Search algorithms for solving a variety of problems (e.g. all NP-hard problems, sudoku, HTNs, scheduling, planning).
* Gradient descent for solving a variety of optimization problems.
* Vector Space embedding as a conceptual tool for a variety of complex AI problems.
* Effect composition (Haskell's IO or Scala's ZIO) as an incredibly powerful paradigm for concurrency and parallelism.
What are some examples of 10x multipliers that come to your mind? Fundamental ideas without which you would be drastically less productive.

Comments (418) 135 threads

Earlier comments
graycat#
(1) Linear algebra. E.g., part of it is part of the crucial, core math of my startup. Also as we see today, Jack J Dongarra just won a Turing Award, and one of his best accomplishments is what he did for LINPACK, numerical linear algebra.

(2) Integer linear programming set covering. A super nice way to get likely very close to optimal solutions to some really nasty real world problems in combinatorial optimization.
(3) My favorite text editor, Kedit. It is a PC version of the IBM text editor XEDIT, written by an IBM guy in France, apparently on his own time. It used Rexx as a macro language, and Kedit uses Kexx, its version of Rexx, as its macro language. XEDIT and Kedit are elegantly designed; the macro languages are also elegant. Kedit is my most important tool.
(3) Hierarchical file systems, e.g., Microsoft's NTFS (new technology file system). I just find the hierarchy in the file system as a natural a taxonomic hierarchy for organizing information.
(4) Yes, once I used Monte Carlo simulation of a continuous time, discrete state space Markov process to estimate the surviveability of the US SSBN fleet under a special scenario of global nuclear war limited to sea. So, it was potentially an enormously complicated calculation but due to the simplification of the Markov assumption, how the continuous time was handled with a Poisson process, and the Monte Carlo to do the numerical part, I got the whole project done in just two weeks.

btschaegg#
Since you mentioned regex, I'd add:

- Vim bindings and macros
- AWK
…and, if you'd like to generalize that, I'd say "throwaway programming" is generally a good skill to have. Many programmers don't get that not every problem should be solved in an elegant, robust and maintainable way. The important part is that you recognize when that isn't the case and that you are able to improvise in these situations.
There are, of course, also situations when you absolutely don't want to go the quick & dirty route, and recognizing those is just as important.

hermannj3145 replies#
Can someone elaborate on how they use reg ex as a productivity boost?

Do you use it for text transformation? How do you use it exactly? Do you use it as code itself or as a tool to help you explore/write code?
I am a huge fan of Macros, I 100% understand their role in text transformation, but what problem does regex solve? I spend so much time trying to remember the correct syntax, it only ever works for me when solving a specific code problem, but Ive never used it in one-off workflow problems.
Curious if I have missed some huge place where it is helpful.

throwuxiytayq#
Regexes are a bit of a double-edged sword. I rarely use them in code - I often find it more productive (and maintainable) to simply type out the verbose code for doing the string transformations. This depends on how good you are at writing/interpreting regexes and on what text manipulation tools your programming language/stdlib gives you. I imagine a compiled regex can often outperform naively-written code, though.

On the other hand, regexes saved my skin a couple of times when I needed to search/extract/modify/format a large number of text files (or one extremely big one). I suck at command line, so I usually open the file/folder in vscode and use their search/replace function. It's super useful for these "one shot" text operations.

irq-11 reply#
Editing large amounts of data. Notepad++ supports (some) regex find and replace, and I use it often to clean large lists or reformat data.
hermannj314#
Thanks for mentioning that this is in Notepad++. I've only ever used macros for line editing, never even tried regex search and replace. I gave it a shot and it is incredibly powerful.

Wow! Thank you.

lanstin#
I use them when there is some data hidden away with an unresponsive team as far as fetting a good api to read the data, and i don't have a lot of time, so i will just toss together a quick scraper from however the data is exposed (could be html, could be csv, could be some terrible json or xml format). I will use regexp, but even more crap like line.contains() or .endswith or line.split("nc]")[1] or json.get('whatevs',[{}])[0].get('sub1', {}) etc.

Dreadful, but fast enough to let everyone know, there are 58 Java 7 taking prod load within an hour of the meeting where it was assumed there are zero Java 7 apps.

rtourn1 reply#
A good text editor will have regex ability, and once you learn it, it’s super convenient to have it handy. Writing macros to do stuff is more of a hassle. RegEx is most useful for me as a super quick and easy way to solve a one off problem that isn’t important enough to write code to solve.

I once walked in on a coworker (who’s not a developer) who had copied a pdf into text and was laboriously scrolling through thousands of lines of text to remove footer text with page numbers. He spent hours doing this, it’s a 10 second problem with using regex.
In the same job, sometimes our clients would give me large files in the wrong format (like a word document) that couldn’t be normally be import. Notepad++ and some regex magic pulled out all the data I cared about in a minute. It would have taken years if my other coworker did it his way.

hermannj314#
Thanks for mentioning that use case of a footer with page numbers. I can understand how a RegEx would be powerful there.
lelele#
>> Do you use it for text transformation?

Mostly, yes. How often do you search and/or replace and/or extract text? Now imagine doing it while being able to specify patterns instead of just fixed text.
A couple examples:
- find all occurrences of some text only when near some other text, no matter the intervening text;
- transform calls to a routine to calls to another routine, while swapping arguments.
As for other tools, once you know them, you will find ways to use them.
Yes, their syntax can be difficult to remember, but most of the time you are going to use just a few patterns and will learn them by rote memorization. They will become second nature, and indeed I myself am sometimes surprised by the complexity of patterns that I write without thinking about it. Anyway, I recommend that you have handy a plugin for your text editor that highlights matches, to help in troubleshooting buggy regexes when they get convoluted.

rmellow1 reply#
Making assumptions & cutting down on scope are immensely powerful tools. There is a tendency among engineers to create systems that are universal and work in all sorts of environments, when in fact, this is not what is absolutely immediately needed, or is closer to a "nice to have".

A widespread example of this is linear regression analysis. Mathematically, it only works because we make assumptions about the data (and even these can be relaxed) & limiting the scope of the problems it can solve.
This also applies to delivering projects. A fully engineered & robust project could possibly require a great deal of human, physical resources and time. But if we start iterating over a list of problems your system solves (sorted by decreasing value), the project suddenly costs only a fraction of what it would otherwise.
This doesn't come for free though: your MUST understand the limitations & assumptions of your systems, otherwise you or someone will pay dearly. Look at Zillow & failure to understand its forecasting system. Look at so many other startups applying ML where it has no place.
Zillow's failure is the best case (though catastrophic): the principal paid the cost. But take something like Google, applying a fully automated system to make decisions about banning accounts. These are real world decisions that have a huge effect on people & businesses. In this case, Google saves money on providing human support & offsets the costs to third parties who often can't afford it.

amboo71 reply#
If only such assumptions were ever written down.

Load more comments