Saturday, December 22, 2007

[Arch] Book Review: Kent Beck "Implementation Patterns"

As promised 10th Dec here is the second book review. Recently we discussed beautiful code, and now we have: Kent Beck, "Implementation Patterns", Addison-Wesley, ISBN-13: 978-0321413093

Of course Kent Beck is well known in the software-engineering and development space. He wrote books about
  • Better Smalltalk
  • Patterns
  • Eclipse
  • JUnit Pocket Guide
  • Refactoring
  • Test Driven Development,
and of course he might be best known for XP and his XP books.

Thus it's more then important to listen if he brings out a new book. And in fact this book is a wonderful and easy reading - in contrast to beautiful code - and a good reference for every ambitious developer.

Let's first have a look at the books chapters:
2 - Patterns
3 - A Theory of Programming
4 - Motivation
5 - Class
6 - State
7 - Behavior
8 - Methods
9 - Collections
10 - Evolving Frameworks
App A - Performance Measurement

So the first impression is, that something like state or behaviors sounds like the classic pattern categorization. But it is more from a different perspective: The developers perspective. For example the last three chapters - and even more performance measurement - can rarely be found in developer books. Unfortunately such important chapters like performance is just a small appendix. Most examples are written in Java which is especially important for the collection chapter that also shows lots of performance comparisons.

The interesting surprise in this book is that Beck writes about issues like "Classes" from scratch. Many of us might think they know everything about classes and can not be surprised. But Becks writing always forces you to look from another perspective. And this is the books strength. When Beck writes of Code "Communication" and e.g. naming Classes or Variables he pulls you up from a developer to an advanced developer in the complete context.

In fact Becks book is a great reference book that cover lots of issues. Some examples: Classes, Superclasses, Interfaces, Abstract Classes, Versioned Classes, Value Objects, Specialization, Subclasses, Implementors, Conditionals, Delegation, Pluggable Selector, (Anonymous) InnerClasses, all kind of Access Strategies, Variables & Fields, Parameters, Constants, Names initialization Modes, and so an on the Behavior and Methods Chapter.

So what might be criticized?

In fact some things can be found elsewhere in other books like Bruce Tates "Better, Faster, Lighter Java" or Bruce Eckels "Thinking in Java". And Kent Beck even reuses parts from his older books. Sections as the "Pluggable Selector" can be found in his TDD book and in Implementation Patterns even if Kent has invented complete new code examples for this pattern. And rarely some examples are a little elusive (e.g. when missing code symmetry looks more like missing intentional/implementation definitions from the start). But don't get me wrong: it's super worth reading and should lay next to nearly every developer!

To summarize

If you are an advanced developer guru who has reflected for years about your own code you will not find the book a complete new revelation. But for developers who still love to reflect about code and like to have a developers reference at hand, this book is a wonderful meta-best-practices extract with lots of issues that TatesEckels* are missing.

Need a post Christmas Gift?
Happy Chistmas!

Friday, December 21, 2007

[Tech] Tim O'Reilly: From Web 2.0 to Robotics and Genomics?

Tim O'Reilly speaks in an interview at the Web 2.0 Expo in Berlin about the "second coming of the web", that they named Web 2.0 at time ("a stupid name") and he shares some thoughts about current "social networks" and "social graphs" like implemented in Facebook, and why he is not really happy with many of the current developments. He again stresses the importance of data over applications and sees several "undiscoverd data bases".

He also refers to Open Social. An interesting initiative from Google to provide a common API for various social applications, that could provide a basis for software developers to create larger clusters of social applications. Furthermore he discusses privacy aspects and the change in the attitude of people towards privacy.

However he is apparently not happy with current developments, which are not adequate to the possibilities new devices (like the iPhone) and "Web 2.0" generally would allow. He also compares innovation cycles: the PC was hot in the 80s and got very boring in the 90s also due to the dominance of companies like Microsoft. Similar developments could be seen with the phone companies, that overslept most of the new developments and might happen to todays giants like Google.

So the underlying question is: Do companies and particularly developers understand the potential of "Web 2.0" ?

[Misc] Merry Christmas

Merry Christmas to all our readers and a thank you to all authors who contributed this year!

I think this was a quite good year for us. We meanwhile have a good and continuously increasing number of readers and feed-subscribers; I think that the quality of the articles was fair at least and by the end of the year we even got a new author in Stefan Edlich.

I hope we are going to do fine in 2008 and we are again going to be able to welcome many new readers and more interesting discussions.

Have relaxed Christmas holidays, I think you all deserved it, and stay tuned in the new year!



Tuesday, December 11, 2007

[Event] Die One Laptop per Child Austria Initiative: OCG

