Skip to main content
Software Engineering

Return to Answer

replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Source Link

What you said in your comment has some importance. Maybe you could design some kind of hierarchy. Instead of everything referencing the application, have it reference some kind of parent object in hierarchy. Application can have UI windows/frames, those have controls. App can have documents, that too have some children, etc.. Maybe you could create something much more specific than everything referencing the application root object.

I would also agree with Telastyn. The object should have reference to it's parent if it uses this parent in some way. Don't go blindly add parent references to every object even if it doesn't use it.

Also, if you are thinking about memory consumption and counting bytes, then .NET is not a good pick.

Edit: After reading your comments, there are few things I would like to reply to:

About the consistency of traversal. Just because the object has reference to it's parent doesn't mean it has to expose it. Usually, such information is implementation detail. So from the outside, all objects are the same. From the inside on the other hand, there is problem with your mentality. You should think of object in almost complete isolation. Thinking that "when X object have Y, then all objects should have Y, because it is consistent" is not good, because it increases coupling and decreases cohesion.

"what's really so wrong with asking the application what the active document is and then doing something with said document?" Because it doesn't clearly express intent of the class, that it is requiring data that changes. If for example you used events and there was DocumentChanged event, that the class subscribes to and is pushed the new document, then that clearly states the intent of the class.

Finally, about your comment about technical stuff vs. patterns. Design patterns and principles are clearly technical thing. They are way to structure your code in a way that clearly expresses their intent and allows for easy maintenance and modification. If they weren't mentioned in any of those books, then those books are probably quite bad. Also, I recommend reading : http://programmers.stackexchange.com/questions/219767/what-if-i-will-not-use-software-design-patterns What if I will not use Software Design Patterns?

And some nitpick: True engineer knows many tools, their strengths and weaknesses and knows when to use one over another. Saying you are fine with working only with one makes you look like a stupid code monkey instead of engineer.

What you said in your comment has some importance. Maybe you could design some kind of hierarchy. Instead of everything referencing the application, have it reference some kind of parent object in hierarchy. Application can have UI windows/frames, those have controls. App can have documents, that too have some children, etc.. Maybe you could create something much more specific than everything referencing the application root object.

I would also agree with Telastyn. The object should have reference to it's parent if it uses this parent in some way. Don't go blindly add parent references to every object even if it doesn't use it.

Also, if you are thinking about memory consumption and counting bytes, then .NET is not a good pick.

Edit: After reading your comments, there are few things I would like to reply to:

About the consistency of traversal. Just because the object has reference to it's parent doesn't mean it has to expose it. Usually, such information is implementation detail. So from the outside, all objects are the same. From the inside on the other hand, there is problem with your mentality. You should think of object in almost complete isolation. Thinking that "when X object have Y, then all objects should have Y, because it is consistent" is not good, because it increases coupling and decreases cohesion.

"what's really so wrong with asking the application what the active document is and then doing something with said document?" Because it doesn't clearly express intent of the class, that it is requiring data that changes. If for example you used events and there was DocumentChanged event, that the class subscribes to and is pushed the new document, then that clearly states the intent of the class.

Finally, about your comment about technical stuff vs. patterns. Design patterns and principles are clearly technical thing. They are way to structure your code in a way that clearly expresses their intent and allows for easy maintenance and modification. If they weren't mentioned in any of those books, then those books are probably quite bad. Also, I recommend reading : http://programmers.stackexchange.com/questions/219767/what-if-i-will-not-use-software-design-patterns

And some nitpick: True engineer knows many tools, their strengths and weaknesses and knows when to use one over another. Saying you are fine with working only with one makes you look like a stupid code monkey instead of engineer.

What you said in your comment has some importance. Maybe you could design some kind of hierarchy. Instead of everything referencing the application, have it reference some kind of parent object in hierarchy. Application can have UI windows/frames, those have controls. App can have documents, that too have some children, etc.. Maybe you could create something much more specific than everything referencing the application root object.

I would also agree with Telastyn. The object should have reference to it's parent if it uses this parent in some way. Don't go blindly add parent references to every object even if it doesn't use it.

Also, if you are thinking about memory consumption and counting bytes, then .NET is not a good pick.

Edit: After reading your comments, there are few things I would like to reply to:

About the consistency of traversal. Just because the object has reference to it's parent doesn't mean it has to expose it. Usually, such information is implementation detail. So from the outside, all objects are the same. From the inside on the other hand, there is problem with your mentality. You should think of object in almost complete isolation. Thinking that "when X object have Y, then all objects should have Y, because it is consistent" is not good, because it increases coupling and decreases cohesion.

"what's really so wrong with asking the application what the active document is and then doing something with said document?" Because it doesn't clearly express intent of the class, that it is requiring data that changes. If for example you used events and there was DocumentChanged event, that the class subscribes to and is pushed the new document, then that clearly states the intent of the class.

Finally, about your comment about technical stuff vs. patterns. Design patterns and principles are clearly technical thing. They are way to structure your code in a way that clearly expresses their intent and allows for easy maintenance and modification. If they weren't mentioned in any of those books, then those books are probably quite bad. Also, I recommend reading : What if I will not use Software Design Patterns?

