Visualizing the PHP grammar

A few weeks ago an e-mail from Didier Garcin popped up on the Stratego mailing list. He explained that he had written a python script that could visualize an abstract syntax signature. The script was also send to the list and I finally had some time to check it out.

It turned out that I had almost anything installed to use the script, only the pydot dependency needed some work. This was mostly because the script only seems to work with the 0.9.10 version of this library. After getting the script started it was really simple to generate the signature from the PHP-Front grammar.

So, here is the one for PHP4:
PHP4 AST visualization
And the one for PHP5:
PHP5 AST visualization

The first thing I notices where the big rectangles in both versions. These rectangles are the statements (smaller one) and expressions grouped together. What I also notices was that in both versions we see that the bottom of the graph (which corresponds with the smallest units in the language) looks the most complicated. This corresponds very well with the amount of effort put into the modeling of this part of the language.

Comparing both grammars to each other we can see that the latest versions is the most complicated one. Furthermore, if we compare both graphs to the graphs shown in this post we can see that the Java-graph appears to be the most similar one.

Actually, I do not think these images show anything, but please explain it to me when you think I just don't see it. Anyway, at least we have some nice pictures now :)

P.S. for those who are interested, more detailed images (in svg-format) are available here.

Shameless plug

Instead of writing about the new and interesting stuff I am currently researching (mostly because the results still need to be processed a bit) I am only going to mention my the link to my new home on the web:

http://Eric.Bouwers.info


Now I only have to figure out how to get this blog into the same style ...

Another JFall

Today I attended the JFall 2008. Another instance of the conference of the NL-JUG aimed at all the Java programmers in Holland. Since two of my colleagues got the last two tickets I had the pleasure of walking to the location with only one of them, the other one missed his train.

Anyhow, let us see what the day has given us.

Duane Nickull was the first speaker of the day. He shared his view on what web2.0 and SOA was. We saw many slides (with many boxes and arrows) explaining which entities play a role in these types of technologies. Unfortunately, his presentation was a little abstract, because I didn't notice any concrete examples (maybe I missed them though). On the other hand, his anecdotes were nice and interesting. The one that I liked the most was about a company that is trying to apply the open-source software development way of contributions to the making of movies. Deciding what is in a movie sure sounds fun to me, so there should be some kind of business model in there right?

The second talk I attended was given by Allister Smith and was titled "pragmatic Java". Hoping on a presentation full of pragmatic solutions for common problems, I was a bit disappointed when the talk compared Java to languages such as Phyton and PHP. An example program was given in Python and then redone in Java using the spring-framework. Naturally, the Java example was much more bloated. After this, an example of a Java implementation was given in which the typing was essentially stripped away (by using only Objects) and value-passing was done through Maps and Lists. The speaker had a good point in the sense that this can be just as quick and short as a scripting language, but using Java for this just feels wrong. It is an example of using a language because of the language, not because it has the features you need for a project.

The last talk before the lunch was an introduction to the Java Memory Model. Peter Veentjer (who seems to know a lot about these things) gave a nice tour around some of the pitfalls of Java concurrency. Although the talk was a little low level, it was really understandable. I do not have to deal with concurrency at the moment, but some of the pointers are good to keep in the back of your mind during development. Certainly a useful presentation.

Right after the lunch the evangelists of Sun gave the second keynote of the day. Normally I do not really like these kind of talks because they can feel like you are watching a long tv-commercial without seeing something useful. However, I was pleasantly surprised that the demo's showed some really nice stuff (besides being slick of course). It turns out that in the new version of JavaFX it is possible to drag applets from your browser to your desktop and still work! There must be some real-world usage scenario's for that I guess. Also, a demo was given of alternative ways to use your Wii-mote. Definitely a better talk then I had expected.

After the demo I was quick enough to sneak into the presentation of Huub van Thienen about closures in Java. I was lucky to have a seat because the room was really packed with people. Huub gave a really nice introduction into what closures are, and how they could be used in Java. His presentation showed the pros and cons without giving away his own opinion. Actually, he even promised a candy-bar for the person that could guess his opinion about the subject. I still do not know :(. Even though I knew most of the thing already (because of knowing Haskell), I think this was the best presentation of today.

As a last presentation I attended a Hands-on-lab about dealing with legacy code. Since we are usually analyzing legacy code for customers, I thought it would be nice to hear other peoples opinions about the subject. The set-up of the lab was really nice, first some explanation, then some coding, some more explanation and so on. Unfortunately, we ran out of time in the end, but it was still a nice experience. I also relearned one of my pitfalls during the session. When trying to fix a bug I tend to first figure out how to fix a problem, than actually fix it, and later on write a test for it. Usually, I also try to run the test without the fix to see whether it fails, but sometimes I forget. To counter this I should first write a test, and then fix the problem. However, sometimes it is too tempting to just fix the problem :)

All and all it was an interesting day. No real eye-openers, but certainly not a complete waste of time. On to the JSpring I would say!

Focussing on the problem

After a solid month of being a part-time PhD I have gotten many tips (and comments) on kick-starting my project and doing research in general. Currently, my goal is getting a clear picture of the problem that I want to solve. I know that there is a problem (and I have a vague notion about how to describe it) but getting a clear definition is not something that comes easily.

On the other hand I am not afraid of spending time on finding the problem. When the problem is clear it is usually easy to think of scenario's that can solve it (although actually executing these scenario's might be tricky).