This blog article announces an event in Vienna:

Für alle, die die wirklich interessante Präsentation von OLPC Austria an der TU verpasst haben, freue ich mich folgende Veranstaltung im Namen von Mag. Stockinger und der OCG ankündigen zu dürfen. OLCP ist nicht nur ein wichtiges Projekt für Entwicklungsländer, es bietet auch für Programmierer eine Herausforderung, die es wert ist anzunehmen! Für alle am Projekt oder an der Entwicklungstätigkeit in diesem Umfeld interessierten:

Die One Laptop per Child Austria Initiative
Treffpunkt Kulturinformatik, 13. Dezember 2007

One Laptop per Child (OLPC) ist das ambitionierteste Bildungsprojekt der Welt. Der XO Laptop ist ein speziell für Kinder entwickeltes Unterrichtsmittel. Er ist extrem robust, hat einen unter vollem Sonnenlicht lesbaren Bildschirm und kann tagelang ohne direkten Stromanschluss verwendet werden.

OLPC Austria ist der erste europäische Verein, die die Entwicklung des XO-Laptops unterstützt. Ziel ist es, Software für den Laptop zu entwickeln und das Projekt in Österreich und Zentraleuropa zu fördern. OLPC Austria agiert mit offizieller Unterstützung des OLPC-Projekts am MIT Media Lab.

Die Vortragenden werden auch einige XO Laptops mitnehmen, die die Teilnehmer auch in die Hand nehmen können.

Bitte anmelden! und teilnehmen!

Monday, December 10, 2007

[About] Welcome Stefan!

A warm welcome to our new blog-author Stefan Edlich! Stefan is currently professor at TFH Berlin. We got to know each other at a persistence event that I organised in Vienna, and Stefan gave a great talk about db4o. Stefan is not only an expert in object oriented databases and involved in the organisation of the icoodb conference, but has a broad view and vision on Software Engineering (also, maybe particularly? in the Open Source domain) as can be seen by the seven (!) books he has published about topics ranging from Apache Ant and Commons to db4o. Enough said from me, check out his homepage for details!

I am happy to have you on board, looking forward to more articles and hope for interesting exchange of news, ideas and concepts on this platform!



[Arch] Two important new books: two reviews

Recently two interesting books have been published:

1. Andy Oram & Greg Wilson, "Beautiful Code",

OReilly, ISBN-13 978-0596510046

2. Kent Beck, "Implementation Patterns",

Addison-Wesley, ISBN-13: 978-0321413093

Let's have a look at the first one. The second one will be looked at in the next review posting here.

There have been a lot of rumors before "Beautiful Code" has been published. Perhaps because there are not really that much book that cover something like "the art" of coding. So whenever I listen around, all the Gurus I know seem to read that book. So it must be important...?!

What primary stucks is that the book is edited by Oram / Wilson. What they have done is: they have called for chapters. In this way they have been able to attract 33 chapters from famous coders. This means that the book has no golden thread. The chapters are not build upon another. They simply cover the "Beautiful Code" view of the author. This in turn means that the chapters differ entirely and are not connected. So you have chapter that sound more like beautiful design, beautiful architecture or chapters that discuss what beautiful code might look like or what beautiful language design might be.

Let's have some random examples:
  • Brain Kernighan shows us a regular expression and it's power using C code stuffed with lots of pointers.
  • Karl Fogel shows the delta editor that is the basis of subversion. This includes C Code with lots of comments.
  • Jon Bentley is the first who uses 'higher level' languages, compares some quicksorts and even shows a little mathematical background.
  • Alberto Savola introduces JUnit and shows how beautiful tests can cover a binary search algorithm.
  • Image processing code by Charles Petzold.
  • Bryan Cantrill discusses threads in connection with beautiful code.
  • Jeffrey Dean and Janjay Gemawath show you evolving code leading to the map-reduce solution.
  • Andreas Zeller write about beautiful debugging. He doesn't show too much code, but some insights could rarely be found elsewhere.
  • Yukihiro Matsumoto (the brilliant author of ruby) only shows 13 lines of code but is getting into a short philosophical discussion, how a programming language should look like that 'offers' the ability to write even more beautiful code.

There are a lot more topics like:

finding code, XML Verifiers, beautiful frameworks, operator precedence, secure communication, DNA sequencing and gene sorting, beautiful code at CERN or in LINUX, a reliable Enterprise System for NASA's Mars Rover Mission, software transactional memory, audio& emacs and even Logging, REST, are covered.

Most readers might think at first glance that some areas might not be of interest: LINUX code, Bioinformatics or the Architecture of an Enterprise Ressource planning System might not be every ones first choice to read.

