Archive for May, 2006

ASAP2 - A little bit of Agile acronymiteah

Tuesday, May 30th, 2006

It’s all been covered a million times, and silliness like this doesn’t deserve the time of day, but here’s yet one more useless Agile acronym for your pleasure, courtesy of Nutrun:

ASAP2 = (As Soon As Possible * As Simple As Possible)

‘Why waste people’s time with something obsolete like this?’ you might suggest… First, because we think it sounds cool, secondly because it kind of is true and thirdly because I always wanted to use the ’sup’ HTML tag for something other than an anchor to a footnote.

Digg something with no value whatsoever

Rails naming gotcha

Monday, May 29th, 2006

A quick one in hope that it might save some people a minor headache… I just found out that you can’t use the word URL as a Model name in Rails, otherwise you’ll get a

undefined method `rewrite' for #<Url:0xb7675e64>

error.

Digg some Convention over Configuration

Fashion Oriented Programming

Saturday, May 27th, 2006

Following last week’s roll off the last Java project I was recently working on, I got to spend most of this week on The Beach at the ThoughtWorks office in London with a more than welcome involvement in a Django project I’ve heard a lot about over that last few months. I’ve been preaching the brilliance of Python for some time now and was one of the many that were more than impressed with Django after I first got accustomed with it about six months ago.

I find it normal for a community of developers with a keen eye on the technology vanguard to embrace the dynamic language wave as an alternative to all the burden that comes with statically typed languages like Java. My personal opinion on the matter has nothing to do with Java being inferior to any dynamic language out there, but I do think that most of the Java web frameworks don’t do Java any favors. Same goes for the whole implementation of the concept behind ORM, but I won’t be talking about this in this post.

What impresses me is how much influence the notion of fashion on the web has over even the most brilliant people in the development world. Just ask yourself one simple question and you’ll see what I mean: How come a lot of the best Java developers think dynamic languages are better than Java all of a sudden? The keywords in the question are ‘all of a sudden’. It’s true, if I confessed that I think PHP is more suitable than Spring and Webwork for small to mid scale applications a couple of years ago, people would dismiss me as a script kiddy. And that’s the polite ones. Not too long ago, dynamic languages were hardly considered programming by the Real Programming elite.

As a matter of fact, PHP is still frowned upon. Seriously, how is Ruby better than PHP? Don’t even give me the Ruby is a pure Object Oriented language argument, because OO is a paradigm, not a programming language. Good design depends on the coder and the way they orchestrate their code. You can write good OO code on any language that supports Objects, inheritance, encapsulation, etc, you know the ones… And PHP does. Yes, PHP is not pure OO, which in some cases is a good thing, because not everything on a web app is better off being an Object, and Python is not purely object oriented, either. In fact Python is hardly object oriented, with all of its OO features being plugged into it at a later stage. And in the case of Python that shows badly, if you ask me. Not that this is a bad thing.

Java’s reigning status in enterprise software at the moment is largely due to marketing and politics, but the new breed of cool framework backed dynamic languages is very much about sales, too. Although, due to the fact that the whole movement started from small potatoes as opposed to Sun, the tactics fall more into guerilla marketing territory. Proclamations that ‘enterprise is the new legacy’ and books like Beyond Java are so blatantly directed to sales that it amazes me sometimes how people don’t see beyond that.

Back to my week in Django, I have to admit that test driving our code was a nightmare. Same goes for trying to achieve some sort of coherent and organized structure. And it’s not a huge app we’re talking about here either. I miss JUnit and I have to admit I’m glad I’ll be starting on a Java project next week. I’m not slagging off RoR or Django here, but it is obvious to me that they lack the long hours of concentrating on architecture given to, say, Java over the years in order to accommodate larger scale projects.

On a lighter note, I’ll leave you with the coolest/funniest conversation I’ve heard all week.

Frustrated developer: Hey, Python man. How do we do this?

Python man: I’m not gonna help you. I only evangelize about dynamic languages, I don’t write code in them.

You digg?

Showing developers the way

Thursday, May 25th, 2006

The path to PHPThis is a real road sign, not Nutrun feeling bored in front of Photoshop. For real.

What is interesting about this sign, is how I’d see it every morning on my way to work on a Java internet banking project. Scary, huh?

I have no idea what the acronyn stands for, and I’d say it’s propably a safe bet to assume it’s not recursive acronyme for PHP: Hypertext Preprocessor, although one of the P’s must have something to do with Pedestrians…

Brain Dead Development against the curse of the Servlet

Wednesday, May 24th, 2006

In the last two years, I have found it increasingly difficult to write code in a non TDD approach. Tests think for you. They dictate how actual code is going to be laid out, they take you by the hand and show you the way (Hmmm… ApocalypticTesting?..). It’s strange how things become so much clearer when I’m in the testShouldRockWithAGibson() path of thinking. It actually feels like I have to think less.

Hence Brain Dead Development (BDD). This is by no means coined as a derogatory term, I mostly went with it because it sounds sounds funnier than, say, Thought Process Enhancing Development, and term hunting is hardly my number one favorable activity anyway. Because tests do point out the solution. Or rather, make you ask the right questions, so that you realize the answers and solve the problems at hand sooner. And then you’re either going to impress your PMs and IMs with your agility and your velocity and productivity, or wait it out for the full length of the initial estimation for the task, read blogs and carefully plan a day for the purchase of a black MacBook. Or should you go white?..

I have found myself in situations where the main thing I have to concentrate on is come up with meaningful class and method names and ways to make the codebase more elegant, readable and effective. Everything else just sort of falls into place by keying [alt-Enter], [ctrl-alt-f] and a few other IDE key combinations. Add pair programming to the mix, ping pong the keyboard between the dev who writes the test and the dev who makes it pass and we could be talking serious fun here. Mention must also be given to the incredible sense of confidence a thoroughly tested application will offer, as you know that if you do something wrong, someone’s going to ring the alarm on time, before things get out of hand and certainly before an unnoticed bug makes it into production.

Attention to the way your tests look and behave will enforce good coding practices and will reveal structural code smells early on. You just know that when you have to mock 5 interfaces in one unit test it’s time to revise your strategy and rethink your Class structures and behavior. And if it’s time to import the cglib JMock library, then, man, you’re asking for it.

I know many people are practicing TDD every day, and I sense TDD is going to become a de facto practice for Agile and Waterfall type of evangelists alike very soon. This is why sometimes I’m surprised by the fact that there isn’t as of yet any significant movement away from Servlets, an API so crooked that it is almost impossible to test drive. Even WebWork, ‘the least worse Java web framework’ merely hides the Servlet ugliness, which is already a move towards the right direction, but certainly not enough and maybe too little too late.

Article on Java’s demise due to weight problems coming soon. Obviously…

Cool little tricks

Tuesday, May 23rd, 2006

Every now and then you stumble upon some cool little tricks that you haven’t come across before.

Here’s two I only recently found out about:

1. In recent versions of MySQL (4.0+, I think) you can do:

show create table <tablename>

This will print out the create statement for the table in question. Which makes table replication SQL scripts a breeze.

2. The script Linux command which will record any shell output in a file specified as an option to the command. That means you can turn more or less everything into a shell script, or at least a nice shell script outline which you can clean up and use.

Both of those are probably common knowledge among most people, so apologies to every one who already knew…

The best piece of software in the world

Tuesday, May 23rd, 2006

Talking about difficult questions, what is the best piece of software in the world in your opinion?

I have, from time to time, asked this to colleagues and friends of mine. The initial reaction is of course complete reluctance to answer a philosophical, to say the least, question like this. I always follow it with a clear hint: “Isn’t it Apache?”. Few have replied “no” to this. Would you? If we focus on shortcomings, as it would be the easy way out, as opposed to advantages, there are very few, if none, to be found when we examine the marvel of httpd.

So what is it that makes Apache so great? It sure isn’t revolutionary, at least not in the WEB 2.0, socially tag infused universe of 2006, but it still is the main force driving most things web. It’s not backed by a major commercial drive, the way Java is. It’s never been perceived as the next big thing to change the way the web works the way Ruby on Rails is - and that’s us developers who share this notion, not our boss, nor the clients who pay him to pay us to read blogs… Although Apache did change the web most drastically than anything else and there’s no candidate even daring to dream about challenging its reign.

Apache is right now at least 3 fingers worth of the right hand of Linux. And you can’t go wrong with that, Linux being the best operating system in the world (that you can download for free - and that matters). One of the most crucial things that are just right about Apache is the fact that it’s been developed as an integral part of Linux. And Linux has developed as the creation of people who enjoy writing software, with the intention of making the world a better place. Which is the case for any significant scientific achievement ever. Give or take, I guess….

The real question isn’t whether Apache is the best piece of software in the world today, because, hand in hand with most things Linux, it probably is. The point does not even boil down to a question. More of a mere fact as to what people who intent to write great software should probably keep in mind. Know what is good. And make your software play well with it. To spell it out: Make your software play well with Linux, Apache and whatever else has come to rightfully achieve standards status in the software world nowadays.

And then make it play well in MacOSX, the only piece of commercial software I would gladly pay for, due to its greatness. Which, of course is built on top of FreeBSD. Can you see a pattern emerging here? Great software feeds on great software

To switch the focus a bit more to a slightly more web application oriented direction, my humble opinion is that PHP, Python (mod_python anyone?) and PERL are superior to anything else at the moment, for the simple fact that they seamlessly collaborate with Apache, and are built on top of Linux. If you don’t find those to be major ingredients for success, then you’re better off writing some ASP application for your boss, who got a deal from a guy he knows, who knows someone who makes money out of reselling Microsoft licenses. Licenses coming from a company which is always a month too late to release a patch for bugs that have been exploited to the hilt a month ago already.

WordPress Praise

Sunday, May 21st, 2006

After having spent a few weeks playing around with options concerning what platform we’d use for the Nutrun website/blog, we are very pleased to announce the launch of nutrun.com as our home on the web, “proudly powered by WordPress“.

Below I’d like to comment on the other platforms and frameworks we looked into before we decided to use WordPress, specifically in terms of their unsuitability for what we were looking for.

Ruby on Rails.

Everyone’s web app framework of choice at the moment and with good reason. One of Rail’s main successes is inevitably the well spotted pattern of Convention Over Configuration. And this is my main problem with Rails. Just a bit too much convention over configuration. Sure, starting up a new application and having something impressive working in no time is a really great feature, but after working for a slightly significant period on Rails powered applications, I kind of mind the fact that Rails imposes the Rails way on you. This is by no means set in stone, but customizing standard Rails functionality slows development down a lot and makes things a lot more painful than what you’re initially led to believe when you have something that would take you 2 weeks of coding in Java just by typing ‘generate scaffold…’ twice and writing some CSS. Another thing that puts me off in regards to all the buzz covering RoR at the moment is the whole Simple UI theme, which, to me, sometimes sounds like a nice marketing plot for selling poorly featured applications as something that is easier and thus better to use.

Django

Similar to RoR, Django is very impressive when it comes to those first steps that, let’s face it, usually constitute 80% of most web applications. And the admin interfaces you get for free are too graceful to be ignored. Keeping in mind, though, that Django was written with a very specific kind of use in mind, you are bound to find it a bit too restrictive when it comes to that crucial 20% of the application. Another problem I had when dealing with Django was the fact that I had to patch the codebase many a time, as it is buggy. And the fact that the Django codebase is a little bit messy didn’t help either. It would be unfair, however, not to mention that making something ‘blogable’ is Django is only one line of code away. Django is going to be a really great framework for building online publication websites, and it will most probably be number one on my list if I have to write a site for a newspaper two years from now. I have also seen Django applied as a great tool to functionally mock out applications in no time. But that hardly makes a framework, and the fact that it’s talking to a database doesn’t make it that different from Adobe Image Ready, when it comes to the not-so-programming-savvy clients you’re presenting the demos to.

Java

Next on the list, as a natural choice after feeling restricted by the last two candidates, was a full blown Java app, powered by WebWork, Spring, FreeMarker, Jetty, XStream and… You get the picture… The list of dependencies goes on and on and on. First smell was the fact that even before I started, the application was nearing a whopping 10Mb. 10Mb for a simple blog has got to be too much. The code I wrote for the Java version of Nutrun was by far the most elegant one and I’m sure it would be the most maintainable and extensible one if it all came down to that. The fact that I spend most of my time coding in Java for work must have something to do with that, too, although I still think that all this attention in architecture in Java plays a big part to really nicely laid down code. But we all know by now that Java is just not the right tool for simple web applications, and I don’t even know any more why I even attempted to go that way. The problem with Java are its frameworks and the Servlet spec that ties you to something like Tomcat or Jetty (in the best of cases), amongst other things. But that’s the subject of a whole different post.

In our quest to find the most suitable engine to power our website, I forgot one very crucial thing common amongst most attempts to software and that is Systems Integration. Systems Integration is what Web Services and REST and Networks and ultimately software business value is all about. When we’re talking about code reuse, sure libraries are fine, but how often are they as important to a business, or even a day to day simple software task, as it is every time you fire up Apache and some things work straight away with it? And talking about Systems Integration, here’s a great example:

A Debian Sarge server, one apt-get command, a few create database statements, 3 setup screens after untaring the WordPress distribution in the Apache web directory and a few hours of configuring and styling.

What do we get? A lightweight, fully featured, customizable, with a very intuitive UI application, that supports all the popular syndication specifications, Valid XHTML, pretty URLs, multi user support, which plays great with MarsEdit out of the box and I haven’t even started yet… One might argue that we didn’t actually write something in PHP, but that is because we didn’t have to. And until there’s a Rails app that does what WordPress does, LAMP will be the winner in my list.

The main lesson learned is never to undermine the importance of Systems Integration and to indeed be skeptical against factors of ‘cool’. Systems are only mature after at least a couple of years of serious development has been dedicated to them. WordPress and LAMP in general are definitely not the coolest kids in town, but I’d be really interested to see a Rails or Django implementation of an app that gets close to WordPress in terms of functionality, ease of use and performance. And I won’t even go into Java….