Unstable Terrain

Software development in the real world

Archive for October 2009

The Financial Implications of Cloud Computing

leave a comment »

Seen on Slashdot about Cloud Computing:

You’re missing something more important here; it allows companies to shift costs from capital equipment to operating expenses which is HUGE from a business standpoint.

Advertisements

Written by Trent

October 30, 2009 at 3:13 pm

Posted in Finance, IT Industry

Tagged with ,

Java Reflection Api: More Drawbacks

with one comment

Vinay wrote on DZone about the Java Reflection API and mentioned some drawbacks. Here’s one he missed:

The Reflection API Loads Classes as a Side-Effect

I encountered an error message recently in the Tomcat application I currently develop. I upgraded Log4J to 1.2.15 and suddenly, I was unable to stop Tomcat cleanly.

log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.

I found mention of this error in Log4J Bug 43867, but it turns out that the error lies inside Tomcat instead, and is due to the way that Tomcat unloads classes when WARs are undeployed. But to understand the bug, a short intro on class loading is in order.

Classloading 100

Classes are loaded in multiple stages. The main reason for this is to decrease program startup time and avoid using memory until the class is actually used.

The three stages of classloading are:

  1. Loading
  2. Linking
  3. Initialising

and only then is the class instantiated. Classes tend to be linked fairly eagerly, but lazily initialised. (For more details, please see this TechJava article)

Back to the bug

When Tomcat unloads a WAR, it helpfully tries to compensate for bad programming inside the WAR by clearing out any static fields it can find. It’s a crude but effective way to dereference fields that might have strong references to stuff you are trying to unload.

Inside Tomcat, org.apache.catalina.loader.WebappClassLoader.clearReferences() triggers the bug
by overwriting all static variables in your webapp (classes and JARs) with null. It does this even with the standard Log4J LogFactory. However, getting the field of a class that hasn’t been initialised will cause it to be initialised, which instantiates all the static fields…. including those static fields which depend on LogFactory! Hilarity ensues.

Luckily, Log4J can detect when something (i.e. Tomcat) has pulled the rug out from underneath it and will substitute a NOPLoggerRepository which won’t do any logging but at least won’t throw Null Pointer Exceptions. It’s interesting to note that Log4J is often used in static fields, so in hindsight, this is obviously not the first time they’ve had to contend with this issue. At any rate, it spits out the error message, but Tomcat is still broken and the WAR unloading fails.

The Solution

The solution is fairly easy. First, Tomcat should make a list of all the fields it’s about to null out. This will trigger class instantiation on any class that hasn’t been completely loaded. Once this is complete, Tomcat can then null out the fields safely. Tomcat Bug 41059 has this fix, and you can expect it soon in Tomcat 6.0.21.

Written by Trent

October 27, 2009 at 9:00 am

GoodReader: PDF reader for iPhone

leave a comment »

I have a number of books in pdf form, but I often don’t have my laptop with me. I do, however, carry my iPhone around because I like to receive calls when my phone isn’t crashing. update: fixed in firmware v3.1.2

Turns out I’m not the first person to want to read PDFs on my iPhone, so I bought GoodReader ($1.99 at the time) to check it out.

Turns out it reads PDFs extremely well, but also text files, html files and images. Getting stuff onto it is a cinch: it has a mini-browser to download stuff off the net, and allows you to put files on it over wireless (or via your comms cable if you install a program on your desktop PC). You can even email them back out or download it from its local web server.

I put Programming in Scala onto my phone and I have to say that performance was very good (it helps that the web version of that PDF contains beaucoup intra-document links to assist navigation)

A nice feature is the ability to turn off auto-rotation of the screen (useful when I’m reading at a 45° angle on my bed).

Verdict: Well, it has a few icons that clash with the regular iPhone colour scheme, but overall, good value and great feature set. Two iThumbs up.

Written by Trent

October 19, 2009 at 9:00 am

Posted in Tools

Tagged with , ,

A Disturbing Triangle

leave a comment »

I’m keenly interested in metaphors for a company’s organisation and practices. Here’s one I haven’t seen before:

Hugh Mcleod's Company hierarchy diagram

The Gervais Principle – or, ‘The Office according to The Office‘.

It has been featured on Slashdot with surprisingly few comments, perhaps because it’s quite confronting. Regardless, Venkatesh is going straight on my list of blogs to follow.

Written by Trent

October 16, 2009 at 9:00 am

Configuring TeamCity for Subversion

with 2 comments

At work, we’ve just started using TeamCity as our continuous integration server. The app itself is very slick, but the documentation is spotty. There doesn’t seem to be a simple example of how to set up TeamCity 4.5.x with subversion anywhere on their site (or on the net either, although they’re probably hidden away inside nabble or something). Happily, I can remedy this.

Setting up a VCS Root

You’ll need to set up a new VCS root for each project. Let’s say we’re setting up SVN for a project called unstableterrain. Setting up the project itself is simple, so I’ll assume you’re up to the challenge.

For the sake of brevity, let’s imagine the subversion repository is set up like so:

root
  |---- trunk
  |---- branches
  |      |---- ...
  |      |---- v04.02.00b
  |      |---- v04.02.01b
  |      |---- v04.02.02b
  |      |---- v04.03.00b
  |      \---- ...
  \----tags
         |---- v04.02.00.1
         |---- v04.02.00.2
         |---- ...
         \---- v04.03.00.266

