This project implements an application for email auto-generation based on specific customer types. A company needs to send customer specific emails to their different types of customers, i.e., Business, Returning, Frequent, New, and VIP. This application generates emails from a base template for these different types of customers.
This project uses the factory method pattern, which defines an interface for creating an object, but let subclasses decide which class to instantiate. This application has the following participants:
- Product: Customer
- ConcreteProduct: Business, Returning, Frequent, New, VIP
- Creator: Factory
- ConcreteCreator: CustomerFactory
- Flexibility: Creating objects using factory method is more flexible than creating an object directly.
- ConcreteCustomer objects are created at runtime, which adds flexibility.
- Future products (i.e, type of customer) can be added by simply implementing the Customer interface.
- Modularity: This application is divided into well-defined parts - creator and product.
- Cohesion: Like-minded class are grouped together. For example, Business, Returning, etc. are in the product package.
We use Apache Maven to compile and run this project.
You need to install Apache Maven (https://maven.apache.org/) on your system.
Type on the command line:
mvn clean compile
mvn clean compile assembly:single
mvn -q clean compile exec:java -Dexec.executable="edu.bu.met.cs665.Main"
mvn clean compile test checkstyle:check spotbugs:check
To see bug detail using the Findbugs GUI, use the following command "mvn findbugs:gui"
Or you can create a XML report by using
mvn spotbugs:gui
or
mvn spotbugs:spotbugs
mvn spotbugs:check
check goal runs analysis like spotbugs goal, and make the build failed if it found any bugs.
For more info see https://spotbugs.readthedocs.io/en/latest/maven.html
SpotBugs https://spotbugs.github.io/ is the spiritual successor of FindBugs.
CheckStyle code styling configuration files are in config/ directory. Maven checkstyle plugin is set to use google code style. You can change it to other styles like sun checkstyle.
To analyze this example using CheckStyle run
mvn checkstyle:check
This will generate a report in XML format
target/checkstyle-checker.xml
target/checkstyle-result.xml
and the following command will generate a report in HTML format that you can open it using a Web browser.
mvn checkstyle:checkstyle
target/site/checkstyle.html