Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation History Refactoring - Design Patterns #39

Open
milkdromeda opened this issue Dec 11, 2022 · 0 comments
Open

Conversation History Refactoring - Design Patterns #39

milkdromeda opened this issue Dec 11, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@milkdromeda
Copy link
Contributor

milkdromeda commented Dec 11, 2022

  • Observer

    • Usage: The view can observe the viewmodel for the use cases of sending a message and displaying the conversation history. The viewmodel contains the information to be displayed to the view -- this information will be constantly updated by the presenter. When this happens, the view will updated as well as it is observing the viewmodel.
  • Builder

    • Usage: This design pattern can extend the current factory design pattern used for creating messages, allowing the construction of more complex messages.
    • A specific usage is the following: I am considering adding a message that requires a reply by a certain time. (These kind of messages might be useful for important announcements and getting feedback from participants in a chat in a timely fashion.) It might store additional parameters that are not needed by other message types, such as a LocalDateTime of when a response is expected and a boolean of whether a user has responded to the message. The issue here is that a message factory will take in a long list of parameters (many of which will not be used). To address this, I can introduce a builder class with methods that will initialize one parameter (e.g. whether a user has responded). For a certain message type, I can then build a message one step at a time without having to use all the steps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant