Archive for the ‘Development’ Category

Todays Cool Keyboard Shortcut In IntelliJ…

Published by Rob on October 24th, 2007 - in Development, Java

..is cmd-opt-F7 (in Mac)

CMD OPT-F7 displays a list of  usages of the currently item (var/method) throughout the project, listing them in a nice inline dropdown list.  This is great for navigating around the usages of a method finding how they are used in context, before applying an aggressive refactoring.  I discovered the short cut recently while performing one of the other find usages options in Intellij (cmd-F7) and getting fat fingered and hitting CMD-OPT F7.

An AJAX Iteration

Published by Rob on September 21st, 2007 - in Development, Ephox, Java

I'm currently unwinding after only just managing to see all the cards1 move from the "this iteration" column2 to the "done" column3 on our XP storyboard.  While the estimates had us coming in at the same spot as earlier iterations, it ended up being quite a bit tighter than the earlier ones had been.  

There are a few reasons why, but the biggest cause would be the fact that we were moving from the comfortable world of Java actions into world of some heavy ajax ui.  I spent some time working with libraries and researching how to do things like JSON in Java, and AJAX popups.  It was a fun and stretching iteration, with plenty of prettiness to show for the work.

I learnt a lot including:

 AJAX with Prototype is great.  Prototype provides all the methods you want in the library.  I would consistently find the methods I would want in the library such as $('id') (to find an element with an id), and the serialize methods for forms are really nice. Kudos to the prototype team for a great library.

Scriptaculous provides nice effects that build on prototype.  The Autocompleter is worth the price of admission.

The popup library by Stuart Rackham works really nicely.  He doesn't have access to Safari so hasn't tested it there, but now I have, and while not all the features work, it is possible to produce nice popups that work in Safari with this library.  He has built this on top of Scriptaculous and prototype and he has done a great job.

