Jun 28

I’m a pure product of the Object-Oriented Programming generation. I’ve experimented several different paradigms when I was in engineering school, including formal programming in B, functional programming in OCaml, logical programming with PROLOG and Eclipse (the programming language, not the IDE). But when I started writing software in high school, it was with TurboPascal and then Delphi. And the main language I’ve been using during my studies was Java.

During all that time, I essentially worked on relatively simple problematics, and my end-of-study project was the first one where I started to look for better ways to handle a more complex environment, namely web applications and web services. The revelation came from AndroMDA, an Open-Source Model-Driven Architecture framework that has been my main specialty and domain of research during the past three years or so. As a professional IT consultant, I’ve used it and promoted it on at least 3 customer projects with rather great success.

But today, I think this time is over. I’ll move on to the next step, my next toy. And if you’ve read my previous entry about the limitations of OOP and its comments, you might guess what it is. I was looking for a better way to tackle today’s software issues and go further in my philosophical goal to make technology useful, and I found it. It’s called Language-Oriented Programming.

If you want to know more about it and wonder why I moved onto this so quickly, here are the articles that hit me as another revelation during the past couple of days:

Now I think I’ll have a much closer look at the practical side of things:

All of my personal projects, including MobiMap, will certainly benefit from this new enlightenment. And I sincerely hope that my day-to-day job will give me the opportunity to work with those concepts…

Jun 22

As far as I can tell, there has been 3 major “revolutions” in software development since it all started:

  1. From binary to assembly language
  2. From assembly language to procedural languages
  3. From procedural languages to Object-Oriented Programming

Of course I’m not even talking about marginal evolutions like functional programming, scripting or formal programming.

And behind a revolution, there’s always a massive “there’s gotta be a better way” feeling. For assembly language people probably thought, “since we’re working with registers and memory addresses and instructions, let’s have readable forms of these concepts rather than just hexadecimal code, obviously we’re going to be more productive”. And then it was probably the same with procedural vs. OOP: Objects, classes, fields and methods were just closer to the kind concepts we were manipulating at some point and we couldn’t just keep tinkering with old paradigms, even on steroids (read structures and things like that).

Now I’m starting to wonder whether we’ve not come to the same point with OOP. At least I have come to this point myself. Objects, packages, components, whatever the granularity I’m still stuck having to tinker with old stuff to realize higher level tasks at some point. Most of the time, I’m not thinking about adding a field or a method in an object, but instead I want to add a property to an entity in my domain, or expose a business operation via a webservice. That’s the kind of tasks that make my day-to-day work. And still, let’s say I want to add a property to an entity in my domain, then I have to add the corresponding field in a class, write a getter and a setter, update the DDL script for the database, add the mapping to the Hibernate mapping file, add a validation directive somewhere… there’s gotta be a better way.

Now I realize that’s the main reason I love AndroMDA so much: because I can do high-level modifications in my UML models and boom! The generator just takes it over from there and updates the code almost everywhere it needs to be, which improves my productivity by a tremendous factor. Others use other tricks for the very same purpose: some use annotations, others turn to active record implementations. But whatever the trick, I feel more and more like it’s a dead-end, like… there’s gotta be a better way.

The closer the tools I’m using are to the concepts I manipulate, the less work I have to do to implement those concepts, the better it is for the whole project:

  • it reduces the probability for errors
  • it improves time-to-market
  • it frees up some time to focus on the real business at hand
  • it gives me a better sense of achievement
  • it dramatically improves return on investment since basically you’re doing more with less

Tonight I had a very interesting conversation with a very smart guy from the AndroMDA team, and it just appeared to me like magic: AndroMDA is just one way to cope with limitations of the underlying object-oriented paradigms, and we have to start thinking about how we can reach the same goals, but in a more native way. We need a brand new paradigm, a new way to build software closer to what we try to achieve everyday at a higher level.

What do you guys think? Have you heard of anything like that? Because I would be really interested in knowing about it. Otherwise, does anyone have any idea about what could be this new paradigm? And do you feel we need it? I’m really interested in your feedback on that one.

Mar 10

It’s always amazing to see how people find it hard to compromise, to nuance their opinions about things. And I’m probably the first one finding it hard. But when it comes to software practices, boy it’s annoying.

I was talking to a colleague of mine the other day, we were talking about unit testing and other best practices, and I boldly and shamelessly said to him: “I haven’t written any unit test on this project.” He stared at me with a bit of surprise, then with a bit of disappointment and finally with a bit of something like… disgust!

“What!? No tests, but why? How can you pretend to be a software architect if you don’t practice systematic unit testing?! Oh my god!…”

My first reaction was a furious urge to hit him in the face. But then I remembered myself a few years back, and I did nothing but leave him in his panic state and disappointment.

When I started working as a consultant, I had already written a few applications in engineering school, but strangely enough they didn’t really talked to us about software quality, agile methodologies and other modern best practices. We did formal programming, Prolog, we reprogrammed a memory management unit and wrote a compiler for a subset of the Java language, but nothing useful ;o).So when I discovered that some people were actually doing things in a rational way, to write better software, I was at the same time impressed and overwhelmed by all of that. Design patterns, continuous integration, test-driven development… I had never seen those in the real world, but I read a lot of books and websites and it seemed so nice that I came to think that it was the only way. And of course I was wrong.Fortunately, I started working on real-world projects, dealing with all sorts of external constraints. And no matter how hard I tried to impose “my” great software best practices, everybody looked at me like an alien because they just didn’t understand why I was talking about all this stuff. So when I was fed up with complaining about no one understanding what should be done, I realized that they were at least right to wonder. Why are things like TDD, CI or Design Patterns so important?

