Re: Use an Addin to automatically add date/time stamp to each edited line of VB6 code?

Tech-Archive recommends: Speed Up your PC by fixing your registry



On Thu, 11 Jun 2009 08:47:52 -0500, "Ralph"
<nt_consulting64@xxxxxxxxx> wrote:


"MM" <kylix_is@xxxxxxxxxxx> wrote in message
news:5tp135hlocjeqj5g37atfcss3bnhqjf9bv@xxxxxxxxxx
On Thu, 11 Jun 2009 03:36:15 -0700 (PDT), Mark
<mark.tunnard.jackson@xxxxxxxxxxxxxx> wrote:

You really would be better off with a version control system, as Ralph
recommends. Subversion is a free open source system that's very widely
used, Microsoft Visual Source Safe (as recommended by Ralph) is pretty
cheap these days - and hopefully the old bugs which corrupted the
archives are fixed now too :)

Oh yes! The corrupted archives, I remember them well. When I was
programming at work (now retired, thank God), we wouldn't touch SS
with a ten-foot pole. Typical over-engineering by the One Microsoft
Way team.

I mean, it can't be THAT difficult to add a date/time stamp at the end
of changed or new lines, surely? Moving the goalposts of the
requirement is like asking the old Irish peasant how to get to Dublin:
"Well, in your place, oi wouldn't start from here..."

Just looking right now at
VBE.ActiveVBProject.VBComponents(sModuleName).CodeModule.ReplaceLine
in my trusty Creating Visual Basic 5 Add-Ins book.


Actually just trying to be helpful.

I once designed and built a "commenting scheme" for a financial package
(subject to micro-auditing). I too thought it would be great to embed a
complete record of all changes. In this situation we went one better, we not
only marked changes, we tied it to the initializing change-control (thus
tracking date, programmer, testing, etc), meanwhile inserting CASE design
information so it could be tied to the model.

So we quickly ended up with crap like this ...

'##ModelId=3F62060E02A6
Private mCN As ADODB.Connection '##ChangeID=2F043

'##ModelId=3F62060E02B5
Public Function GetCN() As ADODB.Connection
Set GetCN = mCN '##ChangeID=2F043
End Function

'--------------------------------------------------------------------------
' Procedure : Init
' Created :
' Return : Boolean
' Purpose : Initializes with an open connection to the given database
'##ProjID=0012.4.2
'##ChangeID=10004
'##ChangeID=30144
'##ChangeID=2F043
'-------------------------------------------------------------------------
'##ModelId=3F62060E02D4
Public Function Init(dbFile As String, Optional sUserID As Variant, Optional
sPassword As Variant) As Boolean
Dim sTmp As String '@dev65 05/12/19xx
Dim sArg As String

' Validate the parameters
On Error GoTo Init_Err
If Len(dbFile) = 0 Then Exit Function
' Build string '@dev65 05/12/19xx
sTmp = DATABASE_STR '##ChangeID=1004
sTmp = Replace(sTmp, "@db", dbFile) '##ChangeID=10004
'##ChangeID=30144
If IsMissing(sUserID) Then
sArg = ""
Else
sArg = ";USERID=" & sUserID
End If
sTmp = Replace(sTmp, "@uid", sArg)'##ChangeID=10004 '##ChangeID=30144
If IsMissing(sPassword) Then
sArg = ""
Else
sArg = ";PASSWORD=" & sPassword
End If
sTmp = Replace(sTmp, "@pwd", sArg) '##ChangeID=10004
'##ChangeID=30144

' Open the connection
Set mCN = New ADODB.Connection '##ChangeID=2F043
mCN.Open sTmp '##ChangeID=2F043
Init = True
'On Error GoTo 0 '@dev03 05/12/19xx
Exit Function
Init_Err:
HandleError2 Err, "Class Module CDBxxx::Init" & " Connection string = "
& _
vbCrLf & "[" & sTmp & "]" '@dev65 05/12/19xx
Debug.Assert False
Init = False
End Function

That's not crap! That's EXACTLY what I want! (I don't actually need
the dev's name now, but I'd still make it an option.)

It added nothing to reability and even less to providing any useful
information.

It would to me. I could tell at a glance which is the oldest code,
which the newest, which was changed since the last release, and so on.
Highly useful feature, in my view. And the stamp could be placed far
to the right of the actual code, not all bunched up against the code.
Perhaps a more sophisticated approach would cause a 'tooltip' to
appear if the cursor was hovered over a line. The tooltip could state
the date and time when the line was changed. Thus in normal reading of
the code the stamps wouldn't get in the way so much. Even if you
consider they do, I reckon the feature is well handy!

Few coming later even bothered to try and read it. All it
succeeded in doing is insuring that one never touched it unless their job
was at stake. Crappy code stayed crappy code.

Did you not provide a freeze-point at which you could remove all the
stamps? That's what I would do. That's something an add-in *could* do
in spades. I'd still have 'em in my zipped backups if I wanted to
refer back.

Anyway, now you have *exactly* defined the spec, let's see how to
implement it!

MM
.



Relevant Pages