Saturday 25 February 2012

Just when you thought it was safe to come out!


Finally managed to get a day to review where we are with things - Roy has been doing a great job unpicking the code.

We have 12,000 lines of uncommented VB code (that means none... nada.... zip comments!)  on top of that, the code is littered with numerous IF THEN's none of then coded with indents making it a nightmare to follow what is going on. Then you have data items that are renamed and renamed again from routine to routine........arghh!

The convolution is worse that imagined - as illustrated below in a snapshot of one of the main routines! 


Poor software engineering practices have meant that there is no chance of us every being able to maintain this code going forward!

What to do next.......

Friday 17 February 2012

Came across this...

Been on holiday this week - so limited news - though am assuming 'others' have progressed things - will find out on Monday!

However, in a trawl of Google I came across this article which looked interesting;

From, Heat Transfer Today –R.J. Ribando - web ref

http://faculty.virginia.edu/ribando/modules/xls/VBAPrimer.pdf

with quotes as follows:

" In the past, even mildly complicated engineering calculations have not mixed well with 
spreadsheets because of the very strong tendency to wind up with nearly-impossible-to-debug 
"spaghetti code". .......... However, by using Visual Basic for Applications (VBA) in conjunction with the Excel spreadsheet, the user has the convenience of a spreadsheet for neatly-formatted input/output  and for graphical display of results, i.e., to function as a graphical user interface (GUI).  Meanwhile well-structured, readable, line-oriented code can be used for the more complicated calculations...........


Conclusion

Student response to use of VBA within other courses, both undergraduate and graduate, 
has been excellent.   Since all have had a structured programming course earlier (some in Fortran 
90, some in C++, others in Java), the migration to VBA is very straightforward.   Most welcome 
the opportunity to add another package to their inventory of proficiencies.  Several graduate students in a recent programming-intensive computational fluid dynamics (CFD) elected to do all 
assignments using Excel/VBA."

so there may be hope yet!

Except there is also a disclaimer;

" I am not a computer scientist or programmer, but rather an engineer.   That being the 
case, I have found VBA to be a quick and easy way to do most of the things I want to do in my 
teaching and research.  Code that you will find described here or available on the website is not 
guaranteed to be error free or even to follow good programming practice."

or - beware even expert engineers can muck up using this environment!

The journey continues .... ;)



Saturday 11 February 2012

First contact......

Not by me though :(

Not had time to do much other than a bit of Start Trek management "make it so" - thanks to Roy and Ian for this weeks efforts.

QA on version control started and first view of functional flow of the code starting to appear. This seems to me be a complete rats nest of logic switching between Excel sheet's to macro's (built in and user defined) to VBA code. How on Earth anyone could contemplate this sort of structure in the first place is a mystery to me. What do they teach on spreadsheet training courses! Then again I can probably guess.

Not only that - we have had to write a code to decode the code or in Roy's words;

"Source code formatting poor - created a small utility to auto-format so that (very) excessive conditional logic nesting could be traced"

Engage....

Saturday 4 February 2012

Version - controlled!

We have the server sorted (thank you Roy, Matt and Steve)!


The plan now is to put the various offending codes under strict version control for which Ian

http://www.ianbradshaw.co.uk/

had the answer. In his words;


"Depending what we want to do ... a Free version control such as Subversion may be easiest. This will also link nicely to windows world via TortoiseSVN so that it can be done cross platform. It's a bit less automatic than Microsoft solutions, but can cope with any language."


Sounds a bit geekish to me ;)

Will update on if its any use later......onwards and upwards!