Live data from Hacker News

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

news.ycombinator.com

1–10 of 44 posts

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

#1
For me, I think it was database design that was most useful - things like normalization especially.

Binary search I use a few times for an ecommerce cart. I remember to avoid putting loops inside loops.

I use Don't Repeat Yourself (DRY) and SOLID principles for code design.

Besides that, I haven't used them all that much. Which do you find most useful?

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

#2
A lot of the "rules" you learn in school are treated like Rules when they are often more like "It Depends". Take DRY for example: It's all well and good to share code but you need to balance that against having to rebuild (possibly breaking) multiple projects that depend on the library.

That said, the Single Responsibility Principle and Separation of Concerns (the "S" in SOLID) are things that I find important to adhere to. The trick with many CS ideas is to apply from them from first principles.

Example: Instead of some rule like "Your functions should never be more than N lines long." you should instead, ask yourself if the function is trying to do too many things i.e. deviating from the Single Responsibility principle.

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

#3
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 exists in enterprise CRUD web apps for a 1.01x speedup.

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

#4
Hard CS is rarely needed in my projects but there are times that it's unfeasible to make things work without it.

My last project involved making calculations, clustering and specific spatial queries over a set of 4D points ( GPS + time ) there is no way to make competitive complex applications if no one in your team understands O-notation, Dynamic Programming, Euristics, Graphs Theory, etcetera.

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

#7
post #6
post #5

https://en.m.wikipedia.org/wiki/De_Morgan's_laws are incredibly useful when trying to analyze or simplify conditionals.

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.

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

#9

Hard CS is rarely needed in my projects but there are times that it's unfeasible to make things work without it. My last project involved making calculations, clustering and specific spatial queries over a set of 4D points ( GPS + time ) there is no way to make competitive complex applications if no one in your team understands O-notation, Dynamic Programming, Euristics, Graphs Theory, etcetera.

I assume this where a white-board comes into place and you teach them about O-notation, etc, right?

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

#10
https://en.wikipedia.org/wiki/Law_of_Demeter

Building services as utilities with generalized input/output interfaces that know as little about your application almost always results in better code. If I can write something that could easily be pulled out into a generic package and used on projects with totally different data models and business logic, then I've built something right.

Post reply on HN