Approach 1: Static methods
- The profile fetcher has a static method
- Before calculating trades, our tool will call the static method to fetch your profile
public class TradeCalculator {
public static Something calculateTrades(String userId) {
ProfileData data = ProfileFetcher.fetchProfile(userId)
// Do math !
}
}
public class ProfileFetcher {
public static ProfileData fetchProfile(String userId) {
// Complex SQL?
return userProfile;
}
}
20 / 31