Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Talk:SpreadSheet

Discussion page of SpreadSheet

Thuan - 23.02.2009

Question

Hi aChinh,

Since I don't know about the SpreadSheet module, I cannot give any opinion. However, there is one thing about the evaluating value for a cell: As far as I know, Excel evaluates cell values from the bottom to the top (http://stackoverflow.com/questions/314943/what-algorithm-does-excel-use-to-recalculate-formulas), and I think that our spreadsheet is the same. I remembered that Dennis once said that the way our spreadsheet evaluate cells is not optimized. However it is more than 3 years ago and although I tried to recall, I couldn't remember more. So I sorry that I am not sure about what I wrote down in this email. I just tried to inform you what I know :-P

Answer

Hi Thuan,

Thanks for the information.

For your information:

It is true that the current implementation is not optimized, lot of loops through the DataSet for:

  • Refine the expression (remove the equal sign, add the semicolon)
  • Getting expression, building the Index/Formula pair (to feed the Interpreter)
  • Getting the Index/Values back, then loop again for setting the value back
  • Build the dependency tree
  • Validate expression, execute expression
  • Format the result
  • ....

And all that looping not in the same location while it should. So I try, in the new implementation, put all that actions to one loop only inside Cell class.

Cheers,

Trung Chính


Xuân Phương - 23.02.2009

Question

Hi all,

@a Chinh: I have read your design, it looks quite beautiful :D, thank you for giving us such a professional design. However there are some thing I don't understand and it could effect to our modules so please help me to clean up some confused things below.

1. About Cell object:

  • Do we have some thing called "Cell type"? because as I know there are more than one cell type: cgscript, significance, normal,..I don't know much about cell type but obviously the type normal and expression are differently.
  • I can see that you have ExpressionInfo object instead of ExpressionCell object, so whenever user reference to a cell, it have to call Analyse method to re-calculate its expressionInfor, mm?
  • Property Index: I think it should be ColumnName or NameIndex :-\

2. About IExpressionCalculator

  • What's the responsibility of AnalysExpression and ExecuteExpression methods? Why do we need AnalyseRangeAddress() method :-[

3. Sorry that I cannot see the API of Interpreter used for Spreadsheet.

4. About Setting value to a cell: I like the short way to push a cell into a spread sheet. However, I have a question about the code on line 3. If the expression is NOT OK, then the value is set to BLANK. How can we check it is OK or NOT OK. Do we need to take care what is wrong and how to keep it (wrong could be because of invalid format, reference to invalid cell, reference to invalid dcs column name...)

Currently they are some issues I can remember. I will contact you via msn if there is any additional comment.

@Mai: Thank you for informing us :). We might need to re-design the "expression table" project due to this new design

Regards, Xuan Phuong

Answer

Hi Phương,

Thanks for the comment. But first of all, I'd like to emphasize one more thing about the design: IT AIMS AT REPLACING THE CURRENT IMPLEMENTATION. So, I need to first understand what is the CURRENT IMPLEMENTATION. Unluckily, I'm rather new to the whole system. Hence, I decided not going too deep into one design at the beginning. Instead, I wiped off everything about the current system and started designing a stand-alone SpreadSheet and integrating it step-by-step to the system. And the first one is the Cross Diagram Generator. It is for sure that the current SpreadSheet could not cover all the cases. And I need feedback like yours for improving it.

I will try to answer in red below:

1. About Cell object:

  • Do we have some thing called "Cell type"? because as I know there are more than one cell type: cgscript, significance, normal,..I don't know much about cell type but obviously the type normal and expression are differently.

=> Sure, we will have, I'm still working on this design and might need helps from you.

  • I can see that you have ExpressionInfo object instead of ExpressionCell object, so whenever user reference to a cell, it have to call Analyse method to re-calculate its expressionInfor, mm?

=> The ExpressionInfo is created whenever a new expression is set into Text property of Cell object for validating expression and finding references.

  • Property Index: I think it should be ColumnName or NameIndex :-\

=> NameIndex sounds good to me, but not ColumnName because we are talking about cell.

2. About IExpressionCalculator

  • What's the responsibility of AnalysExpression and ExecuteExpression methods? Why do we need AnalyseRangeAddress() method :-[

  • AnalyseExpression is for validating the expression
  • ExecuteExpression is for calculating the value of expression
  • AnalyseRangeAddress is for parsing the range address (something like A1:C2) into a comma separated indexes (like A1,B1,C1,A2,B2,C2). Personally say, I don't like this processing, however the CGScript's Interpreter need to be fed with such thing.

3. Sorry that I cannot see the API of Interpreter used for Spreadsheet.

=> Sure, you cannot see it in the CatGlobe.SpreadSheet assembly. Because the assembly is independent of expression calculation, means that beside CGScript's Interpreter, we could have other different kinds of executor. The Interpreter, however is used inside class ExpressionCalculator that I've sent in another mail.

4. About Setting value to a cell: I like the short way to push a cell into a spread sheet. However, I have a question about the code on line 3. If the expression is NOT OK, then the value is set to BLANK. How can we check it is OK or NOT OK. Do we need to take care what is wrong and how to keep it (wrong could be because of invalid format, reference to invalid cell, reference to invalid dcs column name...)

=> There is an IsValid property that can tell if the expression is OK or NOT OK. In fact, what I'm trying to do is removing the burden of taking care of what is wrong and how to keep it from the developers. But, I do provide means for formatting the value the way you want. For example, if the expression return an exception, you can tell it to return "[ERROR]" or blank. This is however not a perfect solution, still working for a better one now.

Currently they are some issues I can remember. I will contact you via msn if there is any additional comment.

=> Let me know when you remember the issues.

Cheers,

Trung Chinh