Tools, again

Wednesday, May 21st, 2008

Computer Swedens developer columnist Tobias Fjälling the other day answered the question “What should a good development environment include?”. (MÃ¥sten i en bra utvecklingsmiljö - Computer Sweden).

Tobias list:

  1. Auto-complete
  2. Refactoring
  3. Navigationsupport
  4. Extendability
  5. Speed
  6. Debugger
  7. Code templates

I find this to be spot on what Ola wrote about) the other day which I already quoted:

It’s interesting, many Java programmers talk so much about tools, but they never seem to think about their language as a tool.

Tobias seems to be a good guy, I am giving him the benefit of the doubt and assume that he forgot.

Things I Have Actually Used

Monday, March 31st, 2008

Robby Russell is a constant source of information on Ruby and Rails, I have used his instruction on how to set up Rails and PostgreSQL on Mac a number of times. It is therefore fun to see that I have actually used 3 out of the 5 things he wants to know more about::

RSpec User Stories

We were very early adopters of this one, we started using it the same day it hit trunk in a useable form. Everyone should start using it today - I cannot speak highly enough of it. The only thing I miss is a Fit-style table approach to rules, but I have my own thoughts about that one.

Using Selenium with RSpec

We have used the now outdated spec/ui library at WeMind. Today we use RSpec Stories almost exclusively for acceptance testing. My position is to use Selenium only where you really need it, for example to test Javascript functionality.

JQuery

I have used it for the dynamic hiding of speaker info for Agila Sverige. Not at all enough to judge a library by, but it feels a lot sweeter than Prototype/RJS.

JSSpec (BDD for Javascript)

Yeah, I wanna know more about this as well.

Using the Google Charts API with Rails

Same here.

Other than that I would love to try out:

  • Seaside - I have dabbled with it but nothing worth mentioning.
  • CouchDB

Choice Is Good

Thursday, December 13th, 2007

I was happy to note that Dion Almaer commented on my blog post on Merb. Dion is one of my favorite bloggers/podcasters and I value what he writes highly.

But I disagree with him on this one. The problem with using Java for web application development was never one of too much choice. In fact, it was because of that choice that Java became a player in the server side market at all. Sun alone never had the answer to what was needed for server side development, instead the open source world stepped in and made incremental corrections.

The same thing is happening to the Rails world. The core team cannot create a framework that is a one-size-fits-all. The initial Rails proposal is great for a large number of webapps, but it is other things around it like plugins and JRuby that is making Rails a viable choice for all.

My Java tools of choice was usually Tomcat/Jetty, FreeMarker, iBatis, WebWork tied together with Spring or PicoContainer. What I hated was having some frankensteinian-enterprise-architect-design-by-comittee-lets-not-be-different stack forced upon me with a fullblown J2EE server, EJB’s, Struts or the JSF monster, sprinkled with an Eclipse-only development environment. And I hope dearly that Rails development is not going the same way where people question you on your choice of tools and wonder why you are not using MySQL and TextMate like the rest.

There is one choice that I do not miss though - directory layout. I am truly happy every time I do not have to choose it.

Instead of not having to choose, the most important difference I’ve experienced is that Java as a language together with the Servlet/J2EE spec induces a lot of accidental complexity, which is almost non-existent in the Ruby/Rails world. It is that which enables the increased velocity many development teams experience when switching to Ruby.

Not speaking at RailsConf Europe

Friday, June 15th, 2007

I just got a mail confirming that I will not speak at RailsConf Europe this fall. I had submitted a proposal named “Version Control in Rails using Mercurial” which was going to show the benefits of using a distributed version control system when developing a Rails app. My opening line would have been “Hi, I am Marcus and I have been Subversion free for six months”.

For some weird reason, so many people in the Rails community - and the open source community as whole - still talk about Subversion as something great. It is not. Subversion is decent at best if you are comfortable knowing that you are using second or third best tools, but believe me, it is a crap choice knowing the alternatives in distributed version control.

