PySweeper: Un-refactoring, Tuple Madness, and Injection 10

Posted by tottinger Sat, 17 Feb 2007 19:02:00 GMT

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

Posted by tottinger Sat, 17 Feb 2007 18:00:00 GMT

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

Posted by tottinger Thu, 15 Feb 2007 20:28:00 GMT

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

Posted by tottinger Tue, 13 Feb 2007 18:07:16 GMT

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

Posted by Uncle Bob Mon, 12 Feb 2007 02:54:37 GMT

How do you test JSPs outside the container, with no web server running…

Dependency Management: HtmlUnit 109

Posted by Uncle Bob Sun, 11 Feb 2007 18:55:14 GMT

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

Posted by tottinger Sun, 11 Feb 2007 03:44:00 GMT

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

Posted by tottinger Fri, 09 Feb 2007 21:35:00 GMT

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

Posted by Uncle Bob Fri, 09 Feb 2007 01:29:42 GMT

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

Posted by Uncle Bob Sun, 04 Feb 2007 17:04:19 GMT

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

Older posts: 1 ... 33 34 35 36 37 38