And focusing on getting the problem straight is also not bad for presentation purposes. Several of my colleagues (and other people as well) explained to me that during a presentation it is very important to explain the problem that you solve. Also, and this is something that I usually forget to think about, it is important to explain in which cases your solution is not going to work.

It does not matter that this might take up a big chunk of your time because most people probably do not (completely) understand your solution anyway. As long as they know which problem you have solved under which conditions, they are going to be happy. More details about how the solution works can always be read in a paper, or discussed over some beverages.

So, back to the literature study it is! By the way, if anybody has a nice suggestion to keep track of interesting research papers online, please let me know!

Finish what you start ....

When I was young, my mother used to tell me that I should first finish what I started before moving to something new. I think this was mostly because in order to finish something I had to clean up the mess I made, but it's not a really bad rule to keep in mind I guess. However, even though I should first finish all my other projects before moving on, I picked up another project last week: getting a PhD.

Yep, as of the first of October my boss allows me to spend two days a week on doing research. This research is going to be (how surprisingly) in the field of static analysis and software quality. Our first research-topic is already starting to shape itself and I believe (how surprisingly) that it is going to lead to interesting results.

It might be nice to perform research, but in order to get a PhD you cannot get far without 1) good focus and 2) good supervisors. Luckily, I have a team of two supervisors that can certainly keep me focused: Joost Visser and Arie van Deursen.

In order to keep everybody up-to-date with the progress of the research, and to spend a little time in a more research-oriented environment, I will be traveling to Delft once a week. While last week was mostly filled with arranging a workspace, this week is going to be filled with giving a talk at the Research Colloquium. So if you have not heard my Fluent Interfaces talk yet, this is probably your last chance :)

A Java-Summercamp

It has been a while , but on the 29th of August I have attended the 2008 version of the Java Summercamp. This gathering was organized by profict, a dutch IT-company. They have an office with a great view (picture), now that is what I call a green working environment!

The topic of this day was Domain Specific Languages (DSL's). Since my talk about fluent interfaces at the J-Spring 2008 I became more and more interested in this topic. I hoped to hear more about why you would want to use a DSL, and see some examples of DSL's in practice. Luckily, I got what I wanted.

The first speaker was Neal Ford. His first presentation (slides) gave a general overview of the usefulness of DSL's. He argued that Java can be seen as a framework-oriented language. Nowadays, a Java-programmer uses many frameworks which he ties together with configuration-files written in XML. He proposes to use a DSL to abstract over these large configuration files in order to make it easier to tie frameworks together. He also gave an overview of some techniques to implement (mostly internal) DSL's. Actually, his second presentation mostly consisted of examples of DSL's in various languages. It is always fun to see examples of what you can do in other languages.

Sven Efftinge was the second speaker with his presentation (slides) about XText. I was surprised to see that it actually looked very simple to 1) create a DSL by typing in EBNF 2) generate an eclipse editor for this DSL with the click of a button and 3) generate a generator for your DSL using the same click. Naturally, everything was already set-up so that it looked easier then it actually is. I have tried to make a small example to show at the office, but failed miserably to get the generator to do what I want. Anyhow, if you have a spare afternoon then checking out this project is certainly worth the effort.

The third (and last) speaker was Zef Hemel. His presentation (slides) about WebDsl gave a nice overview of the setup and current status of the project. I was already a bit familiar with the project and it was fun to get an update. Also, I enjoy seeing the face of people that are confronted with Stratego for the first time :)

All and all I can say that it certainly an afternoon well spent.

Is he back?

It has been eight months since my last post to this blog. Also, the release plan did not work out as well as I had hoped. So what did I do in the intermediate months?

Well, I ended last year by buying me a 'real' house instead of renting an apartment. For us it is pretty large, currently even the cats have an own room, but this will probably change over time. Buying a house really helps you to spend your time since there is all sorts of paperwork to fill out, people to inform and things to pack. We moved in at the end of March and I think that we are currently at the point that every company we deal with knows that we had a change of address. The next objective is to unpack and store away everything that we moved. There are still some (closed) boxes standing around here and there.

During the time that we where preparing to move to our new house my (at that time) girlfriend and I where also organizing a very important event: our wedding. That is right, on April the 26th we got married! It was a wonderful day in which we did the things that we enjoy together with our friends and family. We got married, went to a movie and had a party at the home of our Scouts. Maybe not the most traditional wedding ever, but certainly one that we enjoyed!

Even during the buying of a house and the planning of a wedding one must keep on working, so I did. I learned a lot about how to do agile programming, how one can quantify the quality of software and how to be (even more) pragmatic.
Apart from the 'normal' work, me and one of my colleagues wrote a paper called Multidimensional Software Monitoring Applied to ERP. This paper is accepted at the SQM 2008. It was very nice to attend a conference as the author of a paper, certainly when the conference is held in Athens :)
Next to this paper, I also gave a talk at the J-Spring 2008, This talk, titled Putting Fluent Interfaces to the test, was about designing and using a Fluent Interface. If you are not familiar with this style of API-design be sure to follow the link.

So I bought a house, got married and enjoy the work that I do. I guess you van say I am really settling into society ;)

Unfortunately, this settling in has taken so much energy from me that I did not find the time to work on PHP-Sat. However, since I have found the time and energy to write this post, I should also be able to find some for the PHP-Sat-project again!