Skip to content

athornburg/ProxyAndObserverExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProxyAndObserverExample

Project 3 advanced OOP.


ProxyAndObserverExample

Project 3 advanced OOP.

Architecture

BlogPost implements the Proxy Pattern The blog post is created with an id, but none of the content of the blog is loaded (from the mock dao) until a peice of the information is requested. The point of this is to not do the expensive task of getting the images for the blog post that are presumably in a database

The BlogPostContainer and the driver (the client) implements the observer pattern.

The container is really just a list of posts. When the posts are loaded (the proxy loads the concrete blog post) the observer (BlogPostObserver objects) will be updated and will print to the terminal information from the posts;

The posts will print twice because when you use update the posts both observers in the driver will print

The Observer could have observed blogpost objects but we wanted to keep the two patterns separated from eachother in our example

Running from the command line

Execute the following commands

git clone https://github.com/athornburg/ProxyAndObserverExample.git
cd ProxyAndObserverExample
mvn clean
mvn package
sh target/bin/driver

About

Project 3 advanced OOP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages