22 Dec 2004

Rule engine

Really interesting James Ross'post
...this one uses a business rule engine (drools) to allow you to declare in a text file your idea of good taste and enforce it for your code base.
There's also macker that seems to do the same.
Currently I haven't test any of them... but that might be a solution go produce great code not just good code.

21 Dec 2004

XUL Amazon sample application

You can find a sample application of xul apply to amazon on this site. (need mozilla or firefox)
I've tried xul once but I put it aside because:
  • the xul documentation wasn't clear (and not always up-to-date)
  • It seems to me it use a lot of javascript (and I don't like javascript that much)
But this example makes me want to give it an other try...

17 Dec 2004

XP Quote

If members of a team don't care about each other and what they are doing, XP won't work.
If members of a team don't care about a project, nothing can save it.
-- Kent Beck

15 Dec 2004

Scrum overview

Since I like XP I wanted to know other agile process.
I found this short summary of scrum.
Good introduction at least for a beginning ;-)

Google suggest beta

Nice new feature at Google (still in beta but it will certainly go to mainstream)

14 Dec 2004

PicoContainer Birth

Nice story about Pico birth.

Anti-Productivity Pod

Nice post about anti-productivity at work.

It's true you often get things done early in the morning or late in the evening.
The rest of the day you get interrupted by many things (phone, icq, mail, meetings, people dropping by...)
But if you want communication amongst people, interruption is certainly an inevitable drawback.

To avoid such things I see some solutions:
  • If someone drops by, evaluate if it's urgent, if not finish your current task and go find that person afterward
  • When I want to concentrate to get something done, I sometimes turn off Outlook...
  • Meetings should mainly be standup meetings
  • Try to organize your tasks with priorities and stick to them (not always easy)

8 Dec 2004

C++ IoC explanation

For those (still) using C++ ... joking ;-)
http://www.objectmentor.com/resources/articles/dip.pdf
A pattern that might change your life!

7 Dec 2004

Ward Cunningham on TheServerSide.NET

I didn't know microsoft hired him...

Few quotes I found interesting:
I do know that a lot of times if the programmer gets good, while he is getting good, he learns that most people do not understand what he does. So that's really separating for programmers. Programmers are kind of driven apart by that realization that they are dealing with things that most people do not understand, and after a while they give up trying to communicate.
I often find it hard, even among developpers, to communicate and understand each others. Unfortunatly I don't think computers are the only place where people find it hard to exchange ideas...

Architecture design is so important we have to do it all the time. There is a little resistance to doing it before we're sure what to design, especially producing what is called the big design up front where you write a document and then someone tries to hold you to that design; "We don't care if you made a mistake, we want you do what you said." That is foolishness, but there is no resistance to thinking.
There is resistance to "if I have kind of an idea how this is going to go and you have kind of an idea how this is going to go, instead of having the argument today let us just to do the part we need to do today, that [part] we agree on and we will wait tomorrow to see what we have to do [then]. If we need to have an argument tomorrow, it will be about tomorrow's stuff.
Good wisdom ;-)

Full Interview: http://www.theserverside.net/talks/index.tss

29 Nov 2004

Anemic Domain Model

I often read blogs pointing to the Martin Fowlers'Anemic Domain Model.
Personnaly, I've gone through 3 steps:
  1. layer mixing (where presentation/domain/database etc...) is mixed.
  2. then "overlayering" creating unecessary layers just to split things(concerns) but ending coping values from one object/layer to an other without doing anything more and having multiple objects with no behavior.
  3. refactoring this "overlayering" model to a minimum subset of classes and hading behavior.
The ideal thing (in my humble opinion) would be to use domain model (with behavior not only get/set) even in the view part of the MVC if there are no futher actions to take between view and domain. And concentrate every domain classes representing simple entities (Address, DrivingLicense ...) in one/few packages.
The problem with this approach is to prevent other people (just as myself 4 years ago) to put things in the domain objects where they do not belong.

Geek attitude

You are becomming a geek:

HTML Code Formater

If you always forget what html code is for "greater than" ;-) , here's some usefull tool.

25 Nov 2004

Student Syndrome

Since I've been a student, I feel concern about the Student Syndrome.
I hope I don't procrastinate to much those days ;-)

24 Nov 2004

XP Fun

Yes XP can be fun (hum... may be for a geek:p)... HowToPissOffYourPair

22 Nov 2004

Simulation enthusiasm

I sometimes take a trip to the game developpement world through Gamasutra web site.
Which is, by the way, an excellent site. (you should create an account...)
I've read 2 articles.
The first one The Perils of Bottom-up Game Design:
If you're a software engineer, your natural temptation is to figure out how to program it(simulation) and see how it works. What are the core mechanics of the simulation?
(...)
Bottom-up game design is based on an assumption that any process that is subtle or interesting to program is also going to be interesting to play with. That doesn't necessarily follow. For years I was intrigued by the challenge of programming a traffic simulation. (...) I had gotten all excited about the software engineering problems and ignored the fact that it needed to be enjoyable.
(...)
the temptation to "improve" your software with one more feature, and then one more still, just because you can. In consumer software, the result is usually a bloated, awkward mess like Microsoft Office.
I feel guilty about those unnecessary features. Today I try to stick to those 2 rules:
  • Don't had features the user didn't ask fo even if you find them "cool".
  • Don't create a "'big realistic system" if it can be done simply (but not realistic who cares if the user is happy with it!).
The second article: A Software Process for Online Game Tools Development is discribing an XP development process without knowing it, it seems game development and entreprise development are in two parallele univers that don't communicate... too bad!



Josh Bloch on Design

Excellent article (a bit old 2002), I don't agree with everything, especialy final keyword and the use of inheritance(blog) but still interesting to read.

17 Nov 2004

16 Nov 2004

The Blind Men and the Elephant

Yesterday I was reading posts on "extends is evil".
I've often heard that opinion but I was wondering why?!
And actually seeing all the comments these kind of issues rises:
I clearly understand that it's not that easy!
Some people fell confortable with inheritance using extends.
Personnaly I sometime use extends. But usualy it gets more and more complicate to maintain over time/adding features (even with JUnit).
So I don't like extends (using super()) that much...

But all those debats about extends/implements, jsf (yes/no) etc... are interesting but often leads nowhere since everybody come and leaves with his idea.
Just like The Blind Men and the Elephant
Moral:
So oft in theologic wars,
The disputants, I ween,
Rail on in utter ignorance
Of what each other mean,
And prate about an Elephant
Not one of them has seen!

15 Nov 2004

The problem with IoC

Forget to inject your dependancy in "application" code.
I've run across this problem at least 3 or 4 times since I've started to use JUnit (and therefore IoC).
Let's say I made this test:

