You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
"Would there ever be a reason to have a method that takes a Person, but doesn't know if it's a Student or a Teacher?" - Sure: the Person's name changes. "how do you know if the classes are really related in your domain?" - Okay, and if we determine that they really are related, what then?8bittree– 8bittree2022-02-18 15:56:35 +00:00Commented Feb 18, 2022 at 15:56
-
@8bittree If they really are, then I think it's okay for them to have a common base class. But if they aren't, and the person's name changes, you can just change it on the Student, or on the Teacher, as appropriate.David Conrad– David Conrad2022-02-18 18:59:36 +00:00Commented Feb 18, 2022 at 18:59
-
So, embrace the very painful problems of a common base class, and/or enjoy de-synchronization issues?8bittree– 8bittree2022-02-18 19:43:42 +00:00Commented Feb 18, 2022 at 19:43
-
@8bittree As I said, I don't think there actually are any very painful problems, just a class that isn't pulling its weight, and obviously it is a matter of opinion whether it is pulling its weight. As for the synchronization issues, if the roles are treated as distinct, it wouldn't be an issue.David Conrad– David Conrad2022-02-18 20:15:30 +00:00Commented Feb 18, 2022 at 20:15
-
"As for the synchronization issues, if the roles are treated as distinct, it wouldn't be an issue." Bob the Student and Teacher fills out and submits the paperwork to change his address. A week later he's received his report card and is wondering where his paycheck is because his address was updated in his Student object, but not in his Teacher object, resulting in his paycheck going to his old address. Also, he keeps getting double notifications every time the school closes for bad weather, because his phone number is in both objects.8bittree– 8bittree2022-02-18 21:28:39 +00:00Commented Feb 18, 2022 at 21:28
|
Show 4 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you