Skip to main content
added 7 characters in body
Source Link
mtraceur
  • 269
  • 4
  • 10

"Premature abstraction" means (in a code review): "I think it is too early to tell what an appropriate abstraction to use is, and if we startingstart using thisthe abstraction you chose, it might make it harder to see and switch to a more appropriate abstraction later."

So if someone tells you your abstraction is "premature", here are some questions to review:

  1. What alternative ways of doing this code did you consider?
  2. How did you decide that this alternative, using this abstraction, is the most appropriate one?
  3. Are there any likely upcoming changes to this code that are big or imminent?
  4. When those changes are implemented, will this still be an appropriate abstraction?
  5. Will thinking about the problem in terms of this abstraction make it harder to spot when another abstraction becomes more appropriate?
  6. Will using this abstraction now make it harder to make those changes?

When people think our abstraction is premature, they might be having trouble seeing some part of these answers, or they're seeing a part that we aren't, or they disagree with us on how likely or significant or difficult some part is. From their perspective, the answers to the above questions probably don't add up to as favorable of an assessment of the abstraction.

Also, remember that in many projects, requirements are like sand: they shift and blow around over time and as things interact with them. Your question sounds like you expect that you can always get a good enough picture of what is needed to know if an abstraction is appropriate. But that's not always the case. Sometimes you don't and can't know soon enough, and sometimes you miss that you don't or can't know something relevant if you don't have enough experience with that thing.

Finally, read The Wrong Abstraction by Sandi Metz. This is a good example of how what seems like the right abstraction at one point in time can be the wrong abstraction in the future, or when you understand the problem better. When that's likely to happen soon enough to be a problem, "premature abstraction" is a good phrase for that. In particular, the All the Little Things presentation she links to in that article features an excellent example of this. Right at the moment that she says "duplication is far cheaper than the wrong abstraction", we're looking at two almost identically-shaped pieces of code which can give rise to the temptation to abstract away the commonality. And abstracting at that moment would be premature because if we do it based on just what's obvious from those two pieces of code we would come up with a different and less useful abstraction than if we waited for the next pieces of code.

"Premature abstraction" means (in a code review): "I think it is too early to tell what an appropriate abstraction to use is, and if we starting using this abstraction it might make it harder to see and switch to a more appropriate abstraction later."

So if someone tells you your abstraction is "premature", here are some questions to review:

  1. What alternative ways of doing this code did you consider?
  2. How did you decide that this alternative, using this abstraction, is the most appropriate one?
  3. Are there any likely upcoming changes to this code that are big or imminent?
  4. When those changes are implemented, will this still be an appropriate abstraction?
  5. Will thinking about the problem in terms of this abstraction make it harder to spot when another abstraction becomes more appropriate?
  6. Will using this abstraction now make it harder to make those changes?

When people think our abstraction is premature, they might be having trouble seeing some part of these answers, or they're seeing a part that we aren't, or they disagree with us on how likely or significant or difficult some part is. From their perspective, the answers to the above questions probably don't add up to as favorable of an assessment of the abstraction.

Also, remember that in many projects, requirements are like sand: they shift and blow around over time and as things interact with them. Your question sounds like you expect that you can always get a good enough picture of what is needed to know if an abstraction is appropriate. But that's not always the case. Sometimes you don't and can't know soon enough, and sometimes you miss that you don't or can't know something relevant if you don't have enough experience with that thing.

Finally, read The Wrong Abstraction by Sandi Metz. This is a good example of how what seems like the right abstraction at one point in time can be the wrong abstraction in the future, or when you understand the problem better. When that's likely to happen soon enough to be a problem, "premature abstraction" is a good phrase for that. In particular, the All the Little Things presentation she links to in that article features an excellent example of this. Right at the moment that she says "duplication is far cheaper than the wrong abstraction", we're looking at two almost identically-shaped pieces of code which can give rise to the temptation to abstract away the commonality. And abstracting at that moment would be premature because if we do it based on just what's obvious from those two pieces of code we would come up with a different and less useful abstraction than if we waited for the next pieces of code.

"Premature abstraction" means (in a code review): "I think it is too early to tell what an appropriate abstraction to use is, and if we start using the abstraction you chose, it might make it harder to see and switch to a more appropriate abstraction later."

