标签:style blog color ar art div 代码 log sp
最简单的控制流:即按照先后顺序放置语句与语句块
尽管组织直线型的代码是一个简单的任务,但代码结构上的一些微妙之处还是会对代码质量、正确性、可读性和可维护性带来影响
// bad MarketingData marketingData; SalesData salesData; TravelData travelData; travelData.computeQuarterly(); salesData.computeQuarterly(); marketingData.computeQuarterly(); salesData.computeAnnual(); marketingData.computeAnnual(); travelData.computeAnnual(); marketingData.print(); slaesData.print(); travelData.print(); // good MarketingData marketingData; marketingData.computeQuarterly(); marketingData.computeAnnual(); marketingData.print(); SalesData salesData; salesData.computeQuarterly(); salesData.computeAnnual(); slaesData.print(); TravelData travelData; travelData.computeQuarterly(); travelData.computeAnnual(); travelData.print();
标签:style blog color ar art div 代码 log sp
原文地址:http://www.cnblogs.com/maozhige/p/3863317.html