public class ExampleTest extends TestCase {
public void testMyMethod() {
Example myExample = new Example();
myExample.setDataSource(mockDataSource);
boolean isOk = myExample.myMethod();
assertTrue(isOk);
}
}
Everything find, green bar!
My application code (where it's really use):

Example myExample = new Example();
// oups! I did it again! forgot this line:
// myExample.setDataSource(realDataSource);
boolean isOk = myExample.myMethod();
I usualy get a NullPointer, using stack trace one can easily find the problem but can I avoid it?
One way to avoid is to inject a default dehavior like this:
public class Exemple {
private DataSource dataSource;
public boolean myMethod() {
getDataSource().getConnection();
// ...
}
public DataSource getDataSource() {
if (dataSource == null) {
dataSource = new RealDataSource();
}
return dataSource;
}
}
I don't like this solution because using eclipse wizard to create getter/setter methods, I can (and I already have) forget to modify the getDataSource like above and also I can use directly the instance: dataSource.

An other solution could be to assemble the different parts of the object in an AssemblyObject of some kind and create a JUnit that assert that none of the attributes a null... but I'm not sure how to do this and still run my tests without the cointainer ?! (for exemple if RealDataSource use JNDI tree to locate dataSource)

Anyone already solved this problem?

10 Nov 2004

Be Humble

Interesting post about being a humble developper: Why I'm the best programmer in the world

When interviewing candidates for programming positions, I always look for someone who is brave enough to say "I don't know" when they need to. Candidates who can't or won't do this get red flagged; those types of programmers are dangerous.
Unfortunalty, during interviews, IT manager doesn't always behave like this and take a "I don't know" answer for a lake of skill or knowledge...

In the same blog, the fear of breaking the code, in my opinion, is not only a sign of problems with developpers but also a sign of (no/not enough/not usefull) testing.
It can also be a sign that the manager doesn't understand that quality of existing features is more important vs getting knew features and doesn't give enough time to the team to refactor.
The refactoring mindset should be taught during university courses.

update: about Hiring Technical people

8 Nov 2004

Does it smell ?!

Excellent set of blog about:

Test suite smell:
Suite takes too long to run
(...) These tests are more often than not integration/system tests (...)
When I first started to use JUnit, I did it to help me get a piece of code work. This set of classes where too complicated, unforunatly I couldn't isolate this from the rest of the system and my tests became integration tests that took too long and do not even cover 10% of the tests.
Since then I've learn from my mistakes and I've mocked up some parts to get holy isolation.

But mock aren't always the answer...
Over reliance on mock testing
(...) the usage of mock/stub to stand in for real implementations is that the standins do perform in a fashion largely identical to the real thing. If this is not the case (...) then reality will tend to remind you of this mistmatch (...)
Exemple: A classe need a file, but you can't rely on the file to be in the file system when you run the test, then you mock it up.
The MockInputStream need to behave like a normal InputStream otherwise your test can get a green bar and never work with a real file...

25 Oct 2004

Is inheritance a good way to refactor?

This blog entry has a point about inheritance.
I sometimes use inheritance to refactor methods that are copy/paste in objects.
I often end up with Bar1 and Bar2 extends FooAbstract.
With method: Fish FooAbstract.fishing().

But how do I test fishing() method?

Not in FooAbstractTest since Foo is abstract...
I often put tests in Bar1 but if Bar2 changes the default behavior, I won't get a red bar!
Also I can refactor tests in a FooAbstractTest extends TestCase and make
Bar1 et Bar2 extends FooTestAbstract (but I don't like that much...)

I have to think about this a little bit more....
I may give up inheritance to refactor and use delegation instead...

Keep your old lava lamps

A way for the team (even in remote location) to know about the build status of your continuous builds.

22 Oct 2004

More than just architecture

I found some good points in this interview from Rick Cattell.

Q: If you knew everything then that you know now, what different choices might you have made in your career?

A: (...)I didn't realize how important it was, (...), to work on things that people are actually going to use.(...) if you want to see your ideas used in the real world, you have to think about more than just the engineering.
When talking to normal people, I feel like some crazy scientist no one understands.
Talking about IoC, Ejb etc... is good but the main goal in this job is to deliver something usefull and works (even if it's badly coded, but unit tests help getting that right later)

An other problem (I see this as a really big issue), is engineers knowing best what is good for users more than users themselves...
I mean the only way to tell if a software is really good is to make usability tests whith users and make everyone (developpers included) see the tests ans tests results.
For exemples of technics to achieve usability tests you can refer to Jakob Nielsen's web site.

20 Oct 2004

J2SE 5.0 Name and Version Change

The Sun explanation of the new Java products'naming.
  • No more 1.5.0 forget the leading "1." now it's 5.0
  • Forget the 2 in J2SDK now it's simply JSDK and J2RE becomes JRE.
  • But It seems JEE did not replace J2EE, nor J2SE...

No static author tag in javadoc

These days, I finding the author tag in javadoc more and more useless...
What the point in finding:
@author someoneWhoWorkedOnlyFewMonthOnTheProject3YearsAgo
Using Cvs features like $Author$ tag, is far more usefull since it replaces the personne name with the one you use for cvs's commit.

Also using @author staticMysteryMan is in total contradiction with XP rule:
Collective Code Ownership,
since people tends to say "It's not mine look it's staticMysteryMan who made it" even if staticMysteryMan only created it 3 years ago and every one in the team refactored it since then...

Action Item

Just to relax... reading comics about entreprise might be a strange way to relax, should consider taking vacation someday ;-)

14 Oct 2004

Integrate often (cvs branch)

Even if I already new that often (or continuous) integration is the key to achieve a zen developper attitude.
I recently descovered that merging branchs in cvs has to be run often to reduce any conflict nigthmare in cvs.
Someone (or better everyone in the team) should make an intermediate-merge during the life time of the branch.
If you don't do that, the branch'team will work on "out of date" sources with bugs that had been corrected on the HEAD chunk long time ago.
The longer you wait for an inter-merge the more you get conflicts and that's not what you want!

13 Oct 2004

RiA Listing at last

At last, I found a listing of the main RiA (Rich Internet Applications) solutions:
http://leepoint.net/notes-java/30GUI/95misc/80gui-generator.html

This server side article is also interesting.
My short list (main challengers) for RiA at the moment is:
  • JDNC and web start (Sun)
  • AUIML (IBM)
  • Xul (Mozilla)
  • Xalm (Microsoft)
My opinion is not clear on JSF since I not sure there is any (really working) implementation execpt in html.

12 Oct 2004

Database refactoring

I recently studied a database refactoring:

Before refactoring we had a user table like this:
User
UserId(PK) | FisrtName | LastName | LastConnexion | Login | Password
The evolution: 1 user can now have multiple login/password (let's say one login for the official site and one for the administration site)
So the logical database scheme evolution would be:

User
UserId(PK) | FisrtName | LastName
Login
UserId(FK) | Admin(boolean) | LastConnexion | Login | Password
with Login table PK is (UserId + Admin)

So now we have:
User (1 to many) Login

If we focus on the 4 basic sql queries: INSERT, UPDATE, SELECT, DELETE
Before evolution:

INSERT INTO User(UserId, FisrtName, LastName, LastConnexion, Login, Password)
VALUES (value1, value2,....);
UPDATE User
SET LastConnexion = new_value
WHERE UserId = some_value;
SELECT UserId, FisrtName, LastName
FROM User
WHERE Login = some_value;
DELETE FROM User
WHERE UserId = some_value;
If we do the "classical" refactoring we need to modify the existing sql queries (modification are in bold/italic):
INSERT INTO User(UserId, FisrtName, LastName)
VALUES (value1, value2,....);
INSERT INTO User(UserId, Admin, LastConnexion, Login, Password)
VALUES (value1, 0, value2,....);
UPDATE Login
SET LastConnexion = new_value
WHERE UserId = some_value;
SELECT UserId, FisrtName, LastName
FROM User, Login
WHERE Login = some_value
AND User.UserId = Login.UserId
AND Admin = 0;
DELETE FROM Login
WHERE UserId = some_value
AND Admin = 0;
DELETE FROM Login
WHERE UserId = some_value
AND Admin = 1;
DELETE FROM User
WHERE UserId = some_value;
We can see that this modification create many changes in code.

Alternative solution:
Replace User Table by a User View with (almost the same data)
DELETE User Table (save data before)
CREATE TABLE NewUser
NewUser
UserId(PK) | Admin(PK) | FisrtName | LastName | LastConnexion | Login | Password
CREATE VIEW User
AS
SELECT (UserId, Admin, FisrtName, LastName, LastConnexion, Login, Password) FROM NewUser
WHERE Admin = 0;
INSERT INTO User(UserId, Admin, FisrtName, LastName, LastConnexion, Login, Password)
VALUES (value1, 0, value2,....);
UPDATE User
SET LastConnexion = new_value
WHERE UserId = some_value;
SELECT UserId, FisrtName, LastName
FROM User
WHERE Login = some_value;
DELETE FROM User
WHERE UserId = some_value
AND Admin = 0; (not sure you need this)
You can see that modifications are reduce in code.
BUT the drawbacks of this technic is that FisrtName and LastName are repeated unnecessarily which can lead to invalid data.

You need to balance time to change code vs (database space lost + risk of invalid data)

Additionnal informations: one good place to start is here: http://www.agiledata.org/

27 Sept 2004

Rich Client Technologies

Still trying to find my way into the Rich client technologies, I just read those articles (in french):

So fo me the main concurrent are:

  • Linux Desktop
  • SuSE Desktop
  • Desktop System (JDS)
  • xalm (Longhorn)
  • WCTRE
  • XUL de Mozilla
  • Flex de Macromedia
  • Acrobat Reader
  • Java:
    • SwiXML,
    • Thinlet,
    • SwingML,
    • JellySwing,
    • AUIML,
    • xmlgui,
    • Speed GJ,
    • xWidglets,
    • Ultrid,
    • Altio
    • Jndc

Now wich one do you choose ?! (take a bet...)

22 Sept 2004

Craig McClanahan Presentation

I went to a presentation of Sun Java Studio Creator and JSF.
Nice demo. I hadn't tested Creator yet.
It's based on Netbeans and jsp, it take full use of them. (If you don't want to use jsf, not the right tool)
I already had a demo of Visual Studio and asp.net.
Sun created the equivalent of VS for Rapid developpement

It's a nice tool:
  • start quickly J2EE developpement
  • minimum requirement for the team
  • develop J2EE webapp more like VB applications
  • doesn't depend on Sun server (even if it's tightly coupled with creator)
  • help newbies by providing places where they can put code without thinking to much
but with some restrictions:
  • not enought thrid part products integration (they are working on it...)
  • Sun make many choices for you (just has Microsoft do with VS)
    • jsf
    • 1 to 1 relation between a page and a bean representing the page
    • validation process
  • help you (to much) to copy/paste components (instead of making a service locator for example)
  • doesn't prevent bad coding...
I would clearly consider Creator for small, rapid developpement project but eclipse is still my favorite IDE because of the plugin comunity.
But for a team of java newbies or corporate developpers that would clearly help to get started.
But once you've started with jsf, I will be hard to abandon it...

blog entry of craig presentation
An other vision of this presentation by sami Jabber - dotnetguru (I don't agree with him but I don't want to flame his blog ;))
A better blog entry in my opinion

