Sunday, September 30, 2007

Another JS / Maven2 Thread

More on JS packaging for Maven:

http://www.nabble.com/recommandation-for-JS-packaging---%28was-Using-maven-for-JavaScript-projects%29-tf4534791s177.html

And a wiki page came to be as a result of the discussion. All of the ideas from JSLibBuilder will be included, including a script artifact repository. :)

http://hammerfest.wiki.sourceforge.net/mavan-javascript-tools

Thursday, September 27, 2007

More on JSLibBuilder to Maven2

Seems like a good time to be thinking about the topic of Javascript development tools.

Here's an interesting thread on the Maven Users' list that started yesterday:
http://www.mail-archive.com/users@maven.apache.org/msg73451.html

and my contribution to it:
http://www.mail-archive.com/users@maven.apache.org/msg73613.html

It looks like there is a good array of tools coming to light from this
thread. I, myself, have been tackling the problem of making JS library
development more like Java development, as far as automated running of unit
tests, documentation, packaging, etc, in recent months.

I see a growing demand for a nice tool chain of things like jslint,
shrinksafe, jsunit + jscoverage, selenium, jsdoc, and dependency management.
Maybe it's because I just came back to JS after several years with a bunch
of Java development under my belt; but I see all these tools and feel like
they should be integrated. Especially when I make the connection between
web2.0 and people who promote Agile development practice. JS tools are
hardly in the state to accommodate good Agile, IMO. If integration were
better, it would be a different story.

My original approach was to create an Ant script that would download various
things using the <get> task, and use Maven Antlib for JSUnit, Selenium and
ShrinkSafe dependencies. But now I am getting to the point where I want to
break my library into multiple parts (project-core, project-ext,
project-ext-gui, etc) and Maven seems like the natural answer. And of course
when Maven comes into the picture, I want to manage my other JS dependencies
as such.

So last night I gave it a shot, and it seems to work well using war
packaging and their built-in overlay behavior. There are a few kinks to work
out, and probably Mojos to write, but I think it will work.

My immediate need is for JSUnit, which I have hacked into a series of
executions (see pom link below). I'll definitely be looking at some of these
tools and seeing how I can use them (namely the ShrinkSafe mojo!), and
hopefully getting a JSUnit mojo out of them at the very least. I've never
written a plugin (beyond hello world), but I'm eager to give it a shot.

I have high hopes that Maven can bring the state of JS development up to par
with the Agile way that so many web2.0 people want to develop. I'm looking
forward to hearing more of everyone's great ideas!

Harlan

ps.
Here's my main POM with JSUnit (in-progress proof of concept, by no means a
final product). The executions for JSUnit are basically a copy of
Selenium's:
http://soashable.googlecode.com/svn/xmpp4js/branches/maven/pom.xml

And here's my old Ant script "JSLibBuilder":
http://soashable.googlecode.com/svn/jslibbuilder/trunk/

Adios!

Wednesday, September 26, 2007

Maven2 + Soashable

The other night I did some tinkering and got Soashable + xmpp4js building with Maven2 (without JSLibBuilder). Basically what I did was create some ‘war’ artifacts for scriptaculous + prototype, extjs, and xmpp4js (none are checked in yet). I also created one for soashable-web that depends on xmpp4js.

Basically the dependency tree looks like this:

  • soashable-web
    • xmpp4js
      • extjs
      • scriptaculous
  • extjs
  • scriptaculous

I have a preliminary way to run the JSUnits on xmpp4js (though I'd really like to just create a plugin, probably based on Selenium), and hopefully the Selenium plugin works as advertised.

This means I’ll need to open up a repository for the soashable-web, xmpp4js and js dependency artifacts, and at that point one will be able to build soashable-web with a single mvn jetty:run command on the checkout. In the longer haul, hopefully I can sync up with the central repository and extjs/scriptaculous will create and maintain their own artifacts.

It's a little ghetto at this point. The projects are war projects and the overlay happens 1:1 over the war (may be possible to override, but I don't want to look into it now), so a standardized tree under src/main/webapp will need to be used; js/xmpp4js/..., js/extjs/..., etc. However there is a little hope for JS development on the horizon; just yesterday a maven jstools library was checked in to CVS.

If I can get JSUnit working, this stuff should be in by late tonight or tomorrow evening. Matt and I will be working tonight.

On a side note, it would be cool to start something like 'jsrepo.com' as a public maven2 js library repo. At the very least, I’ll contact the authors of extjs et all.

Thursday, September 20, 2007

Fwd: The Deep Synergy Between Testability and Good Design

Just a bit of blog-o-spam. I completely agree with the hypothesis presented in this blog post, so I thought I'd pass it on. I've definitely observed this first hand as I've aimed for full unit test coverage of things over the past 6 months:

The Deep Synergy Between Testability and Good Design

Sunday, September 16, 2007

College Degree

Warning: personal entry.

I started going to college again summer term of this year. Not having a degree has never really been an issue, but new circumstances made it senseless to not work on it, if only part time. I got a new job that will almost never require more than 40 hours per week, and is located a few blocks from a school that offers night classes. So I figured I might as well work on prerequisites for a CS degree 1-2 classes at a time, and have been doing so. The 6 year plan.

But in the past several months I have been contacted by a few interested parties about my status on the job market. Some of them didn't work out for non-degree related reasons, but the opportunity of my dreams landed on my lap and I was not able to take it due to working on my degree. Believe me, that poured a LOT of fuel on my fire to finish my degree ASAP.

