Friday, 14. April 2017
Easter Eggs testen
Easter Eggs haben eine fast 40-jährige Tradition in der SW-Entwicklung. Als erste Software gilt Adventure aus dem Jahre 1978 für den Atari 2600, in der sich der Entwickler in einem geheimen Raum verewigt hatte - mangels anderer Alternativen.

Aber auch heute werden gerne noch Easter Eggs in Software und im Web versteckt - nicht nur zu Ostern. So können angehende Piloten mit Google virtuell ein do a barrel roll starten - einer Figur aus der Fliegerei.

Auch schön ist die umgekehrte Google-Suche mit elgooG - hier gibt es viel zu entdecken - ideal, um sich die Zeit bis zu den Stuttgarter Test-Tagen 2017 (#StTT2017) zu vertreiben.

Frohe Ostern

... link (0 Kommentare)   ... comment


Thursday, 2. February 2017
gdv.xport 2.0
Da es vor allem in der Bezeichner-Klasse größere Änderungen gegeben hat und einige als "@Deprecated" markierte Elemente aufgeräumt wurden, folgt jetzt auf 1.1 die Version 2.0 der gdv.xport-Bibliothek.

gdv.xport ist eine Java-Bibliothek, die den Umgang mit dem GDV-Format erleichtert. Weitere Infos zu dieser Bibliothek finden sich unter aosd.de/gdv.xport/.

... link (0 Kommentare)   ... comment


Saturday, 7. January 2017
PatternTesting 1.7 released

Most changes of PatternTesting are under the hood: switch to Java 7, switch to Log4J-2 as logging framework and better exception handling in FileTester - if a file cannot be found, it is checked if it can be a case sensitive issue. This happens often if the build runs on a Linux server with case sensitive filenames.

A bigger change was the implementation of feature request 49. You will now be warned if you forget a commit after an database insert or update (see also blog entry from September).

Another change was the split of the ClasspathMonitor into ClasspathMonitor and ResourcepathMonitor. For more info about the ClasspathMonitor see the blog of August 2009.

... link (0 Kommentare)   ... comment


Monday, 2. January 2017
Happy New Year 2017
“Ich kann freilich nicht sagen, ob es besser wird, wenn es anders wird, aber soviel kann ich sagen: Es muss anders werden, wenn es gut werden soll.”
(Georg Christoph Lichtenberg)

... link (0 Kommentare)   ... comment


Friday, 23. September 2016
JDBC: Don't Forget to Commit
If you want to save something in a database with pure JDBC you would normally
  1. take a connection,
  2. create a statement with it,
  3. execute the statement and
  4. close the connection.
Have I something forgotten? Don't know - so lets try it. Point 1 could be done by asking the Driver class, a connection pool or another kind of provider:
Connection connection = connectionProvider.getConnection();
With this connection you can call a method which uses this connection to save e.g. an address:
private static void save(Address address,
        Connection connection) throws SQLException {
    PreparedStatement stmt = connection.prepareStatement(
            "INSERT INTO addressbook (email, name, "
            + "city) VALUES (?, ?, ?)");
    try {
        stmt.setString(1, address.getEmail());
        stmt.setString(2, address.getName());
        stmt.setString(3, address.getCity());
        int rc = stmt.executeUpdate();
        if (rc < 1) {
            throw new SQLWarning("cannot save " + address);
        }
    } finally {
        stmt.close();
    }
}
As last point you close the connection in the calling method:
connection.close();
Does it work? In most cases yes, because normally the auto-commit flag is on, if you get a connection. But what happens, if auto-commit is off?

Auto-Commit Off = Lost Data

If auto-commit for a connecion is off you must call excplicit the commit:
connection.commit();
If you don't do it your changes are lost (there are some exeptions from that rule - the Oracle DB does a commit before it closes the connection).

The problem with this "forgotten" commit is, that no warning or exceptions comes up and you do not notice the lost data. This makes it hard to find the error - especially if the auto-commit is off only in same special cases.

The PatternTesting Proxy-Driver

PatternTesting provides you a wrapper around the original driver which allows you to log SQL statements but which warns you also if you forgot the commit statement for a connection with auto-commit off:

1 entries were updated with 'INSERT INTO addressbook (email, name, city) VALUES ('ob@aosd.de', 'Oli B.', 'nowhere')' but not committed.

This is the message you will see in this case. You only have to change the JDBC-URL and put ":proxy" after the jdbc prefix:
DriverManager.getConnection("jdbc:proxy:hsqldb:mem:testdb")
This is the URL for an HSQL memory DB. For more information see the Wiki article about SQL Logging and Monitoring.

Happy Debugging...

... link (0 Kommentare)   ... comment


Friday, 6. May 2016
Update auf Sonar 5.5 (Ubuntu 14.04)
Nach einem Udpate von SonarQube 5.4 auf 5.5 war mein Sonar-Server nicht mehr erreichbar. Was war passiert? Die Auswertung des Log-Files brachte folgende Zeile zu Tage:
    Unsupported mysql version: 5.5. 
    Minimal supported version is 5.6.
Dummerweise ist bei Ubuntu 14.04 LTS MySQL 5.5 die Default-Einstellung. Glücklicherweise läßt sich aber mit
    apt-get install mysql-server-5.6
MySQL 5.6 als Default einstellen - damit gab sich SonarQube zufrieden und verweigerte nicht länger seinen Dienst.

... link (0 Kommentare)   ... comment


Wednesday, 24. February 2016
First Law of Software Archaeology
Do you know that? You have to maintain some old programs and you are wondering what the hell is that piece of code doing. Why does it work? And where is the architecture of that damn software system you should adapt for the future?

Welcome to the world of software archaeology, also known as legacy code. The first law of software archaeology from Mitch Rosenberg (see Wikipedia) gives you good feeling about the trouble in digging in old rotten code:
Everything that is there is there for a reason, and there are 3 possible reasons:
  1. It used to need to be there but no longer does
  2. It never needed to be there and the person that wrote the code had no clue
  3. It still needs to be there and YOU have no clue
The corollary to this "law" is that, until you know which was the reason, you should not modify the code (or data).
And if you would like to learn some ancient language of the beginning of the computer stone age watch this video:

... link (0 Kommentare)   ... comment


Saturday, 20. February 2016
Datenschutz und Meinungsäußerung
Edward Snowdon:
"Zu sagen, man kümmere sich nicht um Datenschutz, weil man nichts zu verbergen habe, ist genauso, wie zu sagen, man kümmere sich nicht um das Recht auf freie Meinungsäußerung, weil man nichts zu sagen hat."

... link (0 Kommentare)   ... comment


Monday, 8. February 2016
gdv.xport 1.1
Nach Version 1.0 im letzten Jahr wurde dieses Wochenende die Version 1.1 ausgeliefert. Die Änderungen sind eher interner Natur (kleinere Refactorings bzw. Umbauten) und Rückmeldungen aus einigen Tests. So fehlten in der XML-Beschreibung einige Felder, die mit 1.1.0 über die Resouce "fehlendeFelder.xml" mitgeliefert werden (s.a. TeildatensatzXml).

... link (0 Kommentare)   ... comment


Friday, 8. January 2016
PatternTesting 1.6 released
PatternTesting 1.6 no longer supports Java 5 - you now need at least Java 6 if you want to use PatternTesting. On the other side the classloader of Tomcat 8 is now directy supported by the ClasspathMonitor.

Some deprecated classes and methods were removed now. And some tester were extended: the FileTester prints now the filename for files which differs (see feature request 47) and allows you to add a StringConverter as argument. This allows you e.g. to ignore white spaces or upper case letters.

The ClassTester checks now also static initializers to find dependency problems to other classes during the startup phase of a class.

... link (0 Kommentare)   ... comment


Friday, 1. January 2016
Happy New Year 2016
“Es gibt bereits alle guten Vorsätze, wir brauchen sie nur noch anzuwenden.”
(Blaise Pascal)

... link (0 Kommentare)   ... comment


Thursday, 24. December 2015
Advent, Advent
Die Adventszeit ist eine Zeit, in der man Zeit hat, darüber nachzudenken, wofür es sich lohnt, sich Zeit zu nehmen.

(Gudrun Kropp)

... link (0 Kommentare)   ... comment


Thursday, 19. November 2015
20 Jahre Java - und nun?
Bereits 2012 hatten wir bei der Java User Group Stuttgart uns einen Rückblick auf 20 Jahre Java gegönnt - reichen doch die Ursprünge von Java bis 1992 zurück. Inzwischen ist Java Mainstream geworden und entwickelt sich immer mehr zum COBOL der Neuzeit.

Von Entwicklung kann derzeit eigentlich kaum noch die Rede sein - man orakelt, dass hinter den Kulissen viele aktive Entwickler abgezogen wurden und viele Bereiche in der JDK- und JEE-Entwicklung jetzt brach liegen. Die spannenden Themen wie Mobile und IoT finden zunehmend woanders statt.

Aber auch wenn es in der Java-Szene kräftig rumort und einstige Zugpferde wie James Gosling oder Erich Gamma fehlen, so ist es an den meisten Universitäten die erste Wahl für objekt-orientierte Programmiersprachen. Und dies lässt hoffen für die Zukunft, dass sich Java trotz der derzeitigen Durststrecke weiterentwickeln und weiterhin für eine offen Welt stehen wird.

... link (0 Kommentare)   ... comment


Thursday, 3. September 2015
SW-Archäologie in Java aktuell
Es ist soweit - die Artikel-Serie über Software Archäologie, die auch Thema auf dem Java Forum Stuttgart 2015 war, ist jetzt im aktuellen Heft von Java aktuell zu lesen.

Wer meint, dass Altlasten (neudeutsch: Legacy) langweilig und nur etwas für zurückgebliebenen Entwickler ist, der irrt: zum einen ist Code spätestens nach 3 Monaten bereits Legacy Code (oftmals schon früher), zum anderen kann alter Code eine jede Menge erzählen: verschiedenen Firmen-Fusionen und Umbenennungen können an der Package-Struktur abgelesen werden, die Outsourcing- oder indische Area hat tiefe Spuren im Code hinterlassen, oder man entdeckt immer wieder neue Anti-Pattern, die man vorher nicht kannte.
Guter Code ist langweiliger Code!
Dies gilt auch für Legacy-Systeme. Ich kann Ihnen versichern, dass jede Menge interessanten Code in Altsystemen steckt ;-)

Die Zukunft war früher auch besser.
(Karl Valentin)

... link (0 Kommentare)   ... comment