Les Blogs de Microsoft France [OPML] Les Bloggueurs de Microsoft France : Antoine Driard Arnaud Gstach Benjamin Gauthey Christophe Lauer Damien Caro *** Lantim Eric Mittelette Eric Vernié Fabrice Meillon François Mérand Guillaume Renaud Jihad Dannawi Julien Codorniou Laurent Bonnet Laurent Ellerbach Laurent Herbulot Lucas Riedberger Mitsu Furuta Pascal Belaud Patrick Guimonnet Pascal Belaud (Olymars) Patrice Manac'h Patrick Duboys Pierre Lagarde Sébastien Bovo Stanislas Quastana Stéphane Papp Thomas Lucchini Team Media Center
<script language="JavaScript1.1" type="text/javascript"> <!-- Xt_param = 's=168056&p='; Xt_r = document.referrer; Xt_h = new Date(); Xt_i = '=4) {Xt_s=screen;Xt_i+='&r='+Xt_s.width+'x'+Xt_s.height+'x'+Xt_s.pixelDepth+'x'+Xt_s.colorDepth;} document.write(Xt_i+'&ref='+Xt_r.replace(/[<>"]/g, '').replace(/&/g, '$')+'" title="Analyse d\'audience">'); //--> </script> <noscript> audit et mesure d'audience visiteurs internet par </noscript>
<!-- Start of Flickr Badge --> <style type="text/css"> .zg_div {margin:0px 5px 5px 0px; width:117px;} .zg_div_inner {border: solid 1px #000000; background-color:#ffffff; color:#666666; text-align:center; font-family:arial, helvetica; font-size:11px;} .zg_div a, .zg_div a:hover, .zg_div a:visited {color:#3993ff; background:inherit !important; text-decoration:none !important;} </style> <script type="text/javascript"> zg_insert_badge = function() { var zg_bg_color = 'ffffff'; var zgi_url = 'http://www.flickr.com/apps/badge/badge_iframe.gne?zg_bg_color='+zg_bg_color+'&zg_person_id=51333257%40N00'; document.write('<iframe style="background-color:#'+zg_bg_color+'; border-color:#'+zg_bg_color+'; border:none;" width="113" height="151" frameborder="0" scrolling="no" src="'+zgi_url+'" title="Flickr Badge"><\/iframe>'); if (document.getElementById) document.write('
I've tested quickly the "PHP to ASP.NET Migration Assistant" and played with it trying to convert some sample PHP scripts to ASP.NET lately. I know that we also have other tools like the one to migrate from JSP to ASP.NET, but since I haven't tested those one by myself, I will also talk about my experience with the PHP Migration Assistant. Also remember that I'm a former PHP guy now working at Microsoft France :)
What is this tool meant to, and who does it targets?
This tool is supposed to be meant for PHP developers who are curious to see which improvements ASP.NET could provide for their applications, and not only from a performance perspective. In my understanding, it is clearly meant towards developers with none or basic knowledge of ASP.NET and Webforms. Hence the tool.
What is the goal of this tool?
Ideally, such a tool is supposed to take a valid and running application written in PHP and convert it into a valid and running ASP.NET Application. Unfortunately, as anybody can guess, automatic translation tools have limitations, and some constructs or instructions won't be automatically translated. So, chances are really low that one ends up with a running application, except for a single line of code "Hello World !" application.
Why do we miss the goal?
Several aspects in this migration tool annoys me. First of all, the design principle that was chosen leads to use a bunch of "PHP compatibility" assemblies, like the famous VB6 compat assembly that comes along with VB.NET. These compatibility assemblies contain emulation of nearly all base PHP functions, and also of the most common functions, like those related to the MySQL database.
For example, to open a MySQL connection in PHP, one could write something like the following line:
$res = @mysql_connect('myservername', $s_login, $s_passwd) or die ("connection problem");
Which would be converted by the PHPCA tool into something like this:
//UPGRADE_ISSUE: Operator '@' was not converted.generatedAux = System.Convert.ToBoolean(res = System.Convert.ToInt32(PHP.MySQLSupport.Connect("myservername", s_login, s_passwd))) || PHP.End("connexion problem");
Not only is the construct less easy to read, it doesn't show how to use and get the benefits of ADO.NET. Instead, it uses some "non standard" MySQLSupport.Connect() method. It doesn't help the PHP developers to learn all the objects and methods from the .NET BCL. Instead, it exposes through this compatibility assemblies a subset of features that won't allow the PHP developers to take advantage of .NET.
Even worst, since PHP is an embedded scripting language, comparable to ASP 3.0 in VBScript or JScript, the translated ASP.NET code really looks like an embedded scripting language, which does a heavy use of the Response.Write() construct. But this is not ASP.NET, or at least this is not Webforms. And that's what I wanted to highlight with this - pseudo - rant: the PHP Convertion Assistant won't allow the PHP developer to fully embrace our fantastic Webforms model, which does so much envy to our Java fellows :-)
I think we will miss the goal with such a conversion tool. What is your opinion? I'd like to hear counter-arguments of people that would say that the tool has provent to be useful in their context.