Question: In Java, 1. Design and Implement using Observer and Strategy a blogging application where each observer can pick a strategy to handle the received blog

In Java, In Java, 1. Design and Implement using Observer and Strategy a bloggingapplication where each observer can pick a strategy to handle the received

1. Design and Implement using Observer and Strategy a blogging application where each observer can pick a strategy to handle the received blog message. In this design, blog is the subject and user is the observer. Draw the UML and Class hierarchy diagrams for the subject and observer Classes - interface and concrete implementations. The interface for subject should include registerObserver(...), notifyObserver(...), unregisterObserver(...) methods. The interface for observer should include an acceptBlog (...) method. 2. Implement the concrete subject and observer interfaces as Blog and User, respectively. The concrete subject will use an ArrayList to track registered observers. The User object will have variables for user's email (uniquelD) and total blogs the user has posted. The Blog Class will have a postNewArcticle(...) method post new blog. The parameters for this method are Observer posting the blog, blogTitle, and blogMessage. The User Class will have a method to accept the data with user object posting to blog, blogTitle and blogMessage. 3. Implement 3 User Class objects can take different actions on received message - display the message, log/save the message, and count the number of blogs posted followed by emailing the user the count. Note that this is a behavior and should be implemented as Strategy pattern where User object refers to the strategy it wants to use 4. The Strategy Pattern implementation consists of classes for displaying the message, saving the message, and emailing the blog poster how many messages he/she has posted. 5. Implement a TestDriver main method to instantiate Blog objects, 3 User Objects, with each User object referencing a different action Strategy object (Display, Log/Save, count total messages for a user and show the total). The instantiated user objects are registered with the blog object as observers. Invoke the postNewArcticle(...) method to post messages from User objects and verify observer and strategy pattens work as designed. 1. Design and Implement using Observer and Strategy a blogging application where each observer can pick a strategy to handle the received blog message. In this design, blog is the subject and user is the observer. Draw the UML and Class hierarchy diagrams for the subject and observer Classes - interface and concrete implementations. The interface for subject should include registerObserver(...), notifyObserver(...), unregisterObserver(...) methods. The interface for observer should include an acceptBlog (...) method. 2. Implement the concrete subject and observer interfaces as Blog and User, respectively. The concrete subject will use an ArrayList to track registered observers. The User object will have variables for user's email (uniquelD) and total blogs the user has posted. The Blog Class will have a postNewArcticle(...) method post new blog. The parameters for this method are Observer posting the blog, blogTitle, and blogMessage. The User Class will have a method to accept the data with user object posting to blog, blogTitle and blogMessage. 3. Implement 3 User Class objects can take different actions on received message - display the message, log/save the message, and count the number of blogs posted followed by emailing the user the count. Note that this is a behavior and should be implemented as Strategy pattern where User object refers to the strategy it wants to use 4. The Strategy Pattern implementation consists of classes for displaying the message, saving the message, and emailing the blog poster how many messages he/she has posted. 5. Implement a TestDriver main method to instantiate Blog objects, 3 User Objects, with each User object referencing a different action Strategy object (Display, Log/Save, count total messages for a user and show the total). The instantiated user objects are registered with the blog object as observers. Invoke the postNewArcticle(...) method to post messages from User objects and verify observer and strategy pattens work as designed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!