I really wanted to point all this out to the a larger audience so that we maybe will move beyond the Subversion centric mess which is the Rails community today. Oh well, maybe next year.

For a very entertaining and opinionated view on version control systems, watch Linus Torvalds most awesome presentation on Git at Google.

Enterprisey technology stacks

Thursday, November 16th, 2006

Almost all large companies I have come across have some standards regarding the technology stack that they are using.

The main reason behind this is economy, that developers should be able to rotate between projects and that operations should only have to worry about a limited number of software products. Something like that anyway

However nice this seems, it never delivers on its promise. It is much like the Gantt charts - looks nice, promises a lot, delivers zilch. Not counting the enormous upgrade cost when the whole stack is upgraded after 20 years - COBOL anyone?

It is like a bakery standardizing on a given type of flour, salt and sugar and keeping all ovens at the same temperature, so that the bakers are familiar with the environment should they start working in another part of the bakery.

So you have your chocolate cakes baked using the same ingredients as your sour dough bread, and of course the whole thing is a mess. After a while the bakers start changing oven temperatures without telling anyone - not out of rebellion but because they have to. Different cakes are baked in different ways, and software is just the same.

There is hope though; I was delighted to read this interview with Werner Vogels, CTO of Amazon:

Developers of our services can use any tools they see fit to build their services. Developers themselves know best which tools make them most productive and which tools are right for the job. If that means using C++, then so be it. Whatever tools are necessary, we provide them, and then get the hell out of the way of the developers so that they can do their jobs.

That is one man that understands development.

While writing this, Matt wonders how to get stuff past the acceptance red tape. I have no good answer. Guerilla coding is the insubordinate way. Nagging for a very long time has worked a few times. But I probably lean towards Alistair Cockburns analogy with the old joke:

Paddy stopped cutting the hedge as the big car drew up beside him and an English visitor enquired,

“Could you tell me the way to Balbriggan, Please?”
Paddy wiped his brow.

“Certainly, sor. If you take the first road to the left… no still that wouldn’t do… drive on for about four miles then turn left at the crossroads… no that wouldn’t do either.”
Paddy scratched his head thoughtfully.

“You know, sor, if I was going to Balbriggan I wouldn’t start from here at all.”

Meaning, Matt might be in the wrong place to do what he wants to do.

Finally - if an organization should standardize on something it should be protocols. HTTP for example. Build it, make it accessible with external API’s, and implement it the way you see fit. Just like Amazon does it. Loosely coupled large grained components the way EJB’s never were.

Fit is a Requirements Tool, Not a Testing Tool

Thursday, October 5th, 2006

Mike Ratliff did a very good presentation on Fit/Fitnesse at Valtech Days. While praising the effects it can have on a development project, he also highlighted some of its quirks such as the ones I’ve complained about earlier.

The main point he made in my mind was when he said that Fit is not a testing tool but a requirements tool. It does not replace your regular acceptance testing tools. According to Mike, the main advantage Fitnesse brings is an increased, and executable, dialogue between customers and developers, and the possibility for customers to work with the spec in a “what if” manner.

I have been going over that thought for two days now and I think I really like it. And it makes me revalue Fitnesse, I definitely see the value of customers being able to work with the tests dynamically. I might just end up writing a blog post these days titled “Why I like Fit” :).

Why I don’t like Fit

Thursday, August 10th, 2006

I don’t like Fit. Believe me, I want to like it, I have tried to like it. I mean, Ward Cunningham created it for crying out loud, the man is a genius, so I am probably just missing something - right?

Every time I have looked at Fit, I always like the parts that handle column fixtures. They are clean and easy to read and generally does a really good job. Buth then we get to weird cousin Row Fixture which is not at all that easy to read and uncle Action Fixture which just won’t stop and finally family FitLibrary which does all good things but are utterly unreadble - which probably is due to my lack of experience, but then again wasn’t this intended for non-programmers?

