Code Illustration Using Java
Using the stock trading example mentioned above, the following Java examples show how coupled (manually injected) dependencies and framework-injected dependencies are typically staged.
The following interface contracts define the behavior of components in the sample system.
public interface IOnlineBrokerageService { String getStockSymbols; double getAskingPrice(String stockSymbol); double getOfferPrice(String stockSymbol); void putBuyOrder(String stockSymbol, int shares, double bidPrice); void putSellOrder(String stockSymbol, int shares, double offerPrice); } public interface IStockAnalysisService { double getEstimatedValue(String stockSymbol); } public interface IAutomatedStockTrader { void executeTrades; }Read more about this topic: Dependency Injection
Famous quotes containing the words code and/or illustration:
“... the self respect of individuals ought to make them demand of their leaders conformity with an agreed-upon code of ethics and moral conduct.”
—Mary Barnett Gilson (1877?)
“An illustration is no argument,nor do I maintain the wiping of a looking-glass clean, to be a syllogism;Mbut you all, may it please your worships, see the better for it.”
—Laurence Sterne (17131768)
Related Phrases
Related Words