Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

2.3KB

Legacy Rules: ASP Classic, VB6, and VBScript

  1. Explicit Cleanup: Always clean up COM objects and Recordsets explicitly:
If Not (rs Is Nothing) Then
    If rs.State = 1 Then rs.Close
    Set rs = Nothing
End If
If Not (conn Is Nothing) Then
    If conn.State = 1 Then conn.Close
    Set conn = Nothing
End If
  1. Option Explicit: Ensure Option Explicit is present at the top of all VBScript and VB6 modules.
  2. Safe Parameterization: Never concatenate input strings into ADO SQL statements. Use ADODB.Command with CreateParameter.
  3. Error Handling: Avoid blanket On Error Resume Next without an immediate check. Log every handled error to the flat log file documented in .devfoundry/references/environments.md (“Legacy Error Log” section) — one line per error with timestamp, source module/function, Err.Number, and Err.Description:
On Error Resume Next
' Risky call
If Err.Number <> 0 Then
    ' Append a line to the flat error log path from environments.md, then:
    Err.Clear
End If
On Error GoTo 0
  1. Driver Awareness: Confirm 32-bit vs 64-bit ODBC/OLEDB driver compatibility before deploying changes touching Access databases.
  2. Architecture: Classic ASP has no built-in MVC framework, but new or substantially modified pages should still separate concerns in that spirit: request handling/business logic in included .asp/.vbs modules or COM components (VB6 classes), data access isolated from presentation, and .asp page bodies limited to rendering. Do not introduce a third-party MVC framework into a legacy runtime unless the spec calls for it.
  3. Design by Contract: Functions/subs (in .vbs, .bas, .cls) validate their input parameters at entry and set Err.Raise or return an explicit error/status rather than proceeding on unchecked assumptions; document expected pre/postconditions in a comment above the function signature.
  4. TDD: If the project has a test harness (e.g., a VB6 unit-test framework or a script-based test runner), write the failing test first and implement only enough to pass it. If no harness exists, write the exact manual verification steps (inputs, expected output, expected error behavior) in the spec before writing the code — this is the required TDD-equivalent artifact and must exist before implementation begins.

Powered by TurnKey Linux.