David Mentré's blog

Last entries

Sun 01 Jan 2017

I started this new 2017 year by creating a new PGP key (with fingerprint 3EA1 53E8 9472 8519 CDD1 1B9D 45DD 2720 B15E CA67). My old key was made twelve years ago and was too weak. The new one should be stronger (RSA 4096 bits). You can find my new public key on key servers or on my contact page.

Sun 29 May 2016

As a programmer and as a researcher in the software field, I've always been interested in trying to understand why a program or a system is well designed, fits its intended use, is maintainable, is scalable, etc. In short, how to make a good software.

I tried to summarize what I found so far in a very small (two pages long) "Little Guide on Software Engineering": 11 rules of decreasing importance with some references for further digging.

Of course, no revelations here. All those rules are found here and there in good books of Software Engineering. But defining and sorting those rules was an interesting exercise. :-) I'm not fully satisfied with the rule order and might change it. It is version 0.4 up to now and is still Work in Progress.

I would be pleased to get your feedback on those rules, so don't hesitate to send an email. The document is under CC0 license and there is a GitHub repository.

The probably most famous counter-example is the Linux Kernel, written in plain C language and counting more than 20 millions lines of code. But the Linux Kernel is probably a very rare case of this kind (would you have another example?), developed in a very specific way by the most talented people on Earth.

I discussed this point with colleagues having done a lot of object-oriented programming, they told me the usual argument: object-oriented programs allow grouping related data and code, abstracting details from the outside, thus their scalability. But a lot a programming languages have such modularity features, dating back to Ada in 1983 up to more modern ML-like languages with complex module system (e.g. functors).

So, is there another characteristic or usage of object-orientation that helps in program scalability? Or could the same principles be applied to any kind of language (which I think for now)?

For now, I don't understand why object-oriented programs should be more scalable. But I'm very bad at object-oriented programming. So if you have explanations, I would very please to hear them. You can add comments below or contact me directly.

Tue 16 Feb 2016

I am a daily user of Trello, the visual online service to organize cards into lists. Trello is a very simple but neatly found idea: you use cards organized into lists to represent your things (e.g. to-do lists) and, more importantly, you re-organize them as you wish: moving cards, moving lists, putting colored labels, comments, due date, or check-lists on cards, ... That way, you can represent about any system and update it status very easily and visually. Trello has also filtering capabilities and, last but not least, collaborative capabilities by sharing boards of cards. Trello is visual, simple to use. You can organize both your private and professional life with it: bug tracker, to-do list, project management, holidays planning, etc. Trello is great!

Restyboard and Wekan are very similar, i.e. a very early prototype of Trello. You can create lists and cards, move them, add labels and do some filtering, share boards... and that's all! Moreover Restyboard is very slow and uneasy. So if you want a basic Trello-like open-source alternative to Trello, use Wekan.

But if you want the full power of Trello, you won't find any open-source alternative.

So we need to build it. :-)

Designing a better Free Software alternative to Trello

So, how could we improve Trello?

Firstly, take all the basics of Trello: lists, cards, due dates, filters, check-lists, board sharing, etc. Maybe some goodies like badges are not needed, but the core of our Free Software Trello should be very close to the current proprietary Trello.

Second step: make it real desktop application (and mobile App), not an online service. Why? Because in a post-Snowden era, you cannot trust any online server, not in the US, not in Europe, not even your own lovely-administrated-server. So edit your data locally, encrypt it and then upload it for sharing. For a local application, you can create a real desktop application, or a web application. The second one might be easier to create and is in the mainstream, but even if web-based application can be very powerful, there always are strange UI issues, like application "windows" not interacting similarly to your other desktop windows. So I vote for the real application.

Third step: add sharing capabilities. Data should be uploaded in encrypted form. On the server, you need a minimal platform to store pieces of data, maybe with some PHP to maximize hosting ability. That step might be a bit tricky: you need some crypto power, be astute and not re-invent the wheel (or you won't have any security) to be able to share data while keeping that data encrypted on server. But there is always a lot of fun in a technical challenge! :-) And other people are looking at this issue, like Mozilla's Firefox Sync.

Fourth step: add 2D capabilities. I always found Trello frustrating regarding list organization: I can put lists in column, but I cannot organize lists in two dimensions, as on a table. Sometimes lists are very short: I would like to group them together, one above the other. Trello does not allow that.

Fifth but not least step: add programming capabilities. You want to automatically move cards when a certain label is put on them? You want to create a card when an email is received? Take you favorite programming language (OCaml, Lua, Ruby, ...), use the API and program the behavior your want. Even better, publish the recipe online, in a public repository, that way other people can reuse your nice Agile Project Management Tool Manipulated With Only Five Keystrokes™.

With all of that, I think we'll have a better Free Software alternative to Trello.

By the way I propose its name, Tibett: Tibett is better than Trello and because with Tibbet you can go to high heights. :)