Geoff Bache told me at XP2006 to look into FitLibrary and Erik Lundh suggested that I read the book on Fit. So now I have done just that, and I still don’t like Fit. As a language that is.

What the book did explain clearly, which I find the truly awesome part of Wards invention, is the idea of executable requirements written in advance. It is soo XP that you just have to love it. And I finally get why you should test the logic layer and not through the UI. Happy now?

But the book did not address all my concerns. It does not talk about the problems with version control; if you choose to work with Excel based Fit tests you will not be able to track changes as they are binary files. Neither does it suggest how Fitnesse pages are to be kept in version control. Also, all Fit formats are hard to follow if you track changes by commit messages by email.

The Fit syntax is in my opinion a table based DSL for writing acceptance tests. How many other programming languages do you regularly use that are table based? Excel? It is awesome for column based calculations which is the same as Column Fixtures, which I like. I alreay wrote that. But the rest is just … ugly.

A better solution in my opinion would be a Markdown based documentation format, where code formatted text, the indented one, is executed as tests just like tables in Fit. Could probably easily be turned into a Wiki if needed. For testdata I would use Yaml. Now if I could just find the time :)

Cedric Still Doesn’t Get Agile

Friday, June 9th, 2006

Update: Martin Fowler pointed to . It seems Cedric did not give us the full picture. I have edited my post accordingly

After attending a less than stellar presentation on TDD, Cedric Beust confuses TDD with “Agile” and goes on to tell the world that agile is not good. Let’s have a look, shall we?

First of all, tests are not specs.  Not even close.  Somebody in the audience was quick to give a counter-example to this absurd claim by using a numeric example (’how do you specify an exponentiation function with a test?’)

I would not use unit tests for specs. Automatic acceptance tests on the other hand is really nice if you have a customer/product owner that will work with you. Now Cedric has previously stated that he does not really care for the labelling of tests (“However, when I write a test, I don’t really care if it’s a unit test or a functional test”) so that of course makes it harder for him.

And hey, testing an exponentiation function? How about providing test data with given parameters and answers? It would be a prime candidate for a FIT-test by the way.

Relying on tests as a design specification is lazy and unprofessional because you are only testing a very small portion of the solution space of your application (and of course, your tests can have bugs). 

Why would you only test “a very small portion of the solution space of your application”?

Tests also fall extremely short of having the expressiveness needed to articulate the subtle shades that a real specification need to cover to be effective.

This is my main gripe with Cedrics rant. He seems to be completely oblivious to the great emphasis on customer interaction that agile methods make, which promotes a two way dialogue.

A specification written in a document is a one way communication. Even in high school psychology I learned how much more information was conveyed in a spoken dialogue than in writing.

This claim is part of a broader and more disturbing general Agilist attitude that is usually articulated like ‘Your code is your spec’, along with some of its ridiculous corollaries such as ‘Documentation gets out of date, code never does’.

What is so ridiculous with the last statement? I have never been involved in a large scale project where the documentation did not get out date.

As for the code being your spec: when you have code and documentation, and the latter does not correctly describe the former, it is out of date, which will you trust? And what do you read to know what the real world looks like? Map, meet terrain.

I am currently getting acquainted with a brand new project that is not even very big, and while I understand Java fairly well, there is no doubt in my mind that for ten minutes I spend trying to understand how a certain part of the application works, a five-line comment would have given me this knowledge in ten seconds.

Sure, if it is up to date, which you will have to read the code to find out. My general rule: if you feel the need, comment on why the code does what it does if it is not obvious. If you feel the need to comment on what the code does, the code is not clear enough. Refactor until done.

Very often, Agilists simply forget that their job is to produce software that satisfies customers, not software that meets some golden software engineering scale.

Again, this is simply ridiculous - all agile methods try to get customers as close as possible to produce just what they want. Anyone even remotely knowledgeable with agile methods knows that.

