Check your work

Well, last blog I said that testing your code is a good idea. It turns out that it's also a good idea to have other people test your code: They catch all sorts of issues that you don't, because you've overlooked them, because your tests don't catch them, or because you didn't think that something like that would really be that big of a deal. It's also much better that your co-workers catch those issues, rather than your customers.

 Take,  for example, my code. Immediately upon making a pool that would resize itself in a predictable way, I set about trying to make a pool that would resize itself in a more unpredictable, but better, way. I believe strongly in smart programs, and smart programs tend to be a bit on the unpredictable side. Anyway, I had it quite happily expanding itself to fill the resources available on the machine. I mean, why not? Then, my mentor Vivek pointed out during testing that it might be running in a situation where there were multiple applications deployed, and so expanding to fill everything would make it an extremely rude program, especially if there were two of my pools fighting over resources. Furthermore, it was revealed that my code was actually running more slowly than the previous version, since it was merrily creating and deleting runtimes, taking CPU time away from actually servicing requests.

 Thinking that putting in code that worked less well than the previous code was bad, I've since gone and looked a lot more closely at how my code was running (just because it's unpredictable doesn't mean that you can't find out what it's doing), refined its behavior, made it a bit more cautious, adjusted its boundaries, made it more user-friendly, brushed its hair, and straightened its collar. Well, not so much the last two, but certainly made it into a better-behaved program.

Now, having passed the "Is it not slower than the previous version when we throw a bunch of HTTP GETs at it" test, my code looks like it's ready to head off to the next stage in its journey towards lying unnoticed at the bottom of your JRuby on Rails on Glassfish app, making your programs faster and your life easier.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Jacob Kessler

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today