Tue 09 Feb 2016

Every time you do some programming, you need a text editor (except when you program in graphical languages like SCADE). Some long-time well-known ones are Emacs (which I use) or VI. Such editors are focusing on their editing capabilities (you can edit huge files without any issue) and their ability to be programmed, for example they have dedicated modes to edit C language files or OCaml files. They are very versatile, you can find modes for obscure languages or even have dedicated mode for proof assistant (e.g. ProofGeneral for Emacs).

But those editors are focusing on the text. I think most if not all the time, they are using regex to match some specific keywords of a program and then color or indent them in a specific way, but they don't understand the program, e.g. what is a variable, an expression or a method call. Therefore people have proposed another kind of text editor dedicated to programming languages, like Eclipse or IntelliJ IDEA. Such editors are very powerful: they understand the program structure, propose useful contextual helps (like giving parameters of a method call) or help in code refactoring (e.g. encapsulating an object field so it can only be accessed to getter and setter methods).

Of course the distinction is not so binary: textual editor like Emacs or VI have advanced modes than can understand program structure and do refactoring.

But both kind of editors have a strong limitation: they focus on programming language and most of the time they are unable to mix text, graphics or other layouts like tables. This is not entirely true for Eclipse, but I'll come to that later. So, why would you like to mix text and graphics when editing a program? Because a program is more than just text! Wouldn't be useful to use a quick drawing to explain an algorithm? If you program manipulates state machines, wouldn't be useful to directly draw state machines and automatically convert them into code? That would certainly avoid some kind of programming errors. One could also imagine tables to specify the behavior of a function like Parnas tables (which could be even considered as a formal, albeit readily understandable, specification). Or one could imagine graphically draw the architecture of the system, then dive into usual text code to edit the software modules.

Such kind of editor exists, like mbeddr for C code or some Eclipse plug-ins like Rodin for Event-B formal language. But again I see a strong limitation to their use: they are storing the edited source code into a model generally saved in an XML file. It is very difficult to handle such XML files with usual programming tools. For example handling them in source control tool like Git is a nightmare, with merges very frequently corrupting the XML files.

So what would be the ideal programming editor mixing text, graphics and tables? I won't give precise specification :-) but only sketch here some characteristics:

Versatile, programmable, so as to handle various programming languages like Emacs or VI;

Able to directly draw graphics and edit tables, in a WYSIWYG way. For me this is a crucial point. Wiki-like approaches with special markers are not user friendly and practical enough. The ability to program the editor would allow transforming graphics or table into code text and vice-versa;

Store edited programs only in text files (and of course probably some binary files for graphics). One would probably need some tags stored as program comment to reference graphics within the code text and display it properly within the editor;

Hyperlink capabilities, to be able to navigate within the code, e.g. jump from a graphic element to the corresponding code text, maintain index and reference tables (for code documentation), ...

Fast, low on memory, disk and CPU resources. Everybody that has already used Eclipse understands what I mean. :-)

As far as I know, such a tool does not exist yet. If you have hints or even tool name that would be able to do what I would like, I'm very interested. ;-) Tell it to me through this blog comments or directly.

Software is digital, so how could it age? Parnas identified two different causes for software getting "older" when time passes:

"Lack of Movement", i.e. the inability for the software to match evolving user or environment expectations. A computer environment evolves constantly; language and compiler changes, operating system and library changes. But this is also true for user expectations: in the 70' people expected a text interface, in the 90' a graphical interface and now they want a web interface accessible from any device or an App usable on their mobile devices;

"Ignorant Surgery", i.e. the inability to correctly adapt the software as time passes. When somebody modifies the software, probably not the original developer(s), she/he won't probably understand its design and probably modify it as she/he understand the software. At this point understanding the software means understanding the original design as well as the introduced new design. After several of such modifications, nobody can understand the software and in some cases it should be rewritten from scratch.

Although this idea of Software Aging was proposed 22 years ago (and appeared 47 years ago, the famous "Software Crisis", according to Parnas), it is striking to see that it is still true. When I see it takes nearly one year to make a new release of the Debian system, I view it at software aging at work: the environment evolves in unexpected ways and each software should be adapted to match its new environment. And sometimes, applying those changes can be very difficult and lead to Ignorant Surgery, like the famous Debian OpenSSL bug.

How to avoid this software decay? Parnas gives some advises, I just summarizes them here:

Tue 26 Jan 2016

With this post I'm starting a new kind of article: WE programming project. It's objective is to give ideas of programs that could be written over a WE, probably a lot more or lot less depending on your skill and willing to extend the idea.

