Live data from Hacker News

Ask HN: What are useful CS theories you actually use at work?

news.ycombinator.com

11–20 of 44 posts

Re: Ask HN: What are useful CS theories you actually use at work?

#11
Understanding algorithmic complexity was highly useful for me recently when moving a system from inefficient prototype to full-scale version. Complexity theory helped me out with determining the exact pain points in my design and what needed to be altered how (which was most of it). Similarly, graph theory heavily influenced that initial design, which was far more elegant. When moving that system from a single-threaded program that ran on one core into a distributed system running on dozens of VM's with an 'eventually consistent' datastore between them, I tapped into classes on network theory, distributed computing, and operating systems.

Also, during the original design, I tapped into theory of functional programming in coming up with a highly functional architecture (even though the 'functions' are actually abstract processes on a virtual machine).

I'm a big proponent of theoretical CS!

Re: Ask HN: What are useful CS theories you actually use at work?

#12
Graph theory, all the time.

Our product basically allows users to build a whole bunch of assets (specifically, LOB wrappers, workflows and forms). These may depend on each other (e.g. a workflow displays a form, which displays data from LOB). If you want to redeploy those to a new environment in the correct order, that's a graph problem: topological sort (and you need to find cyclic dependencies, i.e. strongly-connected-components).

You cache users from upstream identity providers (such as Google or Azure AD) primarily because those providers can be horribly slow. You want to determine if a user is [recursively] part of a group, keeping in mind that some providers (Azure AD) allow for cyclic group memberships. Another graph problem: reachability. You want to take that same graph and cache it on nodes that query frequently. There's a paper for that[1] (pre-order and post-order numbering).

Lately, everything seems to be a graph problem - but I may just be wearing graph-tinted lenses. If you've never bumped into graph theory, there's probably a system somewhere that's a lot more complex than it needs to be.

[1]: https://eprint.iacr.org/2012/352.pdf

Re: Ask HN: What are useful CS theories you actually use at work?

#13

Amdahl's law, by far. I find myself explaining it on almost a daily basis. I work on big enterprise software and our junior engineers tend to enjoy optimizing a piece of some system, without realizing that the speedup of the system as a whole will be negligible. I find performance / architecture stuff in general to be useful to know, along with having an intuition for orders of magnitude. Too much needless complexity…

I've found the speed of the framework generally matters more than what you do with it for the same reason. The size of the framework often dwarfs any application built with it these days.

We have a huge project in Spring Boot that crawls along, and a newer one in Dropwizard that's so fast we could support 1000x our current traffic. Funny because they both use Hibernate and JAX-RS to do roughly the same thing

Re: Ask HN: What are useful CS theories you actually use at work?

#15
I see dependency injection as writing functions as combinators and I frequently use category theory constructs. I work mainly with functional programming. Also lambda calculus helps me think about abstractions.

Understanding compilers and interpreters gives a lot of insight into speeding things up and making code and program easier to be statically analysed.

Automata and state machines are useful. Algorithmic complexity helps avoiding hard problems.

I see model theory directly when modeling domains.

Re: Ask HN: What are useful CS theories you actually use at work?

#16

Understanding algorithmic complexity was highly useful for me recently when moving a system from inefficient prototype to full-scale version. Complexity theory helped me out with determining the exact pain points in my design and what needed to be altered how (which was most of it). Similarly, graph theory heavily influenced that initial design, which was far more elegant. When moving that system from a single-thread…

Knowing CS is extremely important. That's the difference between being a modern day factory worker and a high value expert.

Re: Ask HN: What are useful CS theories you actually use at work?

#17
Data structures class - understanding the variations of even a List and which to use based on how I read and grow it. Queues, Maps, Indexes, Trees... all the time.

Software Engineering - hated it while in school, thought it was overkill. Then spent time on a hundred man year project - super important.

Programming Languages - having recently moved from Java to Ruby, this class was the bridge to make that transition smooth, having understood the theory of languages first.

Others have said database and data modeling.

Scientific Computing - was implementing some crazy PhD modeling from Matlab and actually had to think about float vs double, summation/multiplication techniques of large sets and their compounding errors, solving techniques (like least squares).

Basically, every software job that i’ve had that wasn’t building a website required my degree.

Re: Ask HN: What are useful CS theories you actually use at work?

#18
post #7
post #6

Earlier quoted context omitted.

Mind explaining how exactly de Morgan’s law comes up in your day to day?

Whenever I'm trying to understand a complex if statement that someone else (or past me) wrote, transforming the conditional to contain only 'or' or 'and' but not both often makes the logic clearer. I also find myself transforming new conditions for understandability before committing. For really tricky cases, I'll use a Karnaugh map, but those don't come up very often.

Understood, (Sorry commented before your edit).

Interesting that you've actually seen complex enough cases to actually need a Karnaugh map, definitely one of the things I learned in class and proceeded to never use again.

Re: Ask HN: What are useful CS theories you actually use at work?

#20
post #12

Graph theory, all the time. Our product basically allows users to build a whole bunch of assets (specifically, LOB wrappers, workflows and forms). These may depend on each other (e.g. a workflow displays a form, which displays data from LOB). If you want to redeploy those to a new environment in the correct order, that's a graph problem: topological sort (and you need to find cyclic dependencies, i.e. strongly-connec…

I've worked in several different fields: financial analytics, network monitoring, enterprise storage, and most recently electronic design automation. Each of them has involved different sets of formal theories. Sometimes combinatorics has come in handy, sometimes relational algebra, sometimes binary arithmetic, and so on.

Off the top of my head, I can only think of two that have been universally useful in all of them, and they have been very useful too. Graph theory comes straight to mind, and the only thing that might rival it is automata theory (including formal languages).

Graph theory and automata theory often prove to be useful even in problems that aren't conventionally thought of as graph problems or automata problems, but once you get a good grasp on them, you start to recognize patterns in problems (or sub-problems) that naturally lend themselves to elegant solutions if the problem is re-framed from the perspective of the appropriate theory. I've wound up on several projects where the requirements seemed really complex and gnarly at first glance, but we would be able to create successful, maintainable, extensible systems whose architectures essentially consisted of a chain of ETL ⇒ {graph,automaton}+ ⇔ UI — basically the same shape as the conventional compiler pipeline but applied to data, and sometimes interactive.

Graphs are extremely versatile as data structures, with well-studied properties, subtypes, and algorithms. Automata are similarly versatile as models of processes, and similarly well-studied.

The two are easily combined. One project in particular would take in a set of rules from the user, construct an automaton out of it, feed data through it, which would generate yet another automaton that doubled as a digraph. This autographaton modeled the control flow of the former automaton during execution, amenable to graph algorithms (search, flow, sort, pattern matching, etc.), arbitrarily modifiable by the user, and executable to generate an arbitrary amount of mock data that had the same characteristics (as defined by the input rules) as the data that it characterized. It was designed to aid in the analysis and simulation of network traffic, but it wound up being general enough that people in other parts of the company started using it for other things, too (that I knew of at the time I left the company: I/O loads, software testing, and automated bug report arbitrage using core dumps).

You could probably write such a program without any understanding of the theories involved, but I think that knowing the theories had some definite benefits. The theories led the program to be structured in a clean, elegant, modular, and straightforward way. They helped the program be general yet powerful and useful. Importantly, they helped the program to operate in such a way (and to present such an interface) that was intuitive for the tasks—and the people—it was designed for. I absolutely credit the solid theoretical foundations with the success of the program, and I've gone on to design programs with similar foundations yet intended for different sorts of tasks—and people—that have also been rather successful, though, admittedly, perhaps not so generically applicable.

Post reply on HN