You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: