PySweeper: Un-refactoring, Tuple Madness, and Injection 10
I figure that to understand the code before me, I need to start testing. I’ll start with the constructor. The constructor actually is doing a lot of work. In order to test out my refactoring tools, I recklessly broke out two routines without adding any testing. I don’t recommend that on any project that needs to work, but I also don’t recommend using a real product to learn your tools.
PySweeper: Python test collector 14
I wrote a number of separate test files for the pysweeper refactoring exercise, and very quickly got tired of running them all individually. I created a stupid test composite tool and I run this one instead.
Seed-And-Harvest Considered Harmful 13
Quite a while back I complained that a class is not a BASIC program, and more recently I blogged on my personal site about The Unspoken Parameter, but on further consideration I realize that these are both aspects of larger, well-known problem that vexes developers.
The real problem is the idea of seeding a function’s input in various places and then calling the program, and then harvesting the function’s results from the surrounding environment. This indirect access to input and output is troublesome and frustrates maintenance.
Tuple Madness 39
If there is a downside to modern OO languages like Python and Ruby it is the great built-in list types. They’re wonderful, but they’re tempting.
Today I had my fourth or fifth encounter with tuple madness. It seems that the siren song of “free” data structures with unnamed members is just too much to resist. I’ve decided to call it Tuple Madness. An example is: x = (2,3,-1) Could one be less descriptive? Probably not.
I came across some code which uses two-tuples where both values are encoded integer values. It’s a pain to figure out.
In a previous job, a coworker would write his python entirely as filters on n-tuples so that figuring out what his code was doing was really painful. A function would take a sequence of n-tuples, and return a sequence of n-tuples where some of the values were preserved (though reordered) from the input, and the rest were transformations on the input + some local data. It was really tough to read a program where the data structures had unnamed elements and only existed between the return of one function and the invocation of the next.
At least one of my colleagues has blogged about suffering from Tuple Madness as well.
I don’t think that “magic tuples” are always evil, only that they’re no substitute for proper objects and meaningful data structures.
Testing GUIs Part II: JSP 116
How do you test JSPs outside the container, with no web server running…
Dependency Management: HtmlUnit 109
If you are planning on building an API, please, please, think about dependency management. Don’t make me know more about your world view than necessary. Consider what happened to me as I explored HtmlUnit…
PySweeper: Digging In 13
In the last installment I got the source and started up the development environment.Now I start to play with the tools.
PySweeper: Getting Started 5
It’s time for me to do a little code cleaning. I keep talking about open source, but lately it’s been all hat and no cattle (well, other than an unreleased FitNesse change I helped with). I looked for something fun involving Python. I figure I will learn pygame and eclipse PyDev and see what I can learn and teach from the experience.
Jasper: Problem resolved? 85
After digging around in the Jasper source code, and fiddling hither and yon with various build.xml configurations, I finally (and quite by accident) hit on the solution to my trouble…
Jasper: The Saga Continues. 8
It’s Sunday. Justin came in second in his wrestling tournament. And I downloaded the source code for Tomcat to figure out how the Jasper compiler works. sigh