elfs: (Default)
[personal profile] elfs
I've figured out why I'm not a world-famous open-source programmer. It's simple, really; I don't have many itches to scratch. Most of the software I have with me pretty much does what I need it to do.

I write software when my aesthetic sensibility is offended. And I have much to be offended about this week. I've been deep inside the guts of FireWatir this week, the web application testing framework written in Ruby, and I have come to the conclusion that the FireWatir programmers have at best a passing familiarity with Ruby and Javascript.

I even showed the FireWatir code that offended me to a co-worker, a programmer of phenomenal youth and skill (I'm the one with age & treachery), and he agreed that the code was offensive. Six hundred lines of the same three lines repeated over and over, each with eight lines of comments above it. Those three lines defined subclasses of Element, for individual HTML components like divs, spans, and paragraphs.

I replaced the whole mess with one four-line function, a one-line list of names, and a one-line call to generate classobjects from the function for each name on the list. My list is more complete than theirs.

In another example, their code builds this humungous raw chunk of javascript, which it then uploads to the JSSH JVM, executes, takes the return value, and then... does nothing. The variables defined and described live for the duration of the test, even though they're never re-used. The builder does this component by component, intermingling ruby and javascript in a mangled heapin' mess of unreadability.

I wrote the lookup function in pure javascript, using a BSD-licensed function findElementsBySelector. When the program starts talking to the JSSH JVM, it uploads and instantiates a single new object, _firewater, which has a reference cache and a collection of functions, including the selector function. All of that huge, ugly ruby/javascript now devolves to this:

oblist = self.command('_whiskey.locate("%s", "%s");' % (selector, self.element_object()))


(Oh, that's another thing; the idiom 'send this, then read the response' is everywhere in this damned code. You'd think after the third time they'd have boiled it down to a single command. And my command function is smart enough to append the semicolon if you forget!)

See? I'm offended. It must be fixed.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

elfs: (Default)
Elf Sternberg

December 2025

S M T W T F S
 12345 6
78910111213
14151617181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 30th, 2025 11:19 am
Powered by Dreamwidth Studios