Bonnes pratiques en SSII
Sous prétexte de respecter les délais, de réduire les couts et de satisfaire les petits caprices de certains clients, certaines SSII n'hésitent pas à cultiver la méthode du code "vite, moche, débile" en embauchant des gens totalement incompétents.
Ainsi je me suis retrouvé à maintenir des horreurs sans nom.
Exemple : un énorme extranet utilisé par un gros ministère ; le code ci-dessous (asp 3) était dupliqué sur une cinquantaine de fichier
<% Sub produit(t) if oRS(t) > 0 then response.write "<small>" & t & "</small> " end if end sub sub tel(t) if len(t) > 9 then response.write t end if end sub %> <%set oConn = session("oConn") set oRS = oConn.execute("SELECT * FROM [IntSociétés] WHERE [Numero_de_la_societe] = " & request.queryString ) if not oRS.EOF then oRS.MoveFirst %> <% end if %> bgcolor="#FFFFFF" style="vertical-align: top"> <strong><span style="color: #ffffff;"> </span> face="Times New Roman" size="3"><strong>Nom</strong></strong> <strong><span style="color: #ffffff;"> </span> face="Times New Roman" size="3"><strong>Adresse</strong></strong> <strong><span style="color: #ffffff;"> </span> face="Times New Roman" size="3"><strong>Type de produit(s)</strong></strong> style="margin-left: 2px; margin-right: 2; margin-top: 2; margin-bottom: 2" valign="top" align="left"><span><% if oRS("Presence_HE") = "O" then response.write "<strong> " & oRS("Nom_de_la_societe") & "</strong> " response.write UCase(oRS("Pays1")) & " représentée par : " response.write oRS("Nom_de_la_HE") else response.write "<strong> " & oRS("Nom_de_la_societe") & "</strong> " response.write UCase(oRS("Pays1")) end if%></span> style="margin-left: 2px; margin-right: 2; margin-top: 2; margin-bottom: 2" valign="top" align="left"><span style="margin-top: 0px"><%=oRS("Adresse1")%> <% if not isnull(oRS("CPAdresse1")) then response.write oRS("CPAdresse1") & " " end if%><%=oRS("CP1")%> <%=oRS("Ville1")%> Tél. : <% tel(oRS("Tel1"))%> Fax : <% tel(oRS("Fax1"))%></span> style="margin-left: 2px; margin-right: 2; margin-top: 2; margin-bottom: 2" valign="top" align="center"> <span> </span> style="margin-top: 0px"><% produit("PM") %> <dd> </dd> bgcolor="#FFFFFF" style="vertical-align: top"> <strong><span style="font-family: Times New Roman; color: #330000; font-size: small;"><strong>N° Admission à la marque</strong></span></strong> <strong><span style="font-family: Times New Roman; color: #330000; font-size: small;"><strong>Désignation</strong></span></strong> <strong><span style="font-family: Times New Roman; color: #330000; font-size: small;"><strong>Matériau </strong></span></strong> <% set oRS2 = oConn.execute("SELECT * FROM [IntPM] WHERE [Numero_de_la_societe] = " & request.queryString ) if not oRS2.EOF then oRS2.MoveFirst DO Until oRS2.EOF %> style="margin-left: 2px; margin-right: 2; margin-top: 2; margin-bottom: 2" valign="top" align="center"><%=oRS2("PPM_N_Admission_Marque")%> style="margin-left: 2px; margin-right: 2; margin-top: 2; margin-bottom: 2" valign="top" align="left"> <%=oRS2("PPM_Nom_commercial")%> style="margin-left: 2px; margin-right: 2; margin-top: 2; margin-bottom: 2" valign="top" align="left"><%=oRS2("PPM_Materiau")%> <% oRS2.Movenext Loop End if %>