So if someone tells you your abstraction is "premature", here are some questions to review:

  1. What alternative ways of doing this code did you consider?
  2. How did you decide that this alternative, using this abstraction, is the most appropriate one?
  3. Are there any likely upcoming changes to this code that are big or imminent?
  4. When those changes are implemented, will this still be an appropriate abstraction?
  5. Will thinking about the problem in terms of this abstraction make it harder to spot when another abstraction becomes more appropriate?
  6. Will using this abstraction now make it harder to make those changes?

When people think our abstraction is premature, they might be having trouble seeing some part of these answers, or they're seeing a part that we aren't, or they disagree with us on how likely or significant or difficult some part is. From their perspective, the answers to the above questions probably don't add up to as favorable of an assessment of the abstraction.

Also, remember that in many projects, requirements are like sand: they shift and blow around over time and as things interact with them. Your question sounds like you expect that you can always get a good enough picture of what is needed to know if an abstraction is appropriate. But that's not always the case. Sometimes you don't and can't know soon enough, and sometimes you miss that you don't or can't know something relevant if you don't have enough experience with that thing.

Finally, read The Wrong Abstraction by Sandi Metz. This is a good example of how what seems like the right abstraction at one point in time can be the wrong abstraction in the future, or when you understand the problem better. When that's likely to happen soon enough to be a problem, "premature abstraction" is a good phrase for that. In particular, the All the Little Things presentation she links to in that article features an excellent example of this. Right at the moment that she says "duplication is far cheaper than the wrong abstraction", we're looking at two almost identically-shaped pieces of code which can give rise to the temptation to abstract away the commonality. And abstracting at that moment would be premature because if we do it based on just what's obvious from those two pieces of code we would come up with a different and less useful abstraction than if we waited for the next pieces of code.

added 636 characters in body
Source Link
mtraceur
  • 269
  • 4
  • 10

"Premature abstraction" means (in a code review): "I think it is too early to tell what an appropriate abstraction to use is, and if we starting using this abstraction it might make it harder to see and switch to a more appropriate abstraction later."

So if someone tells you your abstraction is "premature", here are some questions to review:

  1. What alternative ways of doing this code did you consider?
  2. How did you decide that this alternative, using this abstraction, is the most appropriate one?
  3. Are there any likely upcoming changes to this code that are big or imminent?
  4. When those changes are implemented, will this still be an appropriate abstraction?
  5. Will thinking about the problem in terms of this abstraction make it harder to spot when another abstraction becomes more appropriate?
  6. Will using this abstraction now make it harder to make those changes?

When people think our abstraction is premature, they might be having trouble seeing some part of these answers, or they're seeing a part that we aren't, or they disagree with us on how likely or significant or difficult some part is. From their perspective, the answers to the above questions probably don't add up to as favorable of an assessment of the abstraction.

Also, remember that in many projects, requirements are like sand: they shift and blow around over time and as things interact with them. Your question sounds like you expect that you can always get a good enough picture of what is needed to know if an abstraction is appropriate. But that's not always the case. Sometimes you don't and can't know soon enough, and sometimes you miss that you don't or can't know something relevant if you don't have enough experience with that thing.

Finally, read The Wrong AbstractionThe Wrong Abstraction by Sandi Metz. This is a good example of how what seems like the right abstraction at one point in time can be the wrong abstraction in the future, or when you understand the problem better. When that's likely to happen soon enough to be a problem, "premature abstraction" is a good phrase for that. In particular, the All the Little Things presentation she links to in that article features an excellent example of this. Right at the moment that she says "duplication is far cheaper than the wrong abstraction", we're looking at two almost identically-shaped pieces of code which can give rise to the temptation to abstract away the commonality. And abstracting at that moment would be premature because if we do it based on just what's obvious from those two pieces of code we would come up with a different and less useful abstraction than if we waited for the next pieces of code.

"Premature abstraction" means (in a code review): "I think it is too early to tell what an appropriate abstraction to use is, and if we starting using this abstraction it might make it harder to see and switch to a more appropriate abstraction later."

So if someone tells you your abstraction is "premature", here are some questions to review:

  1. What alternative ways of doing this code did you consider?
  2. How did you decide that this alternative, using this abstraction, is the most appropriate one?
  3. Are there any likely upcoming changes to this code that are big or imminent?
  4. When those changes are implemented, will this still be an appropriate abstraction?
  5. Will thinking about the problem in terms of this abstraction make it harder to spot when another abstraction becomes more appropriate?
  6. Will using this abstraction now make it harder to make those changes?

