Advancing Javascript with libraries + 1

Posted in Uncategorized by Kris Gray on April 18th, 2007

In a short but sweet post over at Ajaxian, Dion Almaer interviewed John Resig, of Mozilla and jQuery about Javascript Libraries, and the reasons for said libraries.

  • Avoid repetition
  • In JavaScript: Distance from browser differences
  • In C: stdlib distances itself from the platform differences

First of all, whats up with #3? Secondly, I’m totally digging points #1 and #2 in the current construction of the library at eProject. Refactoring old code to new code thats twice as good makes me feel so good, like some kind of Ego Building Sundae.

So what do I have to add? That #3 should have been easy test injection.

We’ve been struggling how to implement JSUnit at work for quite some time, testing a function on an ASPX page just isn’t very practical, and a lot of the functions in the old files were intended for a specific usage. Yet, once all the logic from the old pages has been moved to the library, it has been written with re-usability in mind, and writing a JSUnit test page turns out to be just another page in the system.

No comments

Dynamic Package Inclusion

Posted in Uncategorized by Kris Gray on April 18th, 2007

If you don’t know much about the Dojo toolkit, its a vast Javascript library with some very cool framework features. One feature I liked was the ability to add packages to a page depending on your need, so if you needed ajax, you could add the following script.

dojo.require("dojo.io.*");

This way you only get the bits necessary per page, this doesn’t make sense for something as small as Prototype but as I was building the JS Library for eProject it made sense to include this feature since we have so many packages available.

I’ve just recently been running into a problem implementing a Dojo style dynamic package inclusion system in our companies new JS Library. I didn’t want to dig into the Dojo source code to much, so I implemented a rather crude solution of taking the string to require, converting it to a file system path and appending a script element with that path to the page.

dojo.io.* would become dojo/io.js

This was a really simple solution and worked great in FireFox, but in IE (eProject is only concerned with these two browsers at the moment) , there were loading issues. It appears that unless the file is cached, it took its own sweet ass time loading. Annoyingly this made it seem that all my unit tests were passing when in fact, they only were passing because the dynamically included packages were already cached in most cases.

So after some digging into the dojo source a bit, I’ve discovered how they avoid this irritating little “feature”. The dojo toolkit uses an XML HTTP GET (for cache support of course) call to retrieve the contents of the file from the server, and eval()’s the returnText.

Ever since I read this, I’ve been trying to avoid it, it means I have to write custom XML HTTP Logic in the base framework level, and I have to do eval()’s on large blocks of text, but because I don’t fully yet understand why IE isn’t loading the script files as the DOM elements are being added to the DOM, I’ll need to implement this for now. It does give me the advantage of knowing that any logic I do include via the package inclusion system, will be available after I have exited the call for that package.

If you have any idea behind the lower level occurrences here, please share. Till then, I got some re-writing to do.

No comments

Team Player

Posted in Uncategorized by Kris Gray on March 30th, 2007

Ichiro Suzuki at http://seattletimes.nwsource.com/html/sports/2003628318_ichirotv21.html

The point is: A professional who respects himself can only have a positive influence on others around him. If your mantra is that everything you do should be for the benefit of the team, you become incapable of valuing yourself. You become a less-than-ideal player. You become a player that fans don’t pay to come and see. In the end, that kind of player doesn’t benefit the team.

Sure he’s talking about baseball, but doesn’t this apply to all teams? If you don’t focus on being the best ME as possible occasionally, then you don’t grow properly. I’m sure most developers don’t need to be told that you can’t always focus on whats best of the business but you need to look inward as well. Yet the managers need to surely be aware that developers are not tools, and you can’t assume that as you demand more and more from a developer he is improving as a developer.

No comments

Its Only Just

Posted in Uncategorized by Kris Gray on March 23rd, 2007

The psychology of the programming universe is complex and nuanced, but a quick tip for today is to look for these two words in any conversation.

Only and Just

These two words are used to limit the percieved scope and weight of the subject, without actually limiting the amount of effort or complexity necessary.

Its just this one section on the page we want updated.

It will only take 5 minutes to implement this on all the pages on our system.

It should just take 10 minutes to fix this bug, its really easy, assign it to Kris.

If you ever hear anyone talking about work they want you to do, and use these words, make them re-word what they are asking for without using the words Just or Only. At this point they should be aware of what they are trying to do, and know that not being truthful about the actual amount of effort required is just (hah it has some uses) going to throw off the schedule.

In Scrum you need to be truthful about this type of stuff, you can’t agree to a bunch of Just features knowing its going to make you miss your schedule as everyones Bacon is on the line here. If dev’s can’t get thier work done, the PO’s will share in the blame. And not just that Republican “Its not a big deal I did something bad”, kind of blame.

No comments

Mission Accomplished!

Posted in Uncategorized by Kris Gray on March 13th, 2007

So last week I made a launched a small sprint for myself to start establishing an online identity, and to start marketing myself in a positive fashion.

The result of that task was this blog in its current incarnation. Based on the fact that I currently have a black belt and the permutation of Karate throughout my life, I felt the melding of the two was like peanut butter and banana’s. (Love it!) Or Jelly for you fuddy duddys.

As of the writing of this post, I need to close down the old blog, losing my 10 hard earned viewers a day I’ve been getting! Grrr! Hopefully I’ll be able to maybe even double that, then I can start thinking about taking on the big boys.

No comments

« Previous PageNext Page »