20 Sept 2004

Refactoring Unit Tests

I'm currently refactoring some of my unit tests I made when I first started using JUnit framework.

2 things stroke me at first sight:
  • I make better unit tests now:
    1. I test only usefull thing,
    2. they depend less upon other things (ex: a file present in file system)
    3. they are clearer
  • Using Unit tests forced me to create new entries in my legacy classes, now unit testing is easier. I don't have to refactor a class before starting to unit test it.

3 Sept 2004

Renaming JUnit Tests

Using JUnit as it advantages but also it drowbacks...
Actualy it's more wsad 5.0 that could be improve.

When I decide to Rename or Refactor a set of Classes, I have to take care of the classes but also the ClassesTests.

For Exemple, let say I have classe called Foo and a classe FooTest.
If I rename Foo using refactoring menu from wsad, I have to take care of renaming FooTest myself.
It seems obvious but during the first days of programming, when you create your classes from scratch I usually rename my classes often until I'm satisfy by the classes name.

I also refactor and rename often the methods names and the problem is the same I have to rename the testMethod() method in the Test classe... (It is not allways obvious when You only added an "s" to the method name...)
It would be great if refactor menu could also take care of the Tests classes...

I'll try with eclipse 3 to see if they improve that point.

22 Jul 2004

Functionnal tests help to refactor