JSON for passing around data is cool.  The whole eval on the client thing is a bit scary, but (almost as I expect now) at least prototype provides a nice evalJSON method to help alleviate a little my security paranoia. Of the millions of JSON libraries available, the standard java one works ok. (what's not to like about a library with a license that includes the text "The Software shall be used for Good, not Evil."  Mightier JSON libraries exist that do all kinds of magic, but the simple approach is working to start us off.

 

The biggest missing piece in my JavaScript Development is the fact that it isn't TDD. There seem to be bits and pieces out there, but nothing that is jumping out and saying "use me I just work.". The main reasons I am wanting to do Test Driven Javascript are for quality and pleasure. Doug spent some time researching options for acceptance testing of E2 front to back (including the javascript), which will definately help out the quality, but it still would be great to have a viable TDD option.

I never would have expected to say this, but it has been fun doing the JavaScript and AJAX in the past iteration. It really is much better than in the past, and I can see it only getting better.

1 – The card contains a unit of work

2 – The list of cards we are planning on getting done in the iteration, but haven't started working on yet

3 – The list of things we have finished this iteration.

Lean Software Development

Published by Rob on July 12th, 2007 - in Development

“Every line of code costs money to write and more money to support. It is better for the developers to be surfing than writing code that won't be needed. If they write code that ultimately is not used, I will be paying for that code for the life of the system, which is typically longer than my professional life. If they went surfing, they would have fun, and I would have a less expensive system and fewer headaches to maintain.” Jeff Sutherland, CTO PatientKeeper

The quote above is a fun (if slightly confronting) way of thinking around the idea that Software Development is all about delivering value to customers.  The premise is that there is a long lasting cost to any line of code that is added to a software system.  The cost is much greater than the initial development cost, so making sure that the right features are added is key.  The implication is that the team (including the customer) needs to be sure that adding code (including complexity and future maintenance) does add enough value to justify the long term cost (the maintenance cost will be much higher than the initial development).

The term "Agile Software Development" is getting a little bit old hat.  All the cool kids are talking about Lean development, as described by the Poppendiecks. The Lean Software Development principles are taken from domains such as Lean Manufacturing, especially as seen in Toyota, and initially introduced byWilliam Edwards Deming (Jason Yip links to YouTube videos introducing the ideas). The book Lean Thinking also has been recommended as a good introduction to the topic.

I have been hearing Doug talk about the idea, but haven't had much exposure before attending a NetObjectives Webinar on the topic. The principles (as articulated by the Poppendiecks) are:

  • Eliminate Waste,
  • Focus on Learning,
  • Build Quality In,
  • Defer Commitment,
  • Deliver Fast,
  • Respect People, and
  • Optimize the Whole.

The most valuable thought for me was the idea of optimizing the whole.  That is to ensure that the whole process is considered when performing process optimizations, and care is taken to avoid making localized optimizations that end up actually hindering the effectiveness of the process.  Lean Development is a very interesting and useful looking way of working.    It is well worth looking at the references listed above, and learning more.

Example of a Good Open Source Project Website

Published by Rob on June 13th, 2007 - in Development, Java

Open Source projects are known for dodgy websites, and rubbish documentation. I was overjoyed to see a project that got it right (URL Rewrite Filter). There are a number of things that I really appreciated with this site, and in the hope that people might take notice, I’m going to list the good bits here.

The landing home page has a nice concise description of what the project is all about. When I get to the front page, I can read the overview of the project, and get an understanding of what problems it was created for, and the goals of it. The front page told me enough to want to see more, but didn’t overwhelm me. I got a good feeling from the front page.

The other nice thing about the front page is the navigation structure. The side navigation bar provides the links which I am most interested in. One click to get to a download link (which has a direct link to the files). One click to the source code page (with instructions on svn access via http and the commandline). One click to the documentation. One click to get to the community support.

The documentation is excellent, and provides a good baseline for what documentation of a project this size should look like.

There are good examples of what the configuration file looks like, annotated in a way that makes it easy to understand what the code is there for.

The documentation provides a good reference for how to do the configuration.

It is a great site and provides a good example of what most open source project websites should look like.

Pretty URLs for any J2EE framework

Published by Rob on June 13th, 2007 - in Development, Java

Making the browser location work like a command prompt is a good goal for any web application, and is possible for any J2EE web framework, even Struts 1.

To do this, having Rails style friendly urls is required. Traditionally J2EE frameworks and applications have not done a good job of providing friendly urls. It is easy to wander around the net and guess at what framework people used by the urls (e.g. anything .do is probably struts, .action’s are probably webwork etc.)

Of course one doesn’t have to be tied to this world. Pretty much anything is possible with Apache and mod-rewrite. This is handy when you are behind Apache, but that isn’t always the case. From time-to-time you may want to dot his completely within your J2EE application, making it independant of where you are running. The Servlet spec is powerful enough to make this possible, but for the lazy (like me) it is nice to know that someone has already done the hard work. The URL Rewrite library provides a filter which does the heavy lifting for you. There is a simple XML configuration file, which provides a rich language for customising your redirects using the Java Regex library, or a familiar directory traversal wildcard style syntax.

The library makes it possible to easily map urls like: products/1 to products.do?productId=1 or from: /australia/queensland/brisbane to: worldMap.jspa?country=australia&state=queensland&city=brisbane. There is a rich syntax for specifying the url rewrite conditions, as described in the comprehensive manual, and shown in the samples.

Advice to an XP Customer

I have been working hard at developing an understanding of what it means to be a product manager how to do this.  A part of the role has been to step in as an XP customer.  Recently I had a great IM conversation with Dan North about what the role is all about, and how to best do the job.  Dan was my XP coach when I was working on a project in London, is the father of BDD, one of the lead developers behind JBehave, and RBehave and an all round great guy.

Here are some of the highlights of what Dan had to say:

Focus on your outcomes.

Work out what it is you want to achieve, and how much you think that's worth.

Everything else is detail. If the project goes "over budget", it just means you didn't predict the future. As long as you're within your comfort zone for the benefit you're going to get then you're still ok.

Likewise the feature list is just detail as long as you and the development team are on the same page

The most useful thing you can do is inspire the developers with your vision.  Ideally find a way of sharing any success, so they feel vested in the outcome

Try to stay focused on the "what". As a techie, you will be really tempted to get involved in the "how",but you have to trust the team to do the right thing. Once you let go of the technical detail you can really get into "character" as a product manager!

Good Management

Published by Rob on June 3rd, 2007 - in Development, Ephox

Warning: if you are looking for an angry rant you won't find it here, instead this is a article about a truly good manager.

Like most people who have been in IT for as long as me, I’ve worked with some pretty dodgy management over the years. There have been times where I was sure Scott Adams was sitting in my cube farm, stealing ideas for dilbert.

I came to Ephox knowing that this wouldn’t be the case. I came knowing that I was going to be working for a good manager, Brett. Brett takes management, leadership and people seriously, as you can see in his recent blog post about a leadership course he is attending. Here he talks about what he has been learning about management and leadership, and how much he already understands and implements. You may read it, and think that he is perhaps self-deluded, but as someone who has been working for Brett, I can vouch for the fact that this isn't the case. Brett really does get people management. He understands the importance of putting people over process, and it makes a huge difference. It is his valuing of people that played a key part of my wanting to come to Ephox in the first place, and makes being a part of his team great.

Another thing that Brett does well is keeping commitments. In a recent InfoQ article on agile, there was the quote: ”…one of the quickest ways to take the wind out of a person’s sails is to break a commitment…”

I can’t think of a single commitment that Brett hasn't worked really hard to keep. He does well at making the right commitments, and sticking by them. One real instance of this that really sticks out in my mind was when I was nearing the end of my time in support. I could see that there might be value in me holding off transitioning (and I was willing to do so), but Brett stuck with his word, and made sure that I was able to transfer to development. It was great that Brett put in the work to ensure that this happened, and this commitment help keep my motivation high.

Brett spent time working on his management skills, and I really think this investment has paid off. Brett does really well at leading his team of developers, and creating an environment where we want to be. Having a good engineering manager is going to be a key part of helping Ephox to grow, enabling us to hire and keep good engineers.

Memory Constipation (not memory leaks)

Published by Rob on April 30th, 2007 - in Development, Java

This post is the first in a series of efforts to clean up my list of drafts.  This particular post is probably about a year old.  It is somewhat fitting that it is the first in my effort to clean out my drafts ;) .  Before making each post in this series I'll edit the post to clean it up, and add new comments in italics, or footnotes).

