January 26, 2009, 15:46
Im Grunde meines Herzens finde ich ja die folkloristischen Umtriebe der katholischen Kirche ganz lustig. Wenn das ganze aber in Richtung strafrechtliche Relevanz geht, hört der Spaß wohl doch auf.
Ein kurzer Besuch beim Bund der Steuerzahler brachte folgende Erkenntnis: Wer in Hessen wohnt und 30.000,- EUR im Jahr verdient, zahlt im Jahr gut 400 EUR Kirchensteuer, bei 35.000,- sind es schon gut 550 EUR und bei 45.000,- EUR stolze 850 EUR. Das Geld kann man sicher besser anlegen. Der Mitgliedsbeitrag der Humanistischen Union beträgt beispielsweise nur 90 EUR. Die HU setzt sich neben Bürgerrechten im allgemeinen auch für eine klare Trennung von Staat und Kirche ein.
Update: Die HU hat heute eine Pressemitteilung zum Thema veröffentlicht.
January 22, 2009, 16:06
I just came up with a new categorisation of application frameworks, which funnily enough places rails and most of the hibernate based java approaches in the same category: dead object framework.
What do I mean with that? Well being all eagerly object orientated our domain is nicely modeled in classes, whatever language we choose. In theory (that is what we have to tell ourselves) these are enforcing all kinds of contracts on our business objects. However taking a close look how all those frameworks work, we quickly realise, that the instances of these class are highly transient and live for about one request. If we look even closer we will also realise that people wrote loads of SQL scripts for migrating data, doing reporting and the likes, because doing it in the language of choice “doesn’t perform”. There goes your data integrity…
Contrast this with the way a lively object framework like seaside works. There the actual object instance exists throughout the runtime of the application. If you are changing the same conceptual customer, you are also changing the same instance. This comes very handy when debugging. You can actually inspect (watch) a customer object and see what happens over time and there is a lot less surprises, due to the way objects get externalized and then marshaled back. The lifespan of the object mirros
the lifespan of the conceptual object (yes, I do believe in the value of OOA as a way of thinking about the real world).
If however you are stuck with a relational database, OO is not your friend. At least not as in modelling your business object classes as classes in your programming language. The task of getting data from the database and then throwing it at a browser seems very functional. So you might be better of using functional programming techniques. Meta programming can also be applied successfully. To make it a complete heresy: Delphi is still unbeaten, when it comes to writing applications against relational databases quickly.
January 22, 2009, 14:19
It has been a while since I last used LaTeX. And things have moved on. I wanted to write a paper as well as preparing some slides. I also had to include vector graphics and bitmaps as well as source code. So this is what I learnt:
- Use pdfLaTeX! It produces PDF straight away and including images in various formats is painless.
-
Including images:
% in the preamble
\usepackage{graphicx}
%wherever you need to include
\includegraphics[width=12cm]{image.png}
This supports png and jpg as well as pdf for vector graphics. You might want to use epstopdf to produce
pdf form eps.
-
Including source code with listings:
\usepackage{listings}
%Setting defaults for formatting
\lstset{
language=Java,
basicstyle=\ttfamily\small,
keywordstyle=\textbf,
stringstyle=\ttfamily\textbf,
showstringspaces=false,
commentstyle=\textsl,
captionpos=b
}
% And now including code
\begin{lstlisting}
public interface ListDataListener extends EventListener {
void intervalAdded(ListDataEvent e);
void intervalRemoved(ListDataEvent e);
void contentsChanged(ListDataEvent e);
}
\end{lstlisting}
-
Setting urls:
\usepackage{url}
\url{http://wuetender-junger-mann.de}
-
Creating slides using the beamer class (beamer being German for projector) to show code
snippets:
\documentclass{beamer}
\usepackage{listings}
\title{Weird Presentation}
\author{Felix Leipold}
\date{January 2009}
\begin{document}
\frame{\titlepage}
\begin{frame}[containsverbatim]
\frametitle{Example}
\begin{lstlisting}
sourcode.goesHere();
\end{lstlisting}
\end{frame}
\end{document}
-
These days there is good support for using postscript fonts instead of computer modern. The following packages help including them: times, avant, bookman, newcent, palatino, helvet. The are included with \usepackage{packagename}.
-
When using latex for reporting the
longtable package provides
good support for tables spanning multiple pages.
- Further reading:
January 20, 2009, 15:34
After all the abuse in my previous post, I feel a bit guilty. Luckily Mockito provides a way out of that problem by allowing hamcrest matchers being used to verify arguments. Here we go:
verify(listener).propertyChange(
(PropertyChangeEvent)argThat(
new HasEqualState(
new PropertyChangeEvent(holder, "value", "Old", "New"))));
It is not nice, but it works. Of course I also had to implement the HasEqualState matcher along these lines:
public boolean matches(Object actual) {
if (actual == null)
return false;
if (actual.getClass() != reference.getClass()) // this might be naïve
return false;
Class clazz = reference.getClass();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
Object refValue = field.get(reference);
Object actValue = field.get(actual);
if (refValue != actValue) {
if (refValue == null || !refValue.equals(actValue)) {
return false;
}
}
}
return true;
}
January 20, 2009, 14:30
What troubles me with java is, that the implementors of its standard library utterly failed at setting an example. Java developers don’t know how to do proper christian oo, because every time they peek into the library sources they see C-ish hacks.
Today I realised that PropertyChangeEvent is not implementing equals based on its value.
It is almost immutable, apart from a stupid field that has been added for “future use”. And there is a lot
to be said in favour of immutable objects with value semantics.
This is, what I was trying to do:
ValueHolder holder = new ValueHolder();
holder.setValue("Old");
final PropertyChangeListener listener = mock(PropertyChangeListener.class);
holder.addPropertyChangeListener(listener);
holder.setValue("New");
verify(listener).propertyChange(new PropertyChangeEvent(holder, "value", "Old", "New"));
It is going to be messy…
January 13, 2009, 14:24
Muss gerade mal festhalten, dass “halbseiden”, “überspannt” und “altbacken” schöne deutsche Wörter sind, die sich so nicht ohne weiteres ins Englische übersetzen lassen.