Frankly, it takes all of ten minutes to explain Test-Driven Development to a developer who’s never heard of it:  ‘Write a test that fails and doesn’t compile.  Make it compile.  Then make it pass.  Repeat’.

I actually find it quite hard to get developers to grasp TDD; people find testing something that does not exist confusing. This is of course the basis for behavior driven development, but let’s just be happy for Cedric now.

Some might find it picky, but leaving out ‘refactor’ in the TDD loop tells me that you somehow has not grasped the concept completely. But then Cedric might throw in a comment instead :).

‘What should we test now?’

‘How about:  if we pop an empty stack, we get an exception’

‘Mmh, no, let’s not do that’

This is quite easy to test, so I do not see why he could not add it. Read Jeffs answer

 
Stack s = new Stack();
try {
  s.pop();
  fail("Should not get here");
}
catch (Exception e){
  //Ignore
}
 

But I am dead sure Cedric knows this , too bad the presenter did not.

To be honest, I am becoming quite suspicious of Agile practices for that reason:  all the presentations I have attended and books that I have read are always using toy implementations as examples.  Stack, List, Money, Bowling…  enough already!

Ignoring the fact that Cedric again confuses TDD and agile, he does have a point. Too many TDD presentations uses examples that are way too simplistic. They should point out the need of a modular architecture, and the fact that using TDD actually helps you get a clean, high cohesion - low coupling architecture.

And please, avoid smug and useless answers such as:

‘A lot of the classes I have to test are hard to isolate, do you have any advice regarding mocks?’

‘Well, if you had started with TDD in the first place, you wouldn’t be having this problem today’.

It is certainly not a helpful answer, but it is true nonetheless.

Fundamentally, I am disturbed by the Agilists’ dishonesty when it comes to presenting their arguments.  They offer you all these nice ideas such as Test-Driven Development and Pair Programming but they never — ever — disclose the risks and the downsides.  To them, Agility is a silver bullet that is applicable in all cases with no compromises.

Just to give one example, “Practices of an Agile Programmer” clearly states that agile is not for everyone.

The truth is that these practices come at a price, and for a lot of organizations, the price gets high very quickly.  Agile development will never go far if its proponents keep ignoring these organizations and make condescending comments to its members.

Here Cedric is spot on. Yay!

I like Test-Driven Development.  I really do, and I’m fortunate enough to work on a project that lets me use TDD most of the time.  But the truth is:  at times, I don’t do TDD because implementing a feature quickly is more important than a fuzzy feeling.  And I’m also aware that TestNG is an open source project with less than five developers, all of them on the bleeding edge and aware of the latest advances in software engineering.

And this is my main beef with Agilists:  I strongly suspect that most of them are spending their time on open source projects with like-minded fellows, but none of them have any experience what companies whose survival depends on shipping software have to go through to organize huge code bases growing thousands of lines of code every day under the combined push of hundreds of a developers, all with their personal background, education and bias.

My main beef with people opposing agility is that they basically say that too many of the developers out there are morons who cannot perform unless closely supervised and given clear instructions, and that there is no hope that that will ever change. It is a weird combination of pessimism and elitism

Now Cedric has a history of not liking agile methods, and that is fine with me. Whatever makes him happy. But his retoric in this case is like watching somebody who does not know karate perform a round house kick - lots of power and effort but misses the target completely.

Fit Testing - how to translate it to Swedish?

Friday, April 8th, 2005

I’m spending some time getting into Fit style acceptance testing and I’m liking what I see. My biggest problem so far is translation.

For all you non-Swedish-speaking out there, most techie lingo gets a very crude translation, basically by not translating it at all and using the english word as is. So a unit test in english is also a unit test in swedish.

But I’ve bit my tongue at least 10 times today saying “Fit tests” in swedish. Basically by not translating it I’m saying what I believe is considered the dirtiest word in the swedish langauge.

Any ideas for translations, swedish people out there?