Robert Lemke on a Mission for Clean Code

Categories: Development created by heise Developer

On the occasion of the TYPO3 Community Conference T3CON11 and the scheduled release of version 1.0 of the FLOW3 framework on October 20th heise Developer sat down with Robert Lemke, the core developer behind FLOW3, for a quick chat.

heise Developer: At the beginning you couldn't have imagined what could be done with FLOW3 and where the journey could go to. What were your demands for FLOW3 – what did you want to achieve, where are you now and what do you want to implement next?

Robert Lemke: We actually wanted to make only the CMS. We really didn't plan to develop a framework. The main reason to do that anyway, well – only because we have so many extensions for TYPO3 there are so many possibilities for developers to make mistakes or in general to do things the wrong way. Because of that I wanted to have a foundation which would prevent those many mistakes in the first place by guiding you towards a clean programming style by using conventions.

Robert Lemke is lead developer of TYPO3 Phoenix, founder of the FLOW3 framework and co-founder of the TYPO3 Association. He is passionate about clean code and made it his goal to introduce proven development techniques and architectures from other programming language in the PHP world. Currently Robert Lemke works full-time on TYPO3 and FLOW3.


hD: It sounds like, as addressed in the keynote, you enforce these conventions – it's not like with a pure components framework that I can just pick some cherries and use them. When I use FLOW3 then I will only use FLOW3.

RL: Precisely. It is however encapsulated so well that the framework shows only minimal dependencies in your code, i.e. the code you develop has only minimal API-dependencies on FLOW3. So you can take for example a symfony component and use it directly in FLOW3. The other way around you cannot just take parts of the functionality of FLOW3, like you could do with, for example Zend framework which merely consists of components. Symfony is similar although it has stronger dependencies. For instance, they distinguish between bundles and components, you can just pick the HTTP Kernel or the Depency Injection part – which is not possible with FLOW3.

hDDo you see symfony as a rival or competitor?

RL: Well, yes. Especially, because I think that symfony is a good framework, I notice that a lot of developers who are interested in FLOW3 at the moment have originally considered symfony for their projects. We also have a lot of concepts in common but we created a different flavour and offer a different overall concept.

hDI know that you have been talking about things like aspect oriented programming (AOP) for years. Why does this subject really gets takes off now?

RL: I think that AOP hasn't really taken off yet (laughs). But I have presented Dependency Inject for the first time about, I don't know, probably six years ago at a PHP conference. It was not interesting enough back then. Meanwhile it has spread and the PHP community is slowly moving in a direction where PHP is not only used as a templating language, but also for large and serious projects.

hDDo you notice that companies are interested in promoting the development?

RL: We do this with the background that the requirements become more and more complex. Especially in the TYPO3 environment we have collected experience during the past ten years which is used this way – the applications contain more and more business logic, the people use TYPO3 not only for a website but develop their marketing instrument with it, or their accounting software for sales representatives or something else. I have looked into other programming languages and other frameworks to see which techniques exist that really simplify this process. To implement complex projects easier.

hDWhat does FLOW3 offer in this regard?

RL: Basically FLOW3 allows that developers do not need to write too much code and at the same time need to rely on as little 'magic' as possible. The development should remain transparent and unexpected things should not suddenly happen. You have to understand that there is a basic principle and that should remain recognisable. When I work on typical application parts, which for example displays customer information, I implement a method in my controller which has perhaps three to four lines of PHP code. Additionally there is my template in HTML, in Fluid – and I can be assured that the framework can for example apply security features to it. Because if I followed the conventions (named my action showAction or deleteAction) the default security settings take control and via AOP the security code is injected from a central location.

hDYou have indicated a few pilot projects in a session which would use FLOW3 already. What kind of projects are they?

RL: One is a large company in Germany. The customer database is maintained via various end points (websites, web services). FLOW3 is here the central point of the customer database and provides as middleware all the systems with the necessary information. For another well known corporation there is supposed to be another project based on FLOW3 – this is what I actually expected, that it's the rather large projects that use FLOW3 first because they need a lot of code of their own and less content management in the beginning.

hDAlso because they know topics like Dependency Injection from their Java environment?

RL: Yes. There are indeed a lot of Java developers who now work in companies where they program in PHP – because they simply wanted to make something cool. On the other hand they are looking for something of which they feel that it makes sense regarding architecture, etc. They think it's very nice, right.

hDWhich is also interesting, because you often enough hear on the topic of architecture that PHP is a bit creepy, we'd better use Java or C#.

