Skip to main content
Commonmark migration
Source Link

Both of these designs violate: Tell, don't ask.

It may be too late. The rest of your design, or your mind set, might be demanding the ask way of doing things. If not, consider a world where you don't ask BugTag what's going on at all. You tell it when it's time to do it's thing.

BugTag

 

display(): void

This way, BugTag is a behavior object not a data object (like String). It will still hold data but the data will be encapsulated so no other objects need to know about it. You will need to pass BugTag something to talk to when it displays. But you really shouldn't feel like you are obligated to return any data to anybody. This is your data. Guard it jealously.

Both of these designs violate: Tell, don't ask.

It may be too late. The rest of your design, or your mind set, might be demanding the ask way of doing things. If not, consider a world where you don't ask BugTag what's going on at all. You tell it when it's time to do it's thing.

BugTag

 

display(): void

This way, BugTag is a behavior object not a data object (like String). It will still hold data but the data will be encapsulated so no other objects need to know about it. You will need to pass BugTag something to talk to when it displays. But you really shouldn't feel like you are obligated to return any data to anybody. This is your data. Guard it jealously.

Both of these designs violate: Tell, don't ask.

It may be too late. The rest of your design, or your mind set, might be demanding the ask way of doing things. If not, consider a world where you don't ask BugTag what's going on at all. You tell it when it's time to do it's thing.

BugTag


display(): void

This way, BugTag is a behavior object not a data object (like String). It will still hold data but the data will be encapsulated so no other objects need to know about it. You will need to pass BugTag something to talk to when it displays. But you really shouldn't feel like you are obligated to return any data to anybody. This is your data. Guard it jealously.

Source Link
candied_orange
  • 114.5k
  • 27
  • 222
  • 352

Both of these designs violate: Tell, don't ask.

It may be too late. The rest of your design, or your mind set, might be demanding the ask way of doing things. If not, consider a world where you don't ask BugTag what's going on at all. You tell it when it's time to do it's thing.

BugTag


display(): void

This way, BugTag is a behavior object not a data object (like String). It will still hold data but the data will be encapsulated so no other objects need to know about it. You will need to pass BugTag something to talk to when it displays. But you really shouldn't feel like you are obligated to return any data to anybody. This is your data. Guard it jealously.