So, onto the instructions.

  1. Add a VCS root:
    • name = ‘unstableterrain via SVN’
    • type = Subversion
    • URL = http://my.svn.server:9001/svn/unstableterrain/
    • set your username and password accordingly (if your svn server allows anonymous checkouts and your build script doesn’t check anything in, then you can skip this entirely)
    • Labelling rules: Add trunk, and a rule for every branch you plan on using. This, unfortunately, is manual in the version I’m using (4.5) because wildcards don’t work. In this example, you’d enter
      +:trunk=>tags
      +:branches/v04.02.00b=>tags
      +:branches/v04.02.01b=>tags
      +:branches/v04.02.02b=>tags
      +:branches/v04.03.00b=>tags
      … you get the idea
    • Test the connection
    • Save; you’re done.

Attaching your VCS root to a project configuration

Say we’re setting up a project config called “unstableterrain v04.03.00 snapshot”. You want to check out this branch and run builds against it, incrementing the build label and tagging.

  1. Add general details
    • build number format = v04.03.00.{0}
    • Artifact paths: these map from the results of your build to directories under the artifacts node, e.g.:
      build/dist/*.war => dist
      build/emma/all/**/*.html => emma
      build/tmp/checkstyle/**/*.html => checkstyle
  2. Add VCS settings
    • Attach the existing VCS root you specified earler (i.e. ‘unstableterrain via SVN’)
    • Edit checkout rules on the VCS, since we want to tell SVN which branch to checkout for this configuration:
      +:branches/v04.03.00b/=>.
    • VCS checkout mode = automatically on agent
    • VCS Labelling mode = Successful only
    • VCS Labelling pattern = v04.03.00.%system.build.number%
    • Choose VCS roots to label: ‘unstableterrain via SVN’ VCS root
  3. Edit build runner
    • add your settings
  4. Build Triggering
    • add your settings
  5. Save

And that’s it.

Written by Trent

October 14, 2009 at 9:00 am

Clear Costs and Technical Debt

leave a comment »

Israel Gat wrote about putting technical debt on the balance sheet. It sounds appealing, but when you try to bring the concept of technical debt into the financial world, you start butting up against the finance domain, which is where your trouble starts. Strangely enough, you must play by their rules.

Accounting Principles 101

From a finance point of view, software development must be categorised as capital expenditure (capex) or operational expenditure (opex). In general, new software applications or new features on existing apps is classed as capex, and the maintenance of existing apps is counted as opex.

The treatment of opex and capex on a balance sheet differs.

Opex activities are simply costs that show up in the month they are incurred. This is a good thing from a finaincial guidance point of view.

Capex activities result in a new asset on the balance sheet (or increase in value of an existing asset), and thus can only be amortised over the course of many years. This means that a $100,000 capex cannot be written off in the year it was accrued, which impacts the balance sheet. Yes, it does leave the company with a capital asset, but unless the company is looking to be acquired, that’s not an actual benefit.

Technical Debt as capital liability?

Consider this situation:

  1. A customer comes seeking a solution
  2. We quote them $200,000 to deliver a complete solution
  3. The customer, after advice from their finance department, negotiates for a solution that costs $120,000 but would incur approximately $80,000 in technical debt (rework to meet more nuanced requirements, removal of important items from scope, unperformant code, unmaintainable sections of the app; you name it)

What should happen from a financial point of view?

From a pure technical point of view, the customer would pay us $120,000 and receive a $200,000 piece of software with a technical debt of $80,000 associated with it. The customer knows the true state of what it paid for and can see that many thousands of dollars must be spent for the app to perform as intended. Everyone is happy. Rainbows and unicorns ensue.

From a financial point of view, the technical point of view is pure fantasy. Accounting standards don’t allow provisions or liabilities to be shown for “not performing enough maintenance” or similar intangibles. There needs to be a present obligation before a liability is incurred and a present obligation is only usually formed through a contract.

The accountants will note a $120,000 asset on the books, congratulate themselves for saving $80,000 of capex and chalk up the increased opex of maintenance as the cost of doing business.

Written by Trent

October 12, 2009 at 9:00 am

The iOffer (also: Yoga Pants)

leave a comment »

A friend recently sent me links to Apple Inc.’s offer of employment and welcome pack. To me, it’s not shocking that their HR documents are as well-presented as their other products; it stands to reason that Apple has an image to maintain, after all.

Moreover, given their likely skill set, prospective Apple employees are much more likely to notice design deficiencies in their interactions with the company than those at other companies or in other industries. It’s a case of eating your own dog food, taken to the next logical step.

There’s a message in there for all companies who are image-sensitive: your image extends to all interactions with others; new employees, the media, competitors, everyone.

Update:

the iOffer is no more, after the blog post got pulled. Pics without amusing commentary are available, though.

Speaking of insanely great things that are both functional and extremely fashionable, I recently discovered Lululemon and their stranglehold on yoga pants fashion (thanks to Penelope Trunk for mentioning them). I found a picture online, but sadly, the page didn’t mention the style. I contacted the local lulu store and learned the details. So, for the sake of posterior posterity:

Lululemon Groove Pant Sneaker Legs

Lululemon Groove Pant Sneaker Legs

I wonder whether the HR documents of LuluLemon hold up to the same scrutiny as Apple’s…

Written by Trent

October 9, 2009 at 9:00 am