Ubuntu Party this weekend!
RT @thibauld Ubuntu Party this weekend!Just a quick post to let you know of the Ubuntu Party that will take place this weekend à la Cité des Sciences et de l'Industrie. I don't know yet exactly when I'll be there, but I'll sure be there
See you there !
Login everywhere with your own OpenID identity server
RT @thibauld Login everywhere with your own OpenID identity serverTired of creating new accounts each time you use a new website? Maybe it is time for you to begin using OpenID. The principle behind OpenID is simple: Once you have a so-called OpenID, then you just have to provide it to log into the websites that supports OpenID (and there's already a lot!). No username, no password... the website will automatically ask your OpenID provider for your credentials. If it is the first time you log into this website, your OpenID provider will ask you your permission to provide your credentials to the website. Wonderful isn't it?
The beauty of this solution is that it is completely decentralized, there is no entity that gathers the credentials of everybody, and you can choose your OpenID provider: Yahoo can be your OpenID provider, Wordpress can be too... there's a lot to choose from! Obviously, you should choose the one you trust most for holding your credentials.. so why not you? Why not be your own OpenID identity provider? For example, my OpenID is http://thibauld.com. It has several advantages :
- You can choose your OpenID (since you can use your own domain name)
- You can manage all your websites accounts from 1 unique place
- You can have create several identities and use the one you feel comfortable with for each website you visit
- No one else but you own your credentials
- and last but not least... it's cool
Assuming you're a bit nerdy (like I probably am), there's no reason to let somebody else be your identity provider! Convinced? Good, in 30 minutes you'll be ready to go!
An OpenID server is really easy to setup provided you already have a webserver with PHP support installed. There are various Open Source server to choose from : phpMyID, phpMyOpenID (based on phpMyID)... but my favorite is SimpleID because of its nicer user interface and its ability to offer a "secured" (at least more than the other projects) login mechanism even if you're not using SSL (use SSL if you can though). Please note that your webserver should be able to write files on the system for SimpleID to be able to run smoothly (it might not be the case on mutualized servers).
Setting up SimpleID is very easy, you just have to follow the instructions. Please note that version 0.6 needs to be patched to prevent problems sites using OpenID version 1.1. If 'svn' is not a unknown word to you, I advise you to checkout the last version directly from svn (I did that), in this case, patching the code isn't necessary. Or, other solution, wait for version 0.7 to be officially released
Once installed and setup, you can test your openid identity server and your openid page to check everything's ok!
Finally, here's a screenshot of the SimpleID administration console for a given identity:

Web application implementation step 1: choose your weapons!
RT @thibauld Web application implementation step 1: choose your weapons!During the next series of posts, I will describe the different steps involved in building a web application. These posts will only deal with the technical aspects of implementing a web application that has already been designed. Web application design is another subject which I'll develop in another series of posts.
I'll take the new FBC website as an example. It is a good example as we almost had to start from scratch to build the new version. Indeed, the architecture in place was extremely inflexible, the worst being :
- Webpage layout relied on field values in SQL tables
- 1 url <=> 1 php page containing everything from HTML to SQL
Functionally speaking, their website was working well but it had been at the expense of countless hours spent testing and testing and retesting that every process was functional. But now they were stuck... Only changing the graphical chart would have needed to go change *every* php file and restest the whole thing entirely... When I saw that, it was obvious that it would take us less time to rebuild the entire architecture from scratch and then add the new features than trying to work on this extremely rigid and non evolutive code organization. Of course, we would need to reutilize pieces from the old code in order not to re-implement the business process, but it was pretty much everything we would be able to reutilize.
So the first step when building a web application (and not a website) is choosing your weapons, that is the technology stack you're going to build your application upon :
- Which OS are you going to use ?
- Which webserver ?
- Which database ?
- Which programming language and framework ?
Choosing the OS
I'll not elaborate on this one, use Linux. The only reason I can see for not using Linux are :
- you know nothing about Linux and don't want to learn
- you were asked explicitely not to use Linux
- there are obvious reasons which require your app run on another system
If none of the above matches, choose Linux. And among all Linuxes, if you have no preference, I'd personally go for a Ubuntu Server LTS (Long Term Support) which is free and provides security updates during 5 years. Just check that the LTS does not end next year
The current Ubuntu Server LTS is version 8.04 (code name Hardy Heron).
Choosing the webserver
Again, I'll not elaborate much: Apache 2 as it has proven capabilities to run high traffic websites, great documentation (official and non official), lots of modules availables... etc... There are other webservers but, unless you want to restrain it to very specific tasks, use Apache to serve your dynamic pages.
Choosing the database
I assume you want an Open Source database here. It's hard to choose here between MySQL and PostgreSQL . PostgreSQL is probably more powerful but it is also probably a little harder to get into. For example, the fulltext search in MySQL in a lot easier to use than in PostgreSQL but PostgreSQL's fulltext search allows you to perform more complex queries. In the same spirit, MySQL provides handy but limited functions (ex: GROUP_CONCAT) where PostgreSQL offers you less handy but more powerful equivalents (ex: array).
Both database has a good official documentation but I think MySQL benefits from a lot more unofficial documentation compared to PostgreSQL. In terms of proven capabilities, both have examples of usage in very demanding contexts...
Finally, the choice is up to you BUT if you use MySQL, do not forget to use InnoDB tables instead of MyISAM tables. By default, tables are created using MyISAM. Using MyISAM table can be a good choice but it must be a known choice. Indeed, MyISAM table does not support FOREIGN KEYS nor does it support sql transactions so it is very limited and will inevitably result in added programming overhead if you build a complex web application upon MyISAM tables.
Choosing a framework
Rule 1: be skeptical
First, you should not use a framework for the sake of using a framework. Instead, you should really think at what you expect from your framework. I'm personally a bit skeptical about a lot of frameworks because, in my opinion, a lot of them end up being bloated, trying to reinvent the wheel and with finally a limited number of really useful functionalities. Keep in mind that using a framework is a binding investment: First it needs time to learn how to use it efficiently and, second, it generally deeply affects your code. So you'd better choose your framework well if you don't want to loose a lot of time !
Rule 2: know why you need a framework
Beware of frameworks that try to provide a solution for every aspect of your application as they are likely to belong to the "bloated" category! I personnally prefer a framework which focuses on doing 1 thing right than a framework that tries to simplify everything. For each functionality, ask yourself : "Do I really need my framework to do this ? Will it really help me be faster in my work ?
Rule 3: Beware of marketing crap
Here are examples of marketing functionalities I always consider with skepticism :
- i18n support (internationalization): In which way is it better than gettext ?
- RESTful URLs: You mean Apache URL Rewriting (and optionally a routing index.php) ?
- Easy Ajax: I did not know Ajax was hard to implement on the server side! Are you looking for a Javascript framework ?
- Full database abstraction: This one must be considered really really carefully. Database design is one of the most crucial part when you build a web application. In the same manner, how you query your database has an enormous impact on your application performance. This is why I am really really skeptical when it comes to delegating the database management to the framework. Some frameworks even create the database for you! Unless you're talking of a very simple web app, I think it just does not make sense... The only explanation I can think of is that a lot of web developers have a very little knowledge of SQL and, for them, it's easier/better to have the framework handle the database. On the other hand, it is also true that that database abstraction (especially ORM) are useful to handle all the simple queries. As a conclusion, concerning database abstraction, I would only use one if I'm sure that it's flexible enough to :
- Work on top of the database schema I designed
- Let me perform raw SQL queries when needed
I see a framework as a toolbox to help you concentrate your efforts on implementing real business code. So what can you expect from a framework ? A templating system, a caching system, a testing / debugging framework... All of these are very useful functionalities that a framework can offer because coding them would sure be a waste of time!
Choosing a programming language
There are a lot of very good languages for web programming (PHP, Python, Ruby...) and I can see a few differences:
- Framework compatibility: Once you've chosen your framework, you probably already know the programming language you'll be using.
- Quality and quantity of documentation: I think PHP has the best and most comprehensive documentation, followed by Python and Ruby.
- Library exhaustivity: Again, in my opinion, PHP has the deepest library available, followed by Python and Ruby. You should check beforehand that a language has all the required library for the app you want to implement. For example, if you plan to use SOAP based webservices, you probably want to avoid Python as (last time I checked) it has one of the most limited SOAP library. PHP, on the contrary, has a good gsoap compatible SOAP implementation.
- Familiarity with the language: One of the most important criteria of course! How productive are you with each language ? Even if all of these languages are relatively easy to get into, mastering a language takes time... so if you're a Ruby guru and have never used PHP, then you're probably better off with Ruby...
- Language beauty: Sorry guys but this is unfortunately NOT a good criteria. Had it been, then I would have rated Ruby first, then Python and then.... far behind, PHP
To conclude this long post, I think the most important rule is :
Use production ready technologies which have proven to be performant in similar contexts
Each time you have to choose a technology stack, no matter what it is and what bloggers and/or developers tell you about it, find relevant examples of web applications using this very stack to be sure, provided you do things well, the chosen stack will be able to fit your needs (performance, scalability...).
Stay tuned for the next post where I'll talk about the technology stack I've chosen for FBC!
Freelance Business Club v1.0 released !
RT @thibauld Freelance Business Club v1.0 released !That's it! After 3 months of hard work, the new Freelance Business Club website has been launched this weekend... mission accomplished
If you compare with the initial planning, we're 1 little week late... but, given the result, I think our last week decision to postpone the technical release was the good one!
For those of you who don't know what is Freelance Business Club, it is the first social network dedicated to IT freelancers (and their clients). It's a new concept which aims at easing the recruitment process of IT freelancers, it has been pioneered by Arnaud Coulondre (see his fbc profile) and Florent Daversin and I personally came onboard a bit later, after the launch of their website's beta version (you can see my own profile here).
My role in FBC, was to turn their beta version into a full-featured 1.0 version, which, I think, we achieved. Objectives were to lay the foundations for :
- Stable, predictable and maintainable software architecture
- Scalable technical architecture
- SEO efficient website (with the precious help of our beloved SEO master Sacha Pavan, creator of BankExam)
- Easy internationalization
- Integration with 3rd party webservices (Scribd for online CV visualization in our case)
- Easy integration of the new graphical chart (which I find awesome and was designed by Léo Robin)
- Implementing a performant, business focused and highly relevant search engine for FBC.
I'll probably use this blog to develop further what I did for FBC regarding each of the above points as I think it might be of interest.
Just for fun, I took some time to compare version beta and version 1 of the website and here are the results using SLOCCount:
Stats for version beta
Totals grouped by language (dominant language first):
php: 13258 (96.75%)
sh: 446 (3.25%)
Total Physical Source Lines of Code (SLOC) = 13,704
Development Effort Estimate, Person-Years (Person-Months) = 3.12 (37.49)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 0.83 (9.91)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 3.78
Total Estimated Cost to Develop = $ 422,018
(average salary = $56,286/year, overhead = 2.40).
Stats for version 1.0
Totals grouped by language (dominant language first):
php: 7556 (99.84%)
sh: 12 (0.16%)
Total Physical Source Lines of Code (SLOC) = 7,568
Development Effort Estimate, Person-Years (Person-Months) = 1.67 (20.10)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 0.65 (7.82)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 2.57
Total Estimated Cost to Develop = $ 226,241
(average salary = $56,286/year, overhead = 2.40).
I was impressed (not to say proud
) of the 45% decrease of the number of lines of code although version v1.0 has more features than version beta. Too bad SLOCCount doesn't take HTML or JS into account as I think results would have been even better... What's interesting also is that, given the number of lines of code found, sloccount uses the COCOMO model (a software cost estimation model) to "reverse estimate" the project main figures. For v1.0, according to the model, we should have spent 7.82 months with an effort of 20.10 person-month (that is 2,57 developers), to finish v1.0.
In reality, it took us almost exactly 3 months (we began on August 1st) to release v1.0 with 3 resources (among which 1 was not full-time, so let's say 2.57 resources to ease the comparison). Of course, comparison does not stand as v1.0 was not built from scratch and there was code (mainly the business layer) that was already developed for vBeta. But given the major overhaul of the code we did, I still think that releasing v1.0 was a very honorable performance!
But enough analysis already! Let's now have some beers and drink to FBC v1.0 before the first bugs appear
Santé !
