My definition of legacy code comes from an interesting interview Michael Feathers gave at dZone. He defines legacy code as “code without tests”. And I bet, there is a lot of that stuff out there. But what if you decided to develop test-driven in the meantime? Should you leave the legacy code as it is? If you still want to use it, the answer is of course NO. But how could you make this good old big ball of mud better maintainable? Continue reading “Migrating legacy code to maintainable code with tests” »
Archiv für die Kategorie ‘TecZoom’
Migrating legacy code to maintainable code with tests
Mittwoch, 14. Juli 20105 Reasons for Keeping Your Git Commits as Small as You Can
Freitag, 09. Juli 2010Keeping your commits small brings you several benefits when using Git as source code management tool and is generally good advice:
You should try to split your changes into small logical steps, and commit each of them.They should be consistent, working independently of any later commits, pass the test suite, etc.
So what exactly do you gain from following this advice?
Makes your commit messages more accurate

Writing commit messages that describe the content of your patch can be difficult. Especially when you cram many changes into a single commit. Try to follow the ‘One Single Change Per Commit’ rule and prefer two commits like
Fix logging bug in Logger.warn()
Organize imports.
over a one long commit like
Fix logging bug in Logger.warn() and organize imports.
It is not always this easy but often possible, just try it.
Makes continuous integration easier
The whole idea behind continuous integration (or CI) is to integrate your own code with the main repository as often as you can. If you make small changes and put them into single commits you may integrate them often (and probably should). Doing so minimizes merge conflicts with your team members. You can read more about CI in a Git context in Martin Fowler’s excellent FeatureBranch article.
Makes git-revert more useful
git-revert allows you to apply a single commit negatively and thereby roll it back and make it undone. This comes in handy on several occassions: When taking back a change which was inadvertently pushed too early or when taking out code once again which turns out to contain bugs. When keeping your commits small chances are you just can revert this single commit as a whole. No need for cherry picking single lines of code.
Makes git-bisect more useful (my favorite)
git-bisect is a fine bug hunting tool whenever you encounter strange behaviour which you know was not there before in an older version of your code. It deserves an article on its own.
But the basic idea is to switch back to any older version of your code which did not contain the bug, tag this version as good and then let git-bisect do its magic (it’s basically just a binary search through your commit history, which is kind of magic anyway). When git-bisect finishes its search it outputs the single commit which introduced the bug.
And that is why it’s especially useful to keep your commits small when you want to git-bisect often: When git-bisect tells you the buggy commit and it is small enough you can often enough spot the buggy line(s) immediately.
You can combine multiple commits into one large commit after all
If for some reason you believe you created too many commits when a single should have been sufficient then you can squash several commits into one with git rebase. git ready explains how squashing commits with rebase works. Beware that this only works as long as you have not already shared your local changes with anyone else.
apples soon to be tarted… image published by jek in the box {is traveling}
under a Creative Commons License.
GWT 2.1 M2 released
Donnerstag, 08. Juli 2010The second milestone of GWT 2.1 was released last friday. The integration with Spring Roo, a tool which incorporates a code generator as well as compile-time weaving capabilities has been pushed forward. I also had a look at the Ray Ryan’s new video Architecting GWT apps, which builds on his presentation from last year, Best Practices for Architecting GWT App. It looks like the Roo integration will save you a lot of typing plus it uses the current best practices for architecting GWT apps. The MVP (Model-View-Presenter) pattern which Ray introduced last year is superseded by Activities (a concept taken from Android) which in turn are managed by an Activity Manager. This combination should make the tedious issue of history management history ![]()
I hope to get to test the GWT + Roo combination soon, I will post back my results then.
Steve Jobs and Steve Ballmer now buddies – or – a look into the crystal ball for WWDC 2010
Freitag, 28. Mai 2010Strange things happening lately. Right after Google more or less officially announced that their battle against Apple is on, it turns out that Microsoft will be playing together with Apple. Yes, you heard right – Microsoft is teaming up with Apple – to provide a development platform for iPhone apps in Visual Studio 2010. Continue reading “Steve Jobs and Steve Ballmer now buddies – or – a look into the crystal ball for WWDC 2010” »
Bei Ruby 1.9.2 sparen: Es ist alles möglich!
Freitag, 21. Mai 2010Hab grad nach Ruby 1.9.2 gesucht und war überrascht, dass ich eine AdWords-Anzeige zu sehen bekam:
Der rote Kringel neben dem Anzeigentitel kommt übrigens von Web Of Trust und sagt aus, dass die meisten Benutzer diese Seite als nicht vertrauenswürdig einstufen.
Adwords Anzeigen: Es ist alles möglich!
Google I/O 2010 Preview
Montag, 17. Mai 2010In zwei Tagen ist es wieder so weit: Google lädt zur I/O, der hauseigenen Entwicklerkonferenz. Letztes Jahr wurde dort Wave Continue reading “Google I/O 2010 Preview” »
State of web development technology 2010
Donnerstag, 06. Mai 2010Which tools are hot and which are not for web developers in 2010? A recent survey conducted by John Allsopp, with support of Continue reading “State of web development technology 2010” »
Next generation internet – what could it be like?
Freitag, 30. April 2010Today, I stumbled upon a very precise vision of Web 3.0 by accident. Although the definition is already 3 years old, it still seems to be a very short and precise description of what the next evolutiuonary step of the Continue reading “Next generation internet – what could it be like?” »
Martin Fowler’s DSL book coming
Mittwoch, 28. April 2010Martin Fowler has a new book in the making on domain specific languages (DSL). For a while now domain specific languages have been a hot (but under documented) topic in the software development industry.
The idea behind DSLs is to create different programming languages specifically tailored to high level processes like e.g. invoicing, air traffic controlling or software testing. Cucumber is one of the software testing DSLs we use at crealytics to describe program behaviour in plain text.
A good DSL enables concise descriptions of complex behaviours. I believe DSLs will be getting more important in the future, glad Martin fowler is working on that topic.
patch for do_jdbc – mapToQueryString
Samstag, 24. April 2010We use DataMapper – an Object Relational Mapper – in parts of our software to make it easier to access our database. In a jruby environment DataMapper will use the JDBC drivers provided for Java with the help of do_jdbc – a component of data_objects used by DataMapper for the actual database access.
As we tried to pass several parameters in the connection URL to the PostgreSQL JDBC driver, we found a bug in the way do_jdbc creates the connection URL passed to the JDBC driver. There is a method mapToQueryString(Map<Object, Object>) in AbstractDriverDefinition. It is responsible for creating the query string of the connection URL. As you all know several query parameters have to be seperated by an &, as you can see every day browsing the web. However, mapToQueryString forgets to insert &s into the query string, thus making it impossible to pass options to JDBC drivers via the connection URL.
You can find a simple patch at our fork of the github project (patch).