I often spend time talking about different things with my wife, Suzanne. We both like learning, and sharing from our different experiences (in fact I'd almost call Suzanne a compulsive learner). 

I was recently struggling with an application with memory leaks1. When explaining this to Suzanne (who is currently working in a hospital setting treating a lot of kids with enuresis and encopresis)2, she pointed out that it is probably more of a case of memory constipation.

Especially in an environment with Garbage collection. The issue is that the rubbish ain’t getting out of the system.

1 - That was two years ago, in a Swing fat client.  Two years later at Ephox we getting OutOfMemoryExceptions in Java Applets

2 - actually now she is a full time Mum, and doing some Enjo demos on the side.

 

Emergence

I picked up a copy of the book Emergence a month or so ago while browsing a local bookstore.  It's about emergent behavior, and complexity theory, not (as my wife seems to think every time I mention the title) about coming out of the closet.

I've found it to be quite interesting read, filling in many of my missing bits of understanding around the world of complex systems.  I've read about it before, spending a fair amount of time at QUT working with a guy who is doing alot of work in Security Risk Simulation and modelling in complex systems.

It's interesting because Computers on their own are becoming increasingly complex.  I'm not going to say that a web application is a complex system, but the interactions between browsers, operation systems and JVM's does seem to cause behavior which is at least approaching emergence.

Thinking in these terms can be useful when doing bug-fixing.  The bizarre side effects and bugs that can happen in different configurations can be thought of emergent behavior, removing some of the blaming that can happen.  So perhaps sometimes the bugs aren't Sun's/Microsoft's/Mozilla's fault, rather behavior that has emerged from the way in which the agents (browse/operating system/jvm) have interacted.

This then makes bug fixing  a case of preventing agents from getting into situations that cause the bad behavior to happen.

Some of the interesting examples are the ant colony studies, which have shown how the ants interact to create the behavior which is like the ants are all working under a centralized controller.  Long term studies of the ant colonies show the colony displaying properties which are greater than any one ant does. Basically the idea is that the collective behavior is not controlled centrally. This type of reasoning is often used to remove the need for a creator/God figure in control of things.

People who make these statements normally skip over the fact of the need for the initial behaviors to be initialized in the first place.  While these behaviors are relatively simple, each ant does still have some quite intricate (almost designed) rules that are being used.

As the book says of a computer simulation of emergent systems (specifically talking about modelling the behaviour of slime cells), "Of course, on the most fundamental level, StarLogo is itself a centralized system: it obeys rules laid down by a single authority — the programmer.  But the route from Resnick's code to those slime mold clusters is indirect.  You don't program the slime mold cells to form clusters; you program them to follow patterns in the rails left behind by their neighbors.  If you have enough cells, and if the trails last long enough, you'll get clusters, but they're not something you can control directly.  And predicting the number of clusters — or their longevity — is almost impossible without extensize trial-and-error experimentation with the system." and continues "Systems like StarLogo are not utter anarchies: they obey rules that we define in advance, but those rules only govern the micromotives.  The macrobehavior is another matter."

This matches my current view of the world.  I don't think that emergent behavior acts to prove or deny the existence of a creator.  It would be possible to match most (if not all) belief systems with Emergence, which for me means that I am happily able to be a Christian and someone who uses and applies the principles and lessons from emergent behavior throughout my life, especially while coding.

Minor Updates

After gentle feedback from Suzanne (OK so she laughed at me, not with me), I've made some minor updates to the wording above, to improve the readability.

Five things I learnt about Javascript this month

Published by Rob on April 23rd, 2007 - in Development

In the past month at Ephox, we have been doing some heavy JavaScript (in this article JavaScript == ECMAScript 3.0) work, the effects of which will be seen in the next release of EditLive! I’ve learnt a bunch of new things, and thanks to a nice internal Continuous Learning seminar by AJ, much of the background theory has gelled for me.

1. this is the current object at execution time (think python and self).

An almost obvious statement which doesn’t really suprise initially. Java guys will look at that and be thinking, so what. It gets more fun when you think about the dynamic nature of java script and that you can assign functions as variables and pass them around as a reference. Assigning variables to objects is possible, and allows the dyanmic definition of behaviour.

This all becomes important when you are assigning functions to variables for reuse. For example if you are to override a funtion, and keep the original for later use, you need to be careful not to loose the context.

So if you override the onsubmit handler of a form, but want to keep the original onsubmit handler around you might want to do seomthing like this:

1
 form.originalOnSubmit=form.onSubmit;

 

1
form.onSubmit=newSubmissionFunctionThatCallsOriginalSubmissionFunction;

2. Function is a way of creating a function object—pass in a string, get a function out.

Pretty much as expected: 

1
myFunction = new Function(“arg1", "arg2" "{alert(arg1 +arg2);}”);

That will create a function with arguments arg1 and arg2, and will raise an alert with arg1+arg2.

For more details see here.

3. eval evaluates a string as javascript

yep it does

See here

4. prototype is the way that Objects are created in javascript.

JavaScript is a prototype based language. A  prototype function is specified by the following syntax:

1
2
3
MyObject.proptoype.myFunction = function(arg){<br />
       &#160;//javascript function<br />
       }

see here for more info.

5. innerHTML rationalises the content being set

Browsers will parse the contents of the text being set via innerHTML, which will cause the contents to be changed in various minor ways. For example comments in the middle of attributes will be escaped.

There is much to learn about Javascript, and the above are a couple of the bits that I have learnt recently. 

Update:

As Tom has pointed out in the comments, be careful with the Python/JavaScript analogy.  Python binds the self early, so the analogy falls in a heap early on.

© Rob@Rojotek