Ask HN: Does anyone use pseudocode in the real world?
Got into a chat with a friend (doing a CS degree) about pseudocode. I've always considered pseudocode useless, and I've never used it in practice. Just curious what other folks' experience is like.
21 comments
[ 6.1 ms ] story [ 58.8 ms ] threadTo me, it's comparable to writing a paper; I could never write a paper without a proper outline and knowing where I'm starting and where I'm going.
Languages like TLA+ can be considered as a form of pseudocode as they cannot be compiled down to code.
Yet TLA+ is used very much in the real world for describing complex algorithms.
You can probably just use LLMs to convert the pseudocode anyway.
I will note though that when I was in school there was an “official” pseudo code, and I’ve never met anyone who uses that. It’s usually just a lazy C syntax.
- In design docs:
- In code comments:Then there's always the joke about Ruby, where you just write pseudocode and the interpreter just runs it.
Besides, test-first development is inherently writing pseudocode where you write MagicFunction() and then TestMagicFunction() and iterate to flesh out both.
Also, who doesn't write a first pass of some code and then drops a comment that says /* handle special cases x, y and z here */ for later?
All of that is pseudocode.
Understanding the algorithm, the states, the model, the constraints, the dependencies, the properties,... at all times is what makes you an engineer.
Technical standards and publications about real life issues (like mutex, db management,...) often use pseudo code, because the actual implementation doesn't matter.
Pseudo code is also relevant because languages change anyway. And in some companies and industries, several teams use totally different codes you won't know of.
Coding right away is possible. But it's not the same job. You can be paid big for actually thinking through your code, and not just writing it.