Sometimes, I would like to illustrate a slide or blog item with one of XKCD comics. I know it exists, I saw it but I can no longer find it! So frustrating! So the main idea of this WE programming project is rather simple: make a keyword index of XKCD comics so that one could look for a comics over a theme or idea.

Requirements

Here is some requirements for this project, feel free to adapt to your needs or your own ideas: ;-)

It is a web site on the Internet that displays each XKCD comics (with proper reference to original web site) with associated keywords

One can search comics on a set of keywords

One can associate keywords (a-z- character set, space separated list) to a given comics

Already given keywords are suggested

No need of account by default, everybody is free to add new keywords (for easy contribution)

Sat 04 Jan 2014

Yesterday I upgraded my Debian server from Debian 6 (Squeeze) to Debian 7 (Wheezy). Overall it went fairly well, most probably because I don't use that much software. Another reason is that two main packages I use, Nginx and PostgreSQL, were drawn from Squeeze backports so they were close to Wheezy version.

Having the important upgrade notes of all packages at the very beginning of the upgrade was very helpful.

I had nonetheless two big issues with Dovecot and PHP as CGI.

Dovecot

I had to upgrade from Dovecot 1.x to 2.0 configuration file. Dovecot 2 is supposed to be able to read Dovecot 1 configuration file but it did not work for me. First of all, I had to fix the import of the SSL certificates (easily done with help from README.Debian.gz). Secondly, I use non-standard ports and I was not able to easily fix it.

Overall, it was much easier to write a new Dovecot 2 configuration file from scratch. Using doveconf -c -n (also mentioned in README.Debian.gz) was very helpful to get the items to modify/add.

I don't see what Debian developers could have done better, the issue was at least well documented.

PHP as CGI

I am using Nginx web server so I had a custom init.d script to launch PHP as Fast CGI, Nginx and PHP communicating through a Unix socket. I don't know why but my PHP as CGI set-up was broken after the upgrade.

I easily fixed this issue by installing php5-fpm package and using the proper socket (/var/run/php5-fpm.sock) for the Nginx to PHP link. My server configuration is thus more standard and easy to maintain. Good! :-)

Feature wish for Debian 8

For next Debian, it would be useful to have a script that scans the installed packages and prints some notes telling if the upgrade can be done automatically or need manual intervention (and why, pointing to some further documentation to read). It would be very useful to know issues before starting the upgrade.

Tue 17 Dec 2013

I discover this book when following the Toyota Unintended Acceleration case where Philip Koopman, the author of this book, was a plaintiff's expert. Philip Koopman is an Associate Professor at the Carnegie Mellon University.

Why is this book so good? Because it explains in daily words what should be the ideal software development process. And not only it details the ideal process, but it gives concrete, down to earth advices on how to improve your current process and software development habits.

The book is divided into 30 small chapters, following the order of the usual V cycle (overall process, requirements and architecture, design, implementation, verification and validation, critical system properties). The chapters are very short, about 10 pages, and relatively independent. This one of the great point of the book: it is easy to read a chapter, there is not need to allocate a long time slot for it. You can pick the chapter that is most interesting to you. And as the chapters are right to the point, you immediately get useful advices and you can immediately start to apply them on your own development.

The other great quality of this book is that the author has a strong background in embedded software development. Therefore the advices are realistic and graduated. The author knows that you are going to find barriers and limitations in your work environment and he helps against them. For example, there are two chapters on producing some documentation but not too much. Even if you cannot apply the whole set of advices, you nonetheless get some ideas on own to improve your current software and what could be done in later steps.

I am not an expert on all the topics presented in this book (that's why I bought it!) but for the domains I knew (e.g. concurrent programming), the advices seem balanced and appropriate.

Of course, 10 pages for a chapter is very short and some subjects are so wide that they would deserve a book on their own (e.g. safety and security). In that case, Koopman's book give useful pointers to continue your reading and the summary he gives is an excellent introduction to the topic.

As I said many times, we are currently making very bad software and we should improve this situation. Better Embedded System Software is the one the very few books that you should keep close to your table and consult on a regular basis.

Sun 01 Dec 2013

On Saturday 2013-11-30 at 16:06 I left GMail. Now all (or at least most of them) of my emails are sent to my own email server based on Postfix, Dovecot and a Debian server.

It is increased burden to have to manage such a server. It was much easier for me to let Google administrators handle all the issues. But now at least I know where my emails are stored (in France) and how they are handled. I will less fear to see my Google GMail emails read by American spy agencies through PRISM program. Or at least, it will be a little more difficult for those agencies to access them. Hopefully, I won't have too many administration issues with this server.