And some nitpick: True engineer knows many tools, their strengths and weaknesses and knows when to use one over another. Saying you are fine with working only with one makes you look like a stupid code monkey instead of engineer.

added 1719 characters in body
Source Link
Euphoric
  • 38.2k
  • 6
  • 82
  • 120

What you said in your comment has some importance. Maybe you could design some kind of hierarchy. Instead of everything referencing the application, have it reference some kind of parent object in hierarchy. Application can have UI windows/frames, those have controls. App can have documents, that too have some children, etc.. Maybe you could create something much more specific than everything referencing the application root object.

I would also agree with Telastyn. The object should have reference to it's parent if it uses this parent in some way. Don't go blindly add parent references to every object even if it doesn't use it.

Also, if you are thinking about memory consumption and counting bytes, then .NET is not a good pick.

Edit: After reading your comments, there are few things I would like to reply to:

About the consistency of traversal. Just because the object has reference to it's parent doesn't mean it has to expose it. Usually, such information is implementation detail. So from the outside, all objects are the same. From the inside on the other hand, there is problem with your mentality. You should think of object in almost complete isolation. Thinking that "when X object have Y, then all objects should have Y, because it is consistent" is not good, because it increases coupling and decreases cohesion.

"what's really so wrong with asking the application what the active document is and then doing something with said document?" Because it doesn't clearly express intent of the class, that it is requiring data that changes. If for example you used events and there was DocumentChanged event, that the class subscribes to and is pushed the new document, then that clearly states the intent of the class.

Finally, about your comment about technical stuff vs. patterns. Design patterns and principles are clearly technical thing. They are way to structure your code in a way that clearly expresses their intent and allows for easy maintenance and modification. If they weren't mentioned in any of those books, then those books are probably quite bad. Also, I recommend reading : http://programmers.stackexchange.com/questions/219767/what-if-i-will-not-use-software-design-patterns

And some nitpick: True engineer knows many tools, their strengths and weaknesses and knows when to use one over another. Saying you are fine with working only with one makes you look like a stupid code monkey instead of engineer.

What you said in your comment has some importance. Maybe you could design some kind of hierarchy. Instead of everything referencing the application, have it reference some kind of parent object in hierarchy. Application can have UI windows/frames, those have controls. App can have documents, that too have some children, etc.. Maybe you could create something much more specific than everything referencing the application root object.

I would also agree with Telastyn. The object should have reference to it's parent if it uses this parent in some way. Don't go blindly add parent references to every object even if it doesn't use it.

Also, if you are thinking about memory consumption and counting bytes, then .NET is not a good pick.

What you said in your comment has some importance. Maybe you could design some kind of hierarchy. Instead of everything referencing the application, have it reference some kind of parent object in hierarchy. Application can have UI windows/frames, those have controls. App can have documents, that too have some children, etc.. Maybe you could create something much more specific than everything referencing the application root object.

I would also agree with Telastyn. The object should have reference to it's parent if it uses this parent in some way. Don't go blindly add parent references to every object even if it doesn't use it.

Also, if you are thinking about memory consumption and counting bytes, then .NET is not a good pick.

Edit: After reading your comments, there are few things I would like to reply to:

About the consistency of traversal. Just because the object has reference to it's parent doesn't mean it has to expose it. Usually, such information is implementation detail. So from the outside, all objects are the same. From the inside on the other hand, there is problem with your mentality. You should think of object in almost complete isolation. Thinking that "when X object have Y, then all objects should have Y, because it is consistent" is not good, because it increases coupling and decreases cohesion.

"what's really so wrong with asking the application what the active document is and then doing something with said document?" Because it doesn't clearly express intent of the class, that it is requiring data that changes. If for example you used events and there was DocumentChanged event, that the class subscribes to and is pushed the new document, then that clearly states the intent of the class.

Finally, about your comment about technical stuff vs. patterns. Design patterns and principles are clearly technical thing. They are way to structure your code in a way that clearly expresses their intent and allows for easy maintenance and modification. If they weren't mentioned in any of those books, then those books are probably quite bad. Also, I recommend reading : http://programmers.stackexchange.com/questions/219767/what-if-i-will-not-use-software-design-patterns

And some nitpick: True engineer knows many tools, their strengths and weaknesses and knows when to use one over another. Saying you are fine with working only with one makes you look like a stupid code monkey instead of engineer.

Source Link
Euphoric
  • 38.2k
  • 6
  • 82
  • 120

What you said in your comment has some importance. Maybe you could design some kind of hierarchy. Instead of everything referencing the application, have it reference some kind of parent object in hierarchy. Application can have UI windows/frames, those have controls. App can have documents, that too have some children, etc.. Maybe you could create something much more specific than everything referencing the application root object.

I would also agree with Telastyn. The object should have reference to it's parent if it uses this parent in some way. Don't go blindly add parent references to every object even if it doesn't use it.

Also, if you are thinking about memory consumption and counting bytes, then .NET is not a good pick.

lang-cs

AltStyle によって変換されたページ (->オリジナル) /