When you read so many articles explaining to you how to write unit tests, they all seem to assume that unit-testing is good in itself, as if it was some kind of axiom. But the truth is that no matter how good they are, writing them and maintaining them is a real pain, right? Lesson learned: when something is painful but good for you, there’s gotta be a better way. But a better way to what?

Because for me that’s the real problem: losing sight of the objective. Unit-testing and TDD are not good in themselves, they are just one best practice which allows you to improve the overall quality and robustness of your code. Why so? Because when you write your tests before the corresponding functional code, you considerably reduce the probability of a bug in the functional code. And robustness comes from the fact that whenever the implementation of a given functionality is modified over time, unit tests are there to ensure that the overall result will remain the same. Fine! But how about a better way?

First, let’s talk about reducing the probability of bugs. The main problem with code is that it’s written by us, human beings. And like it or not, we are faillible, we make mistakes, and the more we think we don’t, the more we actually do. Now rather than testing everything that we write, isn’t there a way to reduce the amount of code that we have to write? I can tell you that: there is a way!

I already see my colleague smiling if he reads this, because I’m so obsessive about this “way” that it becomes ridiculous. Take care, here comes the dirty words: code generation. Of course I’m not talking about the kind of code generation that just displaces the problem elsewhere, that is in diagrams that are the ont-to-one mapping of your code. I’m talking of a higher level of code generation, I’m talking of Model-Driven Architecture.

I know that many programmers don’t like it, have read many articles about and introductions to MDA without ever going further, mostly because programmers like to… program, not draw. And I can understand that. And if you’re in that situation, then you’re stuck with test-driven development… or any other “way” you can find. But if you like to have a better view of the big picture, if you want to accelerate your development and increase the robustness and quality of your code, then have a look at this (my favourite), this and this. You might be surprised.

Will it completely replace unit tests? I don’t think so, but it can create a situation in which you have so dramatically reduced the amount of code to test, that it can be interesting to wonder whether it’s still worth the effort.

My main point is, software best practices are nothing without the goal they allow you to reach, and forgetting that is the best way to stop looking for better ways, to stop innovation and progress.

Dec 12

I gave a quickie at Javapolis today about AndroMDA. It was a first for me, and boy it was hard! My goal with this presentation was to act as a counterbalance to last year’s scripting language hype, to show that yes, you CAN be productive with traditional Java frameworks. It’s just a matter of tools and methodology.

And because I wanted to demonstrate that, I actually challenged myself into developing a full-blown JSF/Spring/Hibernate application in front of the audience in just 15 minutes. And I must admit that I had my eyes bigger than my stomach on this one. I’ve repeated my demo something like ten times, and I only managed to do it once in less than 15 minutes. So that one was risky. And as a matter of fact, I made just a small mistake in my modeling that actually led me to fail showing my running application.

But just for the sake of precision, and in case you need to see it working, I’ve actually attached the final application to this post: TodoList sample application. And here is what you need to do to build it:

  • You have to install Java 5, Maven 2.0.7 (I’ve not tested it with Maven 2.0.8), MySQL 5, JBoss 4.0.5 GA
  • Download mysql-connector-java-bin-5.1.5.jar and copy it to server/default/lib subdirectory of your JBoss installation
  • Set JAVA_HOME, JBOSS_HOME and M2_HOME environment variables accordingly
  • Create a database called ‘todolist’, and allow a user named ‘todolist’ with a password as ‘todolist’ to do everything on this database
  • Run the following commands in the unzipped directory:
mvn -f core/pom.xml andromdapp:schema -Dtasks=create
mvn install -Ddeploy

Please let me know if you have any issue or question related to this sample project. Comments are here for that.

And I’ll probably use this sample application as a starting point for a more complete learning thread so stay tuned.

And by the way, if you need more information about AndroMDA itself, please refer to their official website. The AndroMDA forum is very active as well, and if you can’t wait to get started, you will definitely love the official Getting Started Guide, which exists in Java and .Net versions.

Dec 09

We’re saturday and I just finished to prepare the code for my quickie about AndroMDA. Hopefully I’ll be able to make it in 15 minutes. I make it a personal challenge.

Of course, the code will be published here after the presentation, but that’s not all. Now that the code is ready, I intend to prepare a small screencast, not limited to 15 minutes, so with more time to actually explain what’s going on behind the scenes.

But there’s even more. I think I’m going to use this demo application as a starting point for a whole training thread in videos, maybe even a video podcast, and I hope it’s gonna help people get started with the tool in real life.

See you guys on wednesday!

Oct 31

That’s official: my AndroMDA Quickie proposal has been accepted and I’ll be giving a 15-minute demonstration of AndroMDA power on Wednesday, December 12th. That’s really great! Now I’ll just have to figure out the best possible way to make my point. For now, my objective is to realize some sort of todo-list demonstration in just 15 minutes. That’s short but I think that’s the only way I can get people to understand that scripting languages are not the only way to be productive with Java.

Now I still need to further test AndroMDA 4 to see if it’s ready for such a demonstration.

Anyway, if you’re curious about MDA in general and AndroMDA in particular, feel free to come by and ask plenty of embarrassing questions.

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported