upvote
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.

reply
> 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.

reply
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.

reply
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.

reply
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.

reply
A good chunk of great advice is obvious things that people still fail to do.

That's why a collection of "obvious" things formulated in a convincing way by a person with big street cred is still useful and worth elevating.

reply
Also, "why these 5 in particular" is definitely not obvious -- there are a great many possible "obvious in some sense but also true in an important way" epigrams to choose from (the Perlis link from another comment has over a hundred). That Pike picked these 5 to emphasise tells you something about his view of programming, and doubly so given that they are rather overlapping in what they're talking about.
reply
Can't be but so obvious if the first comment I saw here was that the first two rules didn't seem so important. =)
reply
Definitely not obvious to everybody.
reply
deleted
reply
You've got to elevate some obviously correct things, otherwise social media will fill the void with nonobviously incorrect things.
reply
Better to have 100 comments on one topic than 10 comments on 10 topics.
reply
I'd call it more derivative than obvious.

"Why quote someone who's just quoting someone else?" — Michael Scott — knorker

reply