Guillaume “Zifro” Desrat’s former blog

DSL with Ruby : how to get a step ahead ? (make it written in French, for my colleagues’ sake)

Filed under: work, WinDEV, code, Ruby — Zifro November 29, 2006 @ 12:50 am

DSL is the acronym for Domain Specific Language. A DSL is a language designed for a particular purpose, for an intended audience who may not feel fine with a complex programming language. For example, Microsoft Excel macros are part of a DSL.

I’m currently working on an application which exports data into a text file, formatted with given tags and given parameters, then send it to another remote software, which will handle it (I skip here the whole process, which isn’t interesting at all for those who don’t work on it) to finally have the data printed and sent by mail.

WinDEV doesn’t offer built-in testing, so I made the application write a checksum like log, to verify the number of each type of data exported. Well.
But as we’ve got several undocumented (yeah, I know, real developers don’t write neither documentation nor comments, I should just read the code…) data handling rules, some of the corrections I add last month made errors appear in other parts of the file generated.
At this point, it gets enough freaky for me. I NEED REAL TESTS !

So, I decided to write, on my spare time, a tool to validate the file (if fields are all filled, if the values make sense, if the email field really contains an email address, and so on). Playing with metaprogramming and code injection, I got this skeleton of testing code (hiding all the automagical thingies in FileAnalysis.rb) :

#!/usr/local/bin/ruby -w

require "FileAnalysis"
include FileAnalysis

trap('SIGINT') { puts "\n\nAborting tests...\nBe sure to run *ALL* the tests at once from time to time ;-) \n\n"
} "MMMMMMMM_data_2006_11.txt"
FileForPrinting.analyze do |line| do |mag|



line.cust? do |cust|
# here goes the tests for customers lines
end do |art|
# here go the tests for article lines


This looks like a DSL to me (and it’s pretty like “Creating DSLs with Ruby” on Tests are quick to write, and fully understandable (okay, for those who know which tags are in the file, and which tests could apply to those lines).

Unfortunatly, my colleagues, who’ll have to deal with this piece of code, sooner or later, aren’t… English-friendly :)
For one thing, we don’t write code in English at work (WinDEV is set to “I code in French, pal” mode), and they’re not used to read and write this language. On the other hand, I don’t feel comfortable with writing tests in English for something I work on daily, in French. I mean : why the hell would I write instead of ligne.magasin ?

So I’ve the idea of pusching the DSL work one step further, turning it into a French written test tool, which would look like :

FichierAImprimer.est "MMMMMMMM_data_2006_11.txt"
FichierAImprimer.analyse ligne par ligne

ligne de type magasin ?

la ligne devrait avoir tous les champs remplis
le magasin devrait avoir une adresse electronique valide

ligne de type virement ?


fin des tests

Okay, that would be very cool. Of course, I might end up writing slightly different code lines, to save some time working on that, but I think you get the idea. I suppose I’ll call a method, just after starting the program, as the first line of the code, to parse the file (or, maybe another one which will contain the tests) to replace some strings by another, according to rules I’ll set up (delete a blank space if it is immediately followed by a “?”, “le” and “la” at beginning of the line should be deleted as well, and so on…).

This would mix the two categories of DSL : the ones which are new dedicated languages to serve one goal, and the ones which are evolution of existing programming languages.

At this point, I have only two questions to you, readers : have you ever written a DSL to be used by non-English people, and what’s your opinion about all this ?

Friday was a good day

Filed under: work, friends, Ruby — Zifro November 14, 2006 @ 9:35 pm

Last Friday was a very good day.

I had a job interview with Teamlog’s human & social resource manager, had lunch with the local agency director, who interviewed me a month or so before, and then meet their client, who might hire a Ruby on Rails (and some other skills) developer.
Their company, which I won’t name here, is really amazing : they deal with cool technologies, in a nice environment, use eXtreme Programming, and, best of all : they develop software with Ruby, my favourite programming language.
I think the (four !) interviews with them went fine… I’m looking forward hearing some good news… I hope :)