After a few month, uning JMeter for my functionnal/integration tests and having included them in the continius build process, I can see major changes in every day work.
First (I knew this one would come up that's why I did it ;-) ) there are fewer bugs (almost none), more self confidence in code and application stability.
Secondly (I hadn't thought of this one first) It helps refactoring since you gain testing time. I can now use this time for refactoring.

Everybody at work says I'm "test addict", I think back then when I hated testing (but did it)...
Automatisation of tests is far more interesting!

19 Jul 2004

Back from Holidays

Back to Work and Coffee after a holidays'week!
Always good to start with a little stand-up meeting with a coffee to know about the recent changes...

6 Jul 2004

Agile Manifesto

Some many famous people in here: http://www.agilemanifesto.org/!
It's like some kind of a freedom declaration act!

2 Jul 2004

Eclipse Cobol

Funny! I spoke yesterday with someone doing cobol... and they have exactly the same problems that me in Java about code that has not been indented neither commented...
Hopefully we have tools such as eclipse to format code automaticly!

Therefore I tried to use cobol plugin for eclipse. Seems nice but no indentation :(
May because of the way you need to write cobol with all the column and stuff...

1 Jul 2004

Refactoring all day long

I spend my entire day refactoring duplicated Date classes.
Thank you JUnit!
But if people before me (and also the actual team) had spoken between us a little more, those classes wouldn't have been duplicated in the first place.
May be I should try to use PairProgramming a little more (even if I don't like it much).

Search and Found

I'm glad to have found DBUnit. Because on (only) two tests, even if i didn't know back then, I had started building my own "DBUnit framework-like"...
I refactored those two tests with DBUnit and now it much more clearer!
That brings me to the point that refactoring tests is also very important since they can esealy become complicate and then hard to extends...

About 2 years ago, I thought learning a new product was not always worst the time investment.
But now I think, with a minimum technical background, learning such things is always good and end up focusing only on the real problems.

24 Jun 2004

DBUnit for .NET

I found dbunit really interesting and I thougth may be we could port this to C# and, as usual, someone already had the idea! (ndbunit)
But this time, there is only one developer and no much activity... may be I could take part of it.

22 Jun 2004

Database Tests Fixures

I've spend almost ONE afternoon trying to find a database with a good dataset just to make sure something works...
And it works! (my afternoon has been totaly waisted!)
I need to make a script to fill the database with data I'm sure of
and to find more easily a good user/password/data next time.

I've been hearing of DBUnit for a long time now...
May be it's time to try it!

21 Jun 2004

Courage or not Courage ?

Friday I had courage! I wanted to remove all that "smelling old" code during summer.
Today I'm not sure I want to spend the rest of the summer correcting bugs I will surely introduce if I refactor... (since there is not JUnit in the old part of the app)
What will I do?

14 Jun 2004

Jakarta Apache Agility

The utility of continius integration:
http://gump.chalko.com/gb/blog/SuccessStories/?permalink=Log4J-CL-EL-JV.txt&smm=y

It's incredible how the apache comunnity is agile!

Why Do Java Developers Like to Make Things So Hard?

As pointed in this article:
"Java is a great language being destroyed by Rampaging Computer Science," writes James Turner, who knows his way around a polymorphism or two, in his latest - and characteristically combative - Viewpoint.

It's always hard to find the right path between no anticipation and too much flexibility.
That's why eXtreme Programming was such a revelation when I discovered it.
Because it enable you to do only what is necessary and had code later when more flexibility is needed. You can even delete lines of code when it becomes too complicate and unecessary.
When such a situation occurs, the hardest thing is to overwhelm your pride and delete what you thougth was "good code".

Buzzword

I juste read this joke-word: "Markitechture" (here), means "Marketing Architecture" so true!

DBA and Open Mind

I just read this article (Scott Ambler's interview) from The Server Side, a little too long but quite interesting!

I really like the "Data People" part I never thougth of DBA that way because I always did the data base modeling myself.
But that's true there are like "exclude" from all this XP/Object/Open Source world (except MySql or PostGreSQL).

Secondly I liked his advise on reading and learning from other fields to developpe an open mind torward others.
It remembered me of an article (i think it was Ward Cunningham who wrote it) comparing Software Architecture to Buiding Architecture (a house or what ever type of building...).
An exemple of open mind: Medieval Architecture not the one I thougth of, but you got the picture.

11 Jun 2004

Xp France

I'm getting involve in XP community, for the moment i'll try the french xp community.

My page on xp-france wiki

If your french, you can join too, here's some links:
xp-france - mailing list

Rich clients

It a big mess in the rich client world!
I fisrt heard about Java Web Start, then about xul and then the microsoft solution xaml

Then i started to be a little confuse, so i searched for more informations...

I found different xul syntax, implementation in many different languages, xup(w3c) ...
And it become clear that it's a big mess with this contest
As you can see there is no standard way of doing things. I'll wait until it clarify!

For me the winners in battle, will be xaml(microsoft), web start (sun) and may be xul(mozilla)
And the other will die.

[update] As someone pointed in the comment section, the guy who made the contest is making confusion between xul and xul-like xml language (there is only one xul and it is not represented in the contest page) you can see a xul example here

First blog

My first blog entry! Ta-da!
I will try to keep it fill with interesting news... we'll see.