← Back to context

Comment by DrScientist

11 hours ago

I think for people starting out - rule 5 isn't perhaps that obvious.

> Rule 5. Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.

If want to solve a problem - it's natural to think about logic flow and the code that implements that first and the data structures are an after thought, whereas Rule 5 is spot on.

Conputers are machines that transform an input to an output.

> If want to solve a problem - it's natural to think about logic flow and the code that implements that first and the data structures are an after thought, whereas Rule 5 is spot on.

It is?

How can you conceive of a precise idea of how to solve a problem without a similarly precise idea of how you intend to represent the information fundamental to it? They are inseparable.

  • Obviously they are linked - the question is where do you start your thinking.

    Do you start with the logical task first and structure the data second, or do you actually think about the data structures first?

    Let's say I have a optimisation problem - I have a simple scoring function - and I just want to find the solution with the best score. Starting with the logic.

    for all solutions, score, keep if max.

    Simple eh? Problem is it's a combinatorial solution space. The key to solving this before the entropic death of the universe is to think about the structure of the solution space.

I mean - no. If you're coming to a completely new domain you have to decide what the important entities are, and what transformations you want to apply.

Neither data structures nor algorithms, but entities and tasks, from the user POV, one level up from any kind of implementation detail.

There's no point trying to do something if you have no idea what you're doing, or why.

When you know the what and why you can start worrying about the how.

Iff this is your 50th CRUD app you can probably skip this stage. But if it's green field development - no.

  • Sure context is important - and the important context you appear to have missed is the 5 rules aren't about building websites. It's about solving the kind of problems which are easy to state but hard to do (well) .

    eg sort a list.