But nevertheless: in my opinion, nearly every of this 33 chapters in this book is a wonderful insight into beautiful XXX from different viewpoints where XXX is code or software-engineering, design, problem-solving or whatever.

But one should not get the weight of this book wrong. It is not possible to read the 550 pages like a novel and finish it in a few evenings. The book challenges you to invest hard work in each of the 33 chapters. The problem / challenge is to understand each code and each problem. To my opinion this need 1 hours per chapter and a some sheets of white paper to get the complete insights.

So to summarize, there might be two readers for this great book:

A) Just read the pages and you might have heard about 'map-reduce' or cool 'testing or debugging'. This might work faster.

B) You would like to understand each area covered in the book. This might cost you 33 hours but you will improve your IT knowledge dramatically.

So what type of reader are you?

Wednesday, December 05, 2007

[Arch] Threads are evil

I just stumbled over the article written by Edward A. Lee professor at Berkely University with the title "The Problem with Threads" (PDF):

In this technical report he raises some interesting points. Actually we all know how difficult it is to program "clean" multi-threaded applications, particularly when data has to be shared. He analyses the problems in detail and illustrates that even quite simple algorithms/patterns like the observer pattern are very tricky to be implemented in a truly thread-safe way.

What is particularly dangerous is the fact, that a programmer might think, he or she had done a thread-safe implementation but actually did oversee issues that could lead to deadlocks or concurrency issues. He discussed the inherent complexity of concurrent programming, and I would add the resulting complexity in testing these multi-threaded programs. They tend to behave in a non-deterministic way, with strong dependencies on operating system- or virtual machine implementations (like different thread scheduling on differnt platforms) and hardware differences (single processor, single core; multi-processor, multi-core machines). Test could run fine on one machine and (occasionally) fail on others.

Summing it up, many bugs in such programs will not be found, and might emerge with new (different) hardware or usage scenarios, as Lee poses it:
"I conjecture that most multi-threaded general-purpose applications are, in fact, so full of concurrency bugs that as multi-core architectures become commonplace, these bugs will begin to show up as system failures. This scenario is bleak for computer vendors: their next generation of machines will become widely known as the ones on which many programs crash.

These same computer vendors are advocating more multi-threaded programming, so that there is concurrency that can exploit the parallelism they would like to sell us. Intel, for example, has embarked on an active campaign to get leading computer science academic programs to put more emphasis on multi-threaded programming. If they are successful, and the next generation of programmers makes more intensive use of multithreading, then the next generation of computers will become nearly unusable."
He further analysis ways to "prune" nondeterminancy by software engineering process, specific test-procedures or explicit language thread support like in Java and the problems associated with it. He also suggests altenatives to threads and ways to implement concurrent programs like coordination languages. He concludes:
"Concurrent programming models can be constructed that are much more predictable and understandable than threads. They are based on a very simple principle: deterministic ends should be accomplished with deterministic means. Nondeterminism should be judiciously and carefully introduced where needed, and should be explicit in programs. This principle seems obvious, yet it is not accomplished by threads. Threads must be relegated to the engine room of computing, to be suffered only by expert technology providers."
Stimulating article, I must say. Any comments, own experiences?

Tuesday, December 04, 2007

[Tech] The Androids are coming?

Actually I am a little bit embarassed to write about Google Android, as I thought, that already everyone knows about the newest Google feat. However, talking to some colleagues and students, it is apparently not yet so well known as a I thought.

Now what is Android?

Google released recently in cooperation with the Open Handset Alliance (including companies like DoCoMo, LG, Motorola, Samsung, T-Mobile, but also a series of software companies like Google, Ebay, and general hardware companies like Intel, Qualcom, Texas Instruments...) an Open Source operating system for mobile phone. The API and development language is Java. And, no, so far there are no mobile phones available that already use Android as a basis. And this is for sure the critical point. Rumors say, that next year the first mobile phones on Android basis might appear.

However, I think that this approach is very interesting. Let's face it: the iPhone is a cool gizmo, but too closed; Symbian and the like are a pain in the a... and developing in Java Micro Edition is all but fun. I also believe, that an open cell-phone platform could bring a significant incentive for new innovative mobile services.

Google provides an SDK for download at Google Code that includes a phone-emulator and a set of nice videos on YouTube. Some of them give a general introduction, some lead through the first development steps in writing an Android application given by Dan Morill.

I actually like what I have seen so far and would really love to see an opening of the mobile-phone sector.

Update: What I completly forgot to mention is the Developer Challenge. Google provides 10 Mio US$ that will be distributed between two calls:
  • Submissions until March 3
  • and submissions after the first handhelds are launchen in probably late 2008
Check out the website for more details.