Book a Demo

Author Topic: Code engineering of Visual Basic  (Read 3462 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Code engineering of Visual Basic
« on: May 13, 2005, 12:23:03 am »
Is anybody using EA for Code Engineering (round-tripping) of Visual Basic?

I had what I thought were reasonable (but now appear to be wildly optimistic) ideas of using the Visual Basic code engineering facility to allow to round-trip some Rose (Summit) Basic and perhaps Embarcadero ER Studio Basic code.  

Both these versions of Basic are based on VB4 and so are not OO.  But since Visual Basic (core) hasn't changed that much it seemed reasonable to expect that to some extent, there would be some utility (the verb, not the noun) here.

So I thought I would test Visual Basic 6 round-tripping before attempting to "slash and burn"...

I can't even get that to work... ??? :'(  Has any body been able to?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

TrtnJohn

  • EA User
  • **
  • Posts: 176
  • Karma: +0/-0
    • View Profile
Re: Code engineering of Visual Basic
« Reply #1 on: May 13, 2005, 04:29:02 pm »
I think the file extensions are all different.  But, EA will still parse non-object oriented VB modules:  For example here is a simple little .BAS dummy module file.  Cut and paste it to EATest.BAS and try and reverse engineer it.
Code: [Select]

Option Explicit


Private Type STARTUPINFO
   cb As Long
   lpReserved As String
   lpDesktop As String
   lpTitle As String
   dwX As Long
   dwY As Long
   dwXSize As Long
   dwYSize As Long
   dwXCountChars As Long
   dwYCountChars As Long
   dwFillAttribute As Long
   dwFlags As Long
   wShowWindow As Integer
   cbReserved2 As Integer
   lpReserved2 As Long
   hStdInput As Long
   hStdOutput As Long
   hStdError As Long
End Type

Private Type PROCESS_INFORMATION
   hProcess As Long
   hThread As Long
   dwProcessId As Long
   dwThreadID As Long
End Type

Public Function ExecCmd(sCmd As String) As Long
End Function



But, I think there are a still a lot of language differences between VB4 and VB 6 so you will probably run into plenty of hassles.



Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Code engineering of Visual Basic
« Reply #2 on: May 13, 2005, 05:01:47 pm »
Yes, a simplistic file like this will work.  However, real files - even EA's own sample VB Addin - won't.

You can't round trip it...  You can import the directory, forward engineer (some attributes are added), and then when you try to synchronise back, EA Hangs!  (reported) :(

Also, if you try to expand on your simple file, you'll find it doesn't handle Const properly and it may have difficulty not duplicating some variable declarations.
This means that even for simple files, you can't round-trip without injecting new text each cycle!  

It's one of the first tests I always do with anything that can import and export...  Can I re-import what I just exported without error and without change?  I'm still amazed, in this day and age, how often products fail, perhaps one of the most simplest of tests... :'(

Paolo
« Last Edit: May 13, 2005, 05:03:24 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

thomaskilian

  • Guest
Re: Code engineering of Visual Basic
« Reply #3 on: May 17, 2005, 12:55:13 am »
Hi Paolo,
I know what you're talking about since I know it from my companies own product :-[
Please Sparx: don't start doing it like us. When you add more and more features the product will become instable and you won't even be able to maintain it.  Better have a nice small tool than a faulty 2 million functions Swiss knife.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Code engineering of Visual Basic
« Reply #4 on: May 17, 2005, 01:25:42 am »
Quote
Hi Paolo,
I know what you're talking about since I know it from my companies own product :-[
Please Sparx: don't start doing it like us. When you add more and more features the product will become instable and you won't even be able to maintain it.  Better have a nice small tool than a faulty 2 million functions Swiss knife.


Yes, Thomas, and the company for whom I work....

However, in my view, functionality and stability are not mutually exclusive - it depends how you approach the problem.  I won't expound on this unless specifically requested - I wouldn't want to appear conceited. ;D

Paolo
« Last Edit: May 17, 2005, 01:26:19 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

thomaskilian

  • Guest
Re: Code engineering of Visual Basic
« Reply #5 on: May 17, 2005, 03:31:52 am »
Nobody loves the messenger who brings bad news :'(