Java Reference
In-Depth Information
data manipulation, such as sampling, or merging of tables and
(2) JDM to create a classification model for each campaign.
For simplicity, we will implement all services of the business layer
in a single class called
CampaignOptimizer
. (This may not be the best
design choice, but we wanted to focus on the implementation of the
application.)
Because this chapter presents a lot of Java code, some naming con-
ventions for variable names have been adopted:
•
Input arguments are prefixed with
i
.
•
Output arguments are prefixed with
o
.
•
Member variables of objects are prefixed with
m
.
•
Local variables are prefixed with
l
.
12.1.3
Code Examples
This section details the code of the
CampaignOptimizer
class that fol-
lows the steps described earlier.
The constructor creates a new campaign optimization object with
a name and a creation date. Because our object must deal with some
basic data manipulations as well as data mining operations, we pro-
vide it with two valid connections (JDBC and JDM). This is reflected
in the following code:
1. public CampaignOptimizer(String iName,
2. java.sql.Connection iJDBCConnection,
3. Connection iJDMConnection) {
4. mName
iName;
5. mCreationDate
Calendar.getInstance().getTime();
6. mJDBCConnection
iJDBCConnection;
7. mJDMConnection
iJDMConnection;
8. }
The name of a
CampaignOptimizer
can be used by the persistence
layer to save and retrieve
CampaignOptimizer
objects from repositories.
The next step involves sampling customers for the starter cam-
paign, using a simple random sample as defined earlier for the first
implementation of our application.
Search WWH ::
Custom Search