Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do programmers know what to code before they write any code? #609

Open
tieubao opened this issue Jan 15, 2025 · 1 comment
Open

How do programmers know what to code before they write any code? #609

tieubao opened this issue Jan 15, 2025 · 1 comment

Comments

@tieubao
Copy link
Owner

tieubao commented Jan 15, 2025

https://www.quora.com/How-do-programmers-know-what-to-code-before-they-write-any-code/answer/Andrew-Bromage


Let me let you in on a secret. It's not a very well-kept secret, but it must be a secret, because not very many programmers say what I'm about to say in the way that I'm about to say it.

Ready? OK, here it is.

The structure of a software component follows from the structure of the data that it has to deal with.

Here are some examples:

If your data looks like an array, then the code that deals with it looks like a loop.
If your data looks like an algebraic data type, then the code that deals with it looks like recursion.
If your data looks like a graph, then the code that deals with it looks like graph traversal.
That's where you start. Look at the data, and that will typically dictate what has to be done first.

EDIT

I didn't expect this answer to take off quite as much as it has.

This isn't a secret at all, it's the main idea behind structured programming. Data has structure, and therefore code that deals with structure data is also structured.

A lot of programming these days isn't algorithmic, and so in the real world, the first thing that's often written is a mock-up user interface so that the designers can iterate on it.

Nonetheless, the job of any nontrivial program is ultimately to transform data into other data. For the kind of work that will outlast “no code", this is the moneymaker.

@tieubao
Copy link
Owner Author

tieubao commented Jan 15, 2025

At the end of the day, there are only four things you can do with data.

Only if you’re a database. If you’re an algorithm, there’s only one thing you can do with data: transform it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant