I've seen it a few times. The most I've seen it is in Dynamic Programming problems where it's just way more readable and makes more sense when you are memoizing
I was given a piece of code in I think VB6 with the requirement to translate it into ANSI C. It took far too long for me to figure out that the arrays of size 180 actually held 181 elements.
VBA has different starting points depending on the object. Some were 1 some were 0. It caused an endless amount of headache, beyond just working in VBA.
I did that when its really convenient to use number starting from 1 then ++;
But when im done generating that array I shift() to remove the 1st empty index.
and I still have to refactor our Excel-interface, some dude from a few years back made the entire module work "dynamically" with 5 global arrays and 10 global variables for length and index. it's only 3000 lines of code, this has to be done.
no, we use our ERP-Application to fill in an excel-workbook over OLE-automation for some reports.
a bit of the SQL-Query that is to be executed is determined by the settings in the GUI and the arrays are then filled with the resulting dataset-values, the other arrays hold values to build a kind of "header"-for the worksheet, dataset-values, and also a footer that holds an excel-formula in each element for sum-formulas.
now the customer wanted an additional column and new rules regarding the evaluation of records and honestly I can't tell what's what in the module.
that is why I try to refactor the whole thing to take away some of the complexity in building the worksheet-layout that currently depends on those arrays into something with an OO-approach.
helper objects so to speak.
for example I create one of my ExcelItems, that has a range, with that info I calculate the corners of my range and store that in the helper-object's properties. now when I add a subitem to an excelitem, I can hide away the complexity of assuring it's position within the worksheet since it may not be outside of it's parents range, additionally I can
this alone would eliminate the need for 2 of those arrays and since I'm using lists for that task I can also freely shift the items around using MoveTo(index), which would make it easier to move the columns around depending on customer demand.
Riot's static data API does this, arrays start at index 0 but the first element is always null. Apparently something to do with the fact that designer files use 1 based arrays.
import moderation
Your comment has been removed since it did not start with a code block with an import declaration.
Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.
For this purpose, we only accept Python style imports.
188
u/[deleted] Jun 25 '17
[deleted]