Java Reference
In-Depth Information
mode doesn't use session replication (high availability) or the EE platform-based security,
and though it can access an enterprise resource (i.e., a database), in most examples it just
makes up random data. In SE mode, it mimics some actual (but quick) calculations: there is,
for example, no GUI or user interaction occurring.
Mesobenchmarks are also good for automated testing, particularly at the module level.
1. Good microbenchmarks are hard to write and offer limited value. If you must use
them, do so for a quick overview of performance, but don't rely on them.
2. Testing an entire application is the only way to know how code will actually run.
3. Isolating performance at a modular or operational level—a mesobench-
mark—offers a reasonable compromise but is no substitute for testing the full ap-
Common Code Examples
Many of the examples throughout the topic are based on a sample application that calculates
the “historical” high and low price of a stock over a range of dates, as well as the standard
deviation during that time. Historical is in quotes here because in the application, all the data
is fictional; the prices and the stock symbols are randomly generated.
The full source code for all examples in this topic are on my GitHub page , but this section
covers basic points about the code. The basic object within the application is a StockPrice
object that represents the price range of a stock on a given day:
public interface
interface StockPrice
StockPrice {
String getSymbol ();
Date getDate ();
BigDecimal getClosingPrice ();
BigDecimal getHigh ();
BigDecimal getLow ();
BigDecimal getOpeningPrice ();
boolean isYearHigh ();
boolean isYearLow ();
Search WWH ::

Custom Search