Afterwhat, I headed to Lyon and parked at fredix‘ home. We waited for alex and jsh to arrive, and then got to the Pizza Hut. We spent a very nice evening, ate more or less gigantic pizzas, and discussed some points of our beloved association, Ruby France.

Finally, I drove alex back home and got on my own way, to arrive at 2 am… quite a looooong day.

Two days (and few hours) to go

Filed under: work — Zifro November 7, 2006 @ 9:16 pm

The countdown has started for weeks.

On Friday, I’ll have the second round of the job interviews session with Teamlog. I gonna meet their social/human resources manager, and (that’s new) I’ll also be introduced to their clients, for who I might work, if I’m the right man.

I must confess I think a lot about it, as “most of the interviews will be done in English”. It’s not my native language ; it might be hard to have a two hours discussion with them.

Job interviews

Filed under: work — Zifro October 27, 2006 @ 10:50 pm

Do you remember I went to Grenoble to have a job interview with one of Teamlog agency director ?

As she told me, I was phoned by their human ressource manager, on Monday afternoon, to set up a new interview.

So i’ll be in Grenoble on Friday, November 10th. Let me know if you’re in the area, we could go for a drink somewhere at the end of the afternoon.
I’ll be in Lyon to visit Ruby France members the evening, after what I’ll immediately come back home, as my CNAM courses have^W might have started on Saturday morning.
On the other hand, someone I’ll meet at Paris on Rails offered me to talk about my job search…
wait & see…

Job interview. Yay!

Filed under: work, healthy life — Zifro October 11, 2006 @ 1:14 pm

Do you remember I was contacted by Teamlog, an IT service provider ?
After a 27 minutes phone interview, I sent them a modified version of my resume, based on their model, and wait for another technical call. I was still waiting until yesterday afternoon.

The recruiter phoned me back, apologized for things not going right with their new recruitment process (I also told her I was busy a lot, and didn’t try to contact the tech again) and speaking of a possible meeting, I offered to come to Grenoble, as I would already be in the area on Friday and Saturday (I’m going to the JDLL where I’ll meet fredix and pouype).

So we planned an interview on Friday afternoon, 2:00 pm.

Wish me luck !

Note # 1 : I wanted to write this early this morning, but the coffee machine made a short cut, and I thought it was the electrical provider’s fault (they cut the power yesterday afternoon to replace a 20 KVA equipment in street I live in) so I didn’t check the circuit-breaker until I noticed there was light in the building stairs.
Too lame… I know :-\

Note #2 : I wore my suit this morning, because I wanted to know if I was fit enough to dress it again. Girls loved it. One of the directors was fully impressed (of course, my hair were clean and I shaved my two-days beard).

One month to go

Filed under: work — Zifro October 2, 2006 @ 1:18 pm

As usual, here is my Monday post.

Last Friday was fun A quarter before noon, I went to the boss office, to ask him for an arrangement so that I could go to my night courses during the week. It would have consisted of starting working half an hour earlier an afternoon a week, to leave half an hour earlier the same day.
He told me to close the door, because we had things to talk about.

So we talked about the same things my project manager already let me know : I don’t involve much in the different projects, I would have failed on the first one if they hadn’t helped me, and so on.
My replies were the same : I didn’t know WinDEV was such an horrible language and IDE, I’m still looking for technical documentation, that 70-80% of software lifetime is maintenance - so it’s better to design things correctly to be sure to modify them later.
And his conclusion was : we’re a small company, we don’t have time to work like we should, he wants me at 300% [so I should do three times more hours ?], to, finally, drop his last “let’s see each others in a month”.

Let’s see in a month…

It’s always when you don’t expect it that it happens

Filed under: work — Zifro September 25, 2006 @ 3:02 pm

You may have been told unenumerable times : don’t try to get something, just wait for it to happen or come to you.

Okay, you may have been told that about girls (or boys). It seems to be the same for job opportunities.

fredix, the President of our beloved Ruby France association (yes, there are many French Ruby users), was contacted by a recruiter whovia the website For various reasons, he didn’t want to go further with that company, and then, via GTalk offer me to tell us about me.

