daniel.paull's blog

C++ Mixins - Reuse through inheritance is good... when done the right way

Conventional Wisdom

Conventional wisdom tells us that code reuse through inheritance is evil. Go ahead and Google it if you're not clear on the stance in the community. The majority of articles that I've read encourage the programmer to favour composition and delegation (for example, by using the strategy pattern) over inheritance in order to attain code reuse. In general this advice is good as code-reuse-through-inheritance (as it is commonly implemented) does suffer from many problems. However, composition-and-delegation suffers from its own set of problems... So is there a better approach?

In this article I introduce the concept of the C++ Mixin. It will be shown that code reuse through inheritance in C++ mixins is not evil - in fact, it has so many advantages that it should be a technique commonly employed by C++ programmers.

Tutorials on C++ mixins tend to be a bit confusing and use contrived examples that make you wonder why you'd bother with this obsure technique. The intention with this article is to provide a easy to understand introduction to Mixins, their implementation and a comparison to other techniques for code reuse.

Think Bottom Up project selected for assistance by iVEC

Think Bottom Up is pleased to announce that our project to investigate GPU Accelerated Fingerprint Matching has been selected for first-phase assistance by iVEC through their Small Business Assistance Scheme.

SugarCRM 6.0 TextArea width via code injection

While SugarCRM provides developer tools, such as the Studio and Module Loader, to customise various aspects of SugarCRM, some simple things are not possible through the developer tools. In this case, the developer generally has to edit PHP files, possibly creating new field types to overcome the inadequacies of the built-in types.

Software Development Faux Pas: The Code Fux

Software design and implementation is still very much an art. This is not surprising when you consider that mankind, with the exception of a few individuals like Charles Babbage, has only been writing software for about 70 years. That, however, does not excuse some of the faux pas made in the name of "Software Development".

Software Development Faux Pas: Design by Deja Vu

Software design and implementation is still very much an art. This is not surprising when you consider that mankind, with the exception of a few individuals like Charles Babbage, has only been writing software for about 70 years. That, however, does not excuse some of the faux pas made in the name of "Software Development".

Design by Deja Vu

Imagine, if you will, that you are writing some code one day and you think, "Hey, I've done something like this before." You search through the code base and you find another instance of the "same sort of thing". You feel that this is an opportunity for reuse, so you strip out the common code and put it into some utility library so it can be reused in both places. I call this Design by Deja Vu and although it may be done with the best of intentions, I think that it is very, very bad.

Google Wave: Intention Preservation, Branching, Merging and TP2

Operational Transformation (OT) is hitting the mainstream thanks to Google Wave. The Wave Protocol uses OT as the basis for communication between clients and servers.

There are two properties required of OT algorithms in order to ensure consistency. In the literature these are called Transformation Property 1 and Transformation Property 2, or TP1 and TP2. Satisfying TP1 is required to guarantee convergence for two sites that apply concurrent operations in different orders. Satisfying TP1 and TP2 is required to guarantee convergence for any number of sites that apply concurrent operations in different orders.

Satisfying TP2 is hard! In fact, almost all published algorithms that claim to satisfy TP2 have been shown to be flawed. However, there is an alternative; it is possible to constrain the communication between multiple users in a manner that allows any number of users to concurrently edit a document, synchronize using OT and still converge while only satisfying TP1. The secret is to use a centralised server to make the communication look like n two-way collaborations rather than a single n-way collaboration where n is the number of users. The idea was published in the Jupiter Collaboration System and forms the basis of the Wave Protocol.

For a little background reading, the fellows at Coralius discussed the Wave Protocol and TP2 in their blog.

However, guaranteeing convergence is not the be-all and end-all of OT. In this article I will examine Intention Preservation and Concurrent Revision Control (Branching and Merging) for OT systems that do not satisfy TP2.

Introducing CEDA - a platform for collaboration

Today I am pleased to announce the first in a series of white papers that talk about CEDA. What is CEDA? Well, that's exactly what the first paper is about! The abstract of the Introducing CEDA white paper is reproduced below:

CEDA is a high performance database technology that uses Operational Transformation (OT) to support replication and synchronisation for collaborative data entry performed by multiple users. CEDA is an ideal platform for Computer Supported Collaborative Work (CSCW), allowing multiple users to edit that same data concurrently. Users can collaborate in a interactive, realtime manner or work offline and control when changes are propagated to/from other users.

CEDA provides an application development platform for building applications that support collaborative work. Application developers can easily build multiuser applications based on CEDA that are as responsive as single user applications while attaining benefits of realtime interactive collaboration and sophisticated version control. The platform allows for branching and merging of the entire database, supporting manual check-ins, check-outs, updates, tagging and so forth in a similar manner to source code repository systems like ClearCase and Subversion.

The OT algorithms employed by CEDA are extraordinarily efficient, allowing users to work off line for long periods of time and then quickly synchronise with other users.

This paper provides an introduction to CEDA and some of the platforms features.

Think Bottom Up staff have been involved in the research and development of CEDA for the last 12 years or so, though the original research by David Barrett-Lennard goes back further than that. We are very excited about CEDA and the potential of the technology. The collaborative features of CEDA are achieved through the use of Operational Transformation - an area of ongoing research that has gained a lot of press lately thanks to Google Wave.

Google Wave: Operational Transform and Server Acknowledgements

Google Wave is an exciting new product from Google that aims to become a communications hub, replacing many current communication types, including email, instant messaging, blogging and wiki. By encompassing the features of all of these systems, a single unified system can be used for all of these communication styles.

If you have not heard of Google Wave then the presentations given at Google IO 2009 are a great place to start to understand what it is all about:

GTK+ Extensions Made Easy Thanks to Vala

Writing proper GTK+ Widgets is difficult and time consuming. One of the big problems is the intricacies of the Gnome Object Model; the amount of boiler plate code that needs to be written to write a new class. Even writing a class that simply inherits from an existing class and adds some new state or behavior in tedious.

The problem is the syntax - the Gnome Object Model is a library for the C programming language that supplies a complete object model with inheritance, interfaces, reflection (for introspection) and so on. Where you might expect to see language features in an Object Orient language, you instead find naming conventions, macros and library function calls. Mastering the Gnome Object Model is no mean feat, and since C language bindings are preferred (possibly even expected, new Gnome libraries really need to be written in C. Or so that was the case until Vala came along.

Vala is a new language with syntax similar to C#. Vala does not compile directly to machine code, nor does it run on a virtual machine like .NET and Java. Rather, it translated into portable C code that is then compiled to machine code. The beauty of this is that the developer gets the benefit of writing in a higher level language than C which has appropriate language features while still being able to produce and distribute standard C language bindings for the Gnome Platform.

In this blog entry I demonstrate how to write a proper GTK+ Widget in Vala and compare it to what is required to write the same widget in C.

Astoria Offline: Alpha Preview Released

Future releases of ADO.NET Data Services will provide a data replication and synchronisation feature that will enable data centric applications to work transparently in both online and offline modes. The project charged with implementing the replication and synchronisation features is known as "Astoria Offline" and has just reached its first Community Technical Preview (CTP).

While it's still early days for Astoria Offline, there is enough information around to get an idea of what Astoria will and won't offer to developers.


Subscribe to RSS - daniel.paull's blog