|
The case of the mysterious date translator
My colleague wrote a test case prior to coding a function that performed some date calculations and translations to display such phrases as "Last week" and "yesterday." After completing the test case, he coded the function and ran the unit test against it. Strangely, the method passed when it ran between 12:01 a.m. and 11:59 p.m. but mysteriously failed from noon to 11:59 a.m.
The big question here is, would this bug have been found if it weren't for consistent, repeatable, hourly testing? Would periodic manual testing have been able to catch it? Would the QA team have caught it? The truth of the matter is that this application could have very well been handed over to the customer with this bug still in place, potentially butchering a near 15-year relationship if the application went straight to production.
8. Tackle mountains, not molehills
The potential for performance bottlenecks is far greater with SaaS applications than with "thick" client applications that run from the desktop. Even veteran programmers will admit that when it comes to SaaS applications, sometimes performance bottlenecks are difficult to predict because of the number of variables involved. The difference between successful SaaS applications and those that fail is the way in which the development team responds to detrimental performance hits during load testing and profiling.
Generally speaking, there are only two types of performance optimizations: those that make a noticeable impact on performance and those that don't seem to have any noticeable results at all. Rarely is there anything in between. A common metaphor used in this regard is that of mountains and molehills. Nine times out of 10, developers spend the majority of time allocated to boosting performance, stomping on molehills rather than tackling gargantuan problems beating the life out of the computer's processor or memory while the application is running. The important thing to take away here is that as a programmer, you cannot see the mountain when you are too busy looking at the molehills.
The easiest way to prevent being distracted by the molehills is to profile your applications. Profiling is an important part of successful SaaS projects because it gives you the opportunity to optimize the way your application uses system resources, as shown in Figure 8. When you profile an application, you are able to see exactly which pieces of the application are taking up the most resources and implement design patterns for increased performance. For example, you may find it necessary to implement object pooling with proxies if you find a lot of object reinstantiation without the necessary garbage collection, which continuously eats up more memory for as long as you leave the application running.
Figure 8. Application profiling in Eclipse |
-
8.jpg
(58.53 KB, 下载次数: 2)
|