DRY is about code, not data. If you see two methods do the same thing somewhere in their code blocks, separate the duplicate logic into a separate method, then call that method when you need to execute that logic.
The reason for this is maintainability. Say that logic needs to be changed. If you didn't break it out into a callable method, you'd have to find all the places you use that logic and change it. If it is a callable method, you only have to change the logic in one place, thus DRY.
When business decides it wants to change name formatting from "firstNamelastName" to "lastName,firstName", you only have to change the logic in the FormatName method because you "didn't repeat yourself."
No, it's about representation of information in a system, as your own Wikipedia link states right up at the top of the second paragraph. Code and data are both forms in which information may be represented ina a system.
>No, it's about representation of information in a system, as your own Wikipedia link states right up at the top of the second paragraph.
That's a little too broad to be useful, IMO. I learned the DRY principle before that book came out, and it was strictly about not repeating yourself in code. You can apply it to other things, but it was originally code. Normal form is a good example of applying DRY to RDBMS systems/schemas. "Single source of truth," is a good example of applying DRY to separate database systems. None of those were considered part of the DRY principle when I was starting out.
>They apply it quite broadly to include "database schemas, test plans, the build system, even documentation".
The article even hints those particular authors expanded on it beyond its original intent. They certainly didn't invent it.
The reason for this is maintainability. Say that logic needs to be changed. If you didn't break it out into a callable method, you'd have to find all the places you use that logic and change it. If it is a callable method, you only have to change the logic in one place, thus DRY.
https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
Here is an overly simplistic example:
If you see this scattered around your code:
Create this method and call it when you need it: When business decides it wants to change name formatting from "firstName lastName" to "lastName, firstName", you only have to change the logic in the FormatName method because you "didn't repeat yourself."