When people think our abstraction is premature, they might be having trouble seeing some part of these answers, or they're seeing a part that we aren't, or they disagree with us on how likely or significant or difficult some part is. From their perspective, the answers to the above questions probably don't add up to as favorable of an assessment of the abstraction.

Also, remember that in many projects, requirements are like sand: they shift and blow around over time and as things interact with them. Your question sounds like you expect that you can always get a good enough picture of what is needed to know if an abstraction is appropriate. But that's not always the case. Sometimes you don't and can't know soon enough, and sometimes you miss that you don't or can't know something relevant if you don't have enough experience with that thing.

Finally, read The Wrong Abstraction by Sandi Metz. This is a good example of how what seems like the right abstraction at one point in time can be the wrong abstraction in the future, or when you understand the problem better. When that's likely to happen soon enough to be a problem, "premature abstraction" is a good phrase for that.

"Premature abstraction" means (in a code review): "I think it is too early to tell what an appropriate abstraction to use is, and if we starting using this abstraction it might make it harder to see and switch to a more appropriate abstraction later."

So if someone tells you your abstraction is "premature", here are some questions to review:

  1. What alternative ways of doing this code did you consider?
  2. How did you decide that this alternative, using this abstraction, is the most appropriate one?
  3. Are there any likely upcoming changes to this code that are big or imminent?
  4. When those changes are implemented, will this still be an appropriate abstraction?
  5. Will thinking about the problem in terms of this abstraction make it harder to spot when another abstraction becomes more appropriate?
  6. Will using this abstraction now make it harder to make those changes?

When people think our abstraction is premature, they might be having trouble seeing some part of these answers, or they're seeing a part that we aren't, or they disagree with us on how likely or significant or difficult some part is. From their perspective, the answers to the above questions probably don't add up to as favorable of an assessment of the abstraction.

Also, remember that in many projects, requirements are like sand: they shift and blow around over time and as things interact with them. Your question sounds like you expect that you can always get a good enough picture of what is needed to know if an abstraction is appropriate. But that's not always the case. Sometimes you don't and can't know soon enough, and sometimes you miss that you don't or can't know something relevant if you don't have enough experience with that thing.

Finally, read The Wrong Abstraction by Sandi Metz. This is a good example of how what seems like the right abstraction at one point in time can be the wrong abstraction in the future, or when you understand the problem better. When that's likely to happen soon enough to be a problem, "premature abstraction" is a good phrase for that. In particular, the All the Little Things presentation she links to in that article features an excellent example of this. Right at the moment that she says "duplication is far cheaper than the wrong abstraction", we're looking at two almost identically-shaped pieces of code which can give rise to the temptation to abstract away the commonality. And abstracting at that moment would be premature because if we do it based on just what's obvious from those two pieces of code we would come up with a different and less useful abstraction than if we waited for the next pieces of code.

Source Link
mtraceur
  • 269
  • 4
  • 10

"Premature abstraction" means (in a code review): "I think it is too early to tell what an appropriate abstraction to use is, and if we starting using this abstraction it might make it harder to see and switch to a more appropriate abstraction later."

So if someone tells you your abstraction is "premature", here are some questions to review:

  1. What alternative ways of doing this code did you consider?
  2. How did you decide that this alternative, using this abstraction, is the most appropriate one?
  3. Are there any likely upcoming changes to this code that are big or imminent?
  4. When those changes are implemented, will this still be an appropriate abstraction?
  5. Will thinking about the problem in terms of this abstraction make it harder to spot when another abstraction becomes more appropriate?
  6. Will using this abstraction now make it harder to make those changes?

When people think our abstraction is premature, they might be having trouble seeing some part of these answers, or they're seeing a part that we aren't, or they disagree with us on how likely or significant or difficult some part is. From their perspective, the answers to the above questions probably don't add up to as favorable of an assessment of the abstraction.

Also, remember that in many projects, requirements are like sand: they shift and blow around over time and as things interact with them. Your question sounds like you expect that you can always get a good enough picture of what is needed to know if an abstraction is appropriate. But that's not always the case. Sometimes you don't and can't know soon enough, and sometimes you miss that you don't or can't know something relevant if you don't have enough experience with that thing.

Finally, read The Wrong Abstraction by Sandi Metz. This is a good example of how what seems like the right abstraction at one point in time can be the wrong abstraction in the future, or when you understand the problem better. When that's likely to happen soon enough to be a problem, "premature abstraction" is a good phrase for that.