RSS

Aspirations of true agile practices in JavaScript development

My team regularly develops JavaScript for our piece of the application, but has struggled until recently to get decent test coverage of our JS code.  In an effort to see what the ideal state of such things could be, I’ve setup a website on my local IIS 7 instance with the following set of tools that I believe would satisfy the needs of doing real TDD/agile practices with JavaScript development: JSUnit, JSMock, JSCoverage, and the JSDoc Toolkit.  We’ll see how it goes!

Note that for JSUnit, the download links are sadly out of date.  You must drill into the SourceForge trunk of the codebase in order to get a remotely recent version.

 
Comments Off on Aspirations of true agile practices in JavaScript development

Posted by on 2009-09-11 in Coverage, Documentation, JavaScript, Process, Testing

 

Can’t wait for my inheritance!

I am busy trying to figure out the best way to do reliable class inheritance in JavaScript without importing a third party library OR extending the prototype of a core JavaScript class (e.g. function).  Amongst a great variety of blog posts, forum answers, and random articles, I am finding Douglas Crockford’s Prototypal Inheritance in JavaScript and Classical Inheritance in JavaScript the most useful in terms of edification thus far.

Other interesting resources

Quick practical examples:
http://phrogz.net/JS/Classes/OOPinJS2.html

Overriding instanceOf to make it work for derived types:
http://www.webreference.com/programming/javascript/gr/column18/3.html

Poor man’s “reflection” on “classes”:
http://webreflection.blogspot.com/2007/01/javascript-getclass-and-isa-functions.html

Microsoft’s take on the subject (related to their ASP.NET AJAX libraries):
http://msdn.microsoft.com/en-us/magazine/cc163419.aspx

Continuing the hunt….

 
Comments Off on Can’t wait for my inheritance!

Posted by on 2009-09-09 in Inheritance, JavaScript

 

It’s a new dawn, it’s a new day, it’s a new life…

And I’m feeeeeeeeeeling good!

Officially conquered the non-IE browsers today, including the highlighting feature.  Struggled with the implementation of the highlighting feature in IE, but got the barebones of it working by the end of the day.  The IE implementation, however, has an odd intermittent bug that I haven’t quite nailed down reproduction steps for yet that basically boils down to a character offset being like 5-6 characters off — completely unacceptable in the final implementation, of course.

Going to try to work that one out tonight so that I can show off the prototype tomorrow (per my manager and director’s individual requests).

There are unresolved issues in all browsers, mainly the “line break” dilemma.

Update #1:
Turns out this has to do with moving a TextRange along. If you want to move by characters and the next character (or first character to be in the range) is a space, it gets all screwed up. Investigating workarounds…. 


Update #2:
Came up with a [thus far] consistently working hack of a workaround. Basically, when the range’s selection and the currentNode’s nodeValue do not match, I recollapse to the start and then try to grab the whole nodeValue plus an arbitrary amount of characters (currently 10) to push the buffer along farther. Once it’s moved, I then see how many characters the range encompasses and then move the end point backward by the difference in the expected range versus actual range.

The more annoying part about the TextRange.move/moveStart/moveEnd functions is that they are supposed to return the actual number of characters moved. Turns out they just seem to repeat back the number of characters they were supposed to move (presumably unless you are at the end of the document)… with the padding I added, mine was moving 3 less characters than it should have, but still reporting that it moved the whole span.

 
Comments Off on It’s a new dawn, it’s a new day, it’s a new life…

Posted by on 2009-09-08 in JavaScript, jWalker, Open Source

 

Do your worst, Firefox!

Argh, another night of coercing the non-IE browsers’ JavaScript engines into doing my bidding.  Getting ever closer now… pretty soon this spike will be worthy of being called a successful first crack at a real implementation.  I’ll have to add a slew of JSUnit tests before declaring it as such, though!

 
Comments Off on Do your worst, Firefox!

Posted by on 2009-09-08 in JavaScript, jWalker, Open Source

 

What’s new?

Currently working on:

  • Advanced cross-browser “find” engine in JavaScript (ETA: ?)
 
Comments Off on What’s new?

Posted by on 2009-09-03 in JavaScript, jWalker, Open Source

 

Hello, world!

Sorry, I just had to do this as my first post. 😉

 
Comments Off on Hello, world!

Posted by on 2009-09-03 in Uncategorized