So, Teamlog’s recruiter phoned me, for about half an hour (she had a so charming voice that it was a delightful interview) to present me the company for which I would work (Teamlog is a service provider), their goals, their state of mind (the founders are all former Sun workers). She also tested my English speaking for five to seven minutes, and I think I was good enough because she wrote it in the email she sent me back after :)
It seems very interesting ; they deal with European mobile operators and telecommunications, to provide a common web portal for travelers, and want to hire a Ruby/Ruby on Rails/Perl/Python (w00t !) teammate very quickly. The job is based in Grenoble, a nice (but expensive) place.
I sent few minutes ago my resume, converted to Teamlog’s format, and two recent pictures. I’ll soon know much about it (salary, …), and I try not to lure myself.

It’s kind of weird to have been recommended twice recently :-)
Anyway, “wait and see”, and thanks a lot fredix !

Friday post.

Filed under: work, friends, misc — Zifro September 22, 2006 @ 10:30 am

As usual, it’s a pleasure to wake up on Friday, knowing I’ll recover all the lack of sleep the day after. Okay, it becomes a pleasure only after spending a Willpower skill point to achieve the action :)

Anyway, I’m sitting down here , wondering if I’ll manage to debug the copy/paste work I was told to do (yes, it’s one of this company “best pratices” : if it already exists somewhere and it’s not reusable because it’s not a library or a class, copy paste it then !). The biggest fun of it was when I noticed the code I had to merge from two windows (yes, former developers put code into windows) use global procedures for the first and local ones for the other, which had the same names :)
[EDIT : as I keep on working while I write this (or the reverse), I found the bug]
Best of all, I let my project manager know I’m in trouble with the old code, and he said “weird… you just had to copy paste it”. How useful.

He had told me this job would be a good experience, that I’ll learn to solve problems like anywhere else… oh true… sadly true.

If I need some more sleep, it’s partly because I went out Thursday night, to meet a former colleague, who worked with me for more than a year when I was a techie, installing hardware and configuring software in our shops, Europe-wide.
He now lives in Saint Barthélémy, doing quite the same job, for local prestigious hostels and companies, earning more money (but life’s more expensive over there). As we talked about my current company, we agreed that it didn’t fit us both : too little will to evolve and we wanted (and I want) more.

Two girls and a guy from the accounting dept. came as well, the tapas, the sangria and the beer ; it was really nice, and we’re considering organizing new events (a girl offered to go to the paintball).

As my favourite Friday evening party is going to Nîmes‘ car meeting and drag races, I thought I’d enjoy it today. Too bad the weather’s not suitable. This week-end is about to be uneventful.

It doesn’t matter, I have much work to achieve :)

One week

Filed under: work, healthy life, Ruby — Zifro September 19, 2006 @ 12:33 pm

It’s one week I haven’t updated my blog. Sorry -_-

First, I’m still alive.

Second, I went to the haidresser and shaved my beard, so that I don’t look like this any longer like that (okay, the sunglasses add a bit to the guru/scary effect).

Third, I had much work at the office, related to the project I more or less described here. It will soon be used by one of our stores. I hope it will work :)
Finally, I started working again the evening on YAIB , splitting it into three parts as I may have written here : the micro-kernel, the IRC library and the bot itself.

Tuesday, WinDEV.

Filed under: work, WinDEV, code — Zifro September 12, 2006 @ 1:46 pm

As I was to find out a solution to the big number problem in our software, I imagined I could write the code in Ruby, make it stand-alone with rubyscript2exe, and call it from WinDEV.


The Ruby part went fine (of course), but I couldn’t manage to get something else than 0 when I call it from WinDEV. And then I noticed that I forgot a blank space, so instead of calling “C:\zlab\rlmc.exe 8708″, it was launching “C:\zlab\rlmc.exe8708″, FUCKING SILENTLY !

So after some tests, I went to this conclusion : one of the two signatures of the LanceAppli function doesn’t work (by work I mean raise and exception in such a case).

If you’re interested in knowning more about it, here you are :


(and finally, I coded an int z_modulo(string s, int n) function to keep all the code in WinDEV)

- Next Page >>>