So after a few weeks of careful consideration, I took this previous Friday to find the answers I need to become a full time student. Whatever the cost. It will be expensive to make the transition (as in, my lifestyle will change a lot), but it is more expensive to both my career and directly in terms of salary to not finish my degree. In economic terms: if I could be making 10k extra by having my degree, then 3 years has 30k opportunity cost. So if I can finish my degree in 3 years instead of 6, then college actually costs 30k less than if I had gone part time for 6 years. And the assumption of 10k more is ridiculously understated.

But perhaps more important than the bare dollar amount is the chance to work on cool projects and make money doing so. At present, I work on a fairly boring project at my job, and then spend 40 hours a week working on open source for no pay at home. It would be great to work 80 hours on interesting stuff, and I want that as soon as possible.

My not going to college was never really a choice. I went for about 1.5 years, until I ran out of money. Then I tried to complete a FAFSA, but due to some special circumstances I wasn't able to. I thought maybe I'd wait until I'm 24 and can be considered "independent," and went back to working full time. But I'm 22 now, and too impatient to wait any longer, so I started taking classes even though I can't really afford it.

Why get a degree if it hasn't hurt me so far? 1) It will hurt me at some point, 2) I need to learn. Emphasis on the latter. There are certain applications that I want to be capable of creating, which I am not, due to my lack in knowledge of statistics, set theory, and algorithms/data structures in general. I could just self-teach myself, but I am already self-teaching myself so many other things. And I might as well work towards a tangible goal, of having a degree, while I learn.

I'm excited but a little scared. According to the admission guy I spoke with (who, incidentally, will also be reviewing my application), I'll have no problem getting into the UofMN based on GPA in college, SAT scores, and GED scores (yea, I'm a high school dropout), as long as it's all in by Oct 12. My records clearly show that I've redeemed myself from my early-day sins in high school. Wewt.

Tuesday, September 11, 2007

Meebo Does File Transfers & Amazon WS

Always on the cutting edge, Meebo does file transfers using Amazon WS. Perhaps validation that the Soashable project is not crazy; we have been discussing that very thing since I became curious about EC2 after TCLUG announced a speaker from Amazon would be coming.

It will be interesting to study their implementation, and whether they contributed any patches to GAIM. As usual, it's very possible with Jabber but may require some patches to the gateway components.

With Jabber, it would be implemented by creating an AJAX server to receive file transfers and connect on behalf of the user (Jabber supports multiple resources) and initiate the transfer of the uploaded file to the target JID. This works regardless of which network the remote party may be on, since the gateway component handles translation between Jabber file transfer and the file transfer mechanism of the remote network.

And of course with all of this running in the EC2 cloud, S3 would be there to store the files.

Thursday, September 06, 2007

Taking Testing Fore Granted

It feels like I've spent all my time over the past few weeks in front of JUnit and JSUnit test runners. It's true, but it's a hell of a lot better than in front of a browser doing some 'old school' iterative development.

It doesn't seem like long ago that I would manually test functionality until I believed it was solid, forget about it, and have to re-test everything manually a few months later when I wanted to change something. Did I really even re-test everything? Not usually. A change would be requested and I would do it and check it in (at least I used an RCS, eh eh?), hoping that the change I made would have no impact. This was my life for several years.

Normally I would have learned from my mistake and set up something to help me out. At work, we did finally started using Maven, which runs tests automatically on every build... but proper testing wasn't exactly in the budget, so it was kinda moot. -Dmaven.test.skip=true was pretty much hardwired into my brain. At home, I was too impatient and my interest was too fleeting. TDD was just something I'd read about in books, and nobody I knew did it. But oh how I wanted to do it.

It seems it would be hard for anyone working on any project to get into the habit of testing, without tasting the fruit of it first. It is tedious and it makes progress seem to wither away. I started Soashable almost two months ago, and am no farther along now than I was then--as far as new features. Part of it is that I rewrote the XMPP library from scratch, and created a builder for it. Another part of it is that I had finals last month. Excuses aside, I wanted to test this one.

Now I'm completely confident in the new code. Over the past several days I have swapped out the Roster GUI rendering code and made changes to the various components without worry. I simply add new test cases for new functionality, and update cases in code similar to tests that fail. No more having to memorize the whole program and rely on that for refactoring. And being that I'm working on Javascript, a dynamic language where Eclipse can't help me out, that says a lot.

And a nice side effect of being confident about my code and having great results, is I seem to not get frustrated and stop making time for the project. With high confidence, I know that the thing isn't going to crumble apart and have wasted all my energy. This leads to more net results, despite the lower (initial) throughput.

I'm sure you, dear reader, are familiar with testing. But I just thought I'd remind you of the hell you lived though before it was in your life. I am at the point now where I completely take it fore granted--I test at work (I spend more time writing tests than code) and I test at home. So while it seems like I spend my life in front of test runners, I see better results when they finally do come out; I can browse to a page full of complex code for the first time and KNOW it will work, and it does. Because I've already seen all the parts work independently. And I am confident in my code, and can not worry if I forget pieces of the system exist.

I love taking fore granted that my code works.

Monday, September 03, 2007

JSLibBuilder Alpha Release

I hope you've all had a great holiday weekend. I know I have :).

The first release of JSLibBuilder is ready. Here's the download, announcement, and wiki page.