int days;
int daysAferLastPurchase;
totalSalary = actualSalary * totalHours;
salaryPerDay = salaryPerHour * hoursPerDay;
private static final HashMap<String, String> capitalCityByProvince = new HashMap<>();
static {
capitalCityByProvince.put(province.ONTARIO, "Toronto");
capitalCityByProvince.put(province.QUEBEC, "Montreal");
capitalCityByProvince.put(province.MANITOBA, "Winnipeg");
}
String capitalCity = capitalCityByProvince.get(clientProvince);
String mainFilter = this.getMainFilter(); // bad...
String filterBySelectedRowInSummaryScreen = this.getFilterBySelectedRowInSummaryScreen(); // good!
Don't be afraid to make a name long. A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment. Use a naming convention that allows multiple words to be easily read in the function names, and then make use of those multiple words to give the function a name that says what it does.
Don't be afraid to spend time choosing a name. Indeed, you should try several different names and read the code with each in place. Modern IDEs like Eclipse or IntelliJ make it trivial to change names. Use one of those IDEs and experiment with different names until you find one that is as descriptive as you can make it.
Choosing descriptive names will clarify the design of the module in your mind and help you to improve it. It is not at all uncommon that hunting for a good name results in a favorable restructuring of the code.
DECLARE
l_count INTEGER;
BEGIN
l_count := list_of_books.COUNT;
IF l_count > 0 THEN
l_count := list_of_books(list_of_books.FIRST).page_count;
analyze_book(l_count);
END IF;
END;
DECLARE
l_book_count INTEGER;
l_page_count INTEGER;
BEGIN
l_book_count := list_of_books.COUNT;
IF l_book_count > 0 THEN
l_page_count:= list_of_books(list_of_books.FIRST).page_count;
analyze_book(l_page_count);
END IF;
END;
String ccm; // current calculation method
String pcm; // previous calculation method
if (portfolioIdsByTraderId.get(trader.getId()).containsKey(portfolio.getId())) {...}
Map<int, Map<int, int>> portfolioIdsByTraderId;
if (trader.canView(portfolio)) {...}