RL: I think so. In San Francisco I had this experience with Jez Humble of ThoughtWorks ( – he works with a lot of my idols such as Martin Fowler and others who have built the whole story with Agile. He had looked at FLOW3 and said that it was indeed some pretty transparent and meaningful code – and still PHP.

hDFLOW3 is still very much in development – how do the projects that already use it respond to changes in the code base?

RL: I would say we have certainly four or five times rewritten the entire code and the API has changed surprisingly little. Especially because there are so few contact points between the actual code that you develop – for example the domain models, they have zero dependencies on the system; perhaps a few annotations, but no classes from the system are used directly – that we were able to keep the basic conventions and that way the changes were not bad at all.

For the future we do plan to also make changes to the API. That's a possibility you need to have. We want to communicate it well and always provide the appropriate migration tools that analyse your code and and modify the client code in a controlled way.

hDCan you already imagine what you provide later on after FLOW3 1.0 is released?

RL: Sure, a lot. Priorities for versions 1.1 and 1.2, that is already fixed, are generally first performance and secondly the Package Repository – a bit like the Extension Repository for TYPO3, our market place for extensions. It's very important that there will be one for FLOW3 too. Localization is already finished for about 90 percent but the complete concept is still missing because localization influences a lot of aspects – you want to translate objects, labels, but also URLs, etc. – that's why we want to have the concept ready before we present it.

hDWhere do the ideas come from, where does the development come from for you?

RL: The basic ideas are actually not from the related agency, more the requirements. It was important in this regard to find a couple of people with whom you can discuss this well. Share the feeling, we had to build the architecture in a bit more professional way and implement certain patterns.

hDHow many people are involved?

RL: In the TYPO3 Phoenix Team we have about 14 persons, with FLOW3 there are about eleven developers who actively work on the framework and then there is circle of early adapters.

hDWhom should we keep an eye on to stay up-to-date with FLOW3?

RL: We have in the team each a bit of a specialisation, one is responsible for security, one for routing, etc. For the launch of version 1.0 we will make the website once again, then there are Core Team members with a Twitter account and more. Other than that – sure, you must follow them all. In principle there is a FLOW3 IRC channel (#flow3 on where we can all be found and help answering questions, a mailing list and so on.

hDFLOW3 could start a real hype, in the beginning...

RL: I think so too. I would be very happy too when it starts slowly and then takes off. What we probably could not handle would be a huge hype. Take for example symfony 2, the had last month about 50 committers – I'm not sure if that helps. It's great to have a lot of people, but I wouldn't wish that at the beginning. If necessary we already have the experience with TYPO3 how it works with a lot of developers, if need be it would work.

hDDoes the relationship with TYPO3 have influence on the perception of FLOW3? Does it happen to you that people say, come on, FLOW3 is more TYPO3 stuff, I'm not interested?

RL: Yes, that can happen. That's why I always try to point out that you can use FLOW3 completely independent from TYPO3. It is however, and that is also important, a project from the TYPO3 community. They have made it possible and supported it and therefore it is important to have this relationship. Surely some will believe that it has something to do directly with the TYPO3-CMS.

hDThe other way around FLOW3 can benefit also if users say TYPO3 is well known, so FLOW3 must be a great framework...

RL: Yes, that is also true. I think that without the brand awareness of TYPO3 we would not have been able to have such a long development. Also the attention of the media is of course very different.

hDWhere TYPO3 seems to be known especially in Germany. If you look for example at Drupal...

RL: Yes, although this has changed a bit in the direction of Drupal. Especially regarding Drupal there is actually a lot of hype around it. One cause is certainly the marketing possibilities they have – Acquia has a hand full of paid evangelists, they are present on all conferences ...

hDIf you look at TYPO3 Phoenix do you feel the relation to FLOW3?

RL: You will. And the cool thing is that if you made a small application you can make it into a plugin for the CMS with two, three lines of code. Before, with TYPO3 4 you had to do a lot more. As extension developer you will notice the common relationship anyway.

With the User Interface there is basically the same approach when we say it should be as simple as possible. It is very much inspired by Apple, I have to admit that. If someone wants to add for example a new setting then he/she must first say which two settings must be thrown away in exchange, that is the deal. Because each setting must be maintained by us, it makes it more complex for the user – and that way we try to put this approach in the user interface.

In the context of the user experience we have developed for example 'persona' which enable use to visualize various user roles in a better way, also to see work-flows not from a developers point of view. And that is fun! It is said that developers can't make a design, developers can't market their product – that may be true for many, but it think it's fun to learn. And you can change positions easily. We are also users! (laughs)

hDThe danger with TYPO3 lies among others in the fact that many know the system from really old installations ...

RL: … and those systems are also set up incorrectly with all users as administrator because it makes things possibly simpler. That's why it's very important to supply sensible defaults. Because we know exactly that such users will be too lazy to set up these roles later on.

hDWill it be possible to migrate old TYPO3 installations fairly easy to TYPO3 Phoenix?

RL: Not fairly easy, no. I expect that those migrations will happen when the need is felt to have something new. That is the case with a relaunch or with a new project. We will make it possible to migrate the content, fully automatic, that is not an issue. If you already use Extbase it might be possible to migrate the code automatically. It could work, but someone has to pick up that task. The TypoScript templates can probably not be migrated, but is also the question if that is useful. I think that if complex logic is included in extensions it is much easier to migrate. The cleaner you program the better. But it will not go automatically.

hDAbout the supposed relation to Apple ...

RL: … I have actually recently twittered – Apple has inspired me a lot. I am perhaps also a bit of an Apple fan boy. But I find it remarkable that they always manage to reduce things and still offer functionality. That's why throwing away and reducing things has a high esteem. If someone says: “Hey, I have removed a lot of code again!” - that will be celebrated.

hDYou like to see that dirty code is removed.

RL: It's also said, developers should not be paid for how much code they write, but for how much they throw away.

hDSince when are you involved in FLOW3?

RL: It began properly back in 2006 and since 2007 Karsten Dambekalns and I have worked full time on it. So an insane amount of time has gone into it and you recognize that, I think. I hope.

And as I said, we enjoy the whole schmear and the people involved had a lot of fun – we are really excited to finally be able to actually use the system. It's very nice that we achieved that.