Grid API Usability Test
Here are the results of the Grid API Usability test.
programming/2006-June/002530
- Goal
Determine how fast and easy it is to create a simple Grid-based application
- Process
Creating a simple Grid-based application and tracking the progress
Requirements
Application: CSV editor, that can load, edit and save CSV files
File format: numeric dense CSV with configurable separator and optional string row header and column headers
File->New (including start): open empty grid with some default size
new window also create a new document
File->Open dialog: selects a file with CSV or * extension, specifies
custom separator (",", ";", "<TAB>")
if contains row headers,
if contains column headers,
File->Save dialog: same as open dialog, headers taken from current view
File->Exit (or close [X]) closes current window, asking to save if dirty
Edit:
edit numeric values in central cells
delete/cut/copy/paste/clear/insert-blank column(s) or row(s) based on current selection
cut/copy/paste/clear (to Missing value) a range of cells
cleared cells contain a Missing value
Options
choose row and column headers: from file, otherwise choice of 0- or 1- or A- based enumeration
specify Missing value: 0, _, blank
CSV Edit
CSV Edit is an application submitted by OlegKobchenko. See help inside the package for notes on installation and details of implementation.
Download
csvedit-0.01.zip at
Oleg's J Page
Tracking
Initial version development time and issue tracking. The following categories are used
|
app |
general application code: menus, CSV processing, etc. |
|
grid |
grid-specific code |
|
doc |
using grid documentation |
Tracking log
| 00:10 | app | basic isigraph window with menu |
| 00:10 | grid | basic grid from grid_class.htm; column/row headers from grid_options.htm; - how to specify headers - PACK? HDRCOL, HDRROW, HDRTOP - why three header, should be 2, what's TOP? pack 'celldata HDRCOL' doesn't work, |
| 00:05 | doc | how do I specify headers? ...take a break; docs should have info how to set options next to options grid_options.htm; trying demo... not helping, because it's not standalone |
| 00:08 | grid | finally got headers: its 0 not i.20 for 0-based; works with and without pack -- what's pack for? grid seems to block menu shortcuts--no need to specify in code |
| 00:30 | app | basic reading file and populating grid using 'csv' script |
| 00:20 | app | debugging a stupid control error (elseif.) -- leaving basic read |
| 00:15 | app | fixed control error with different control: euristic headers read |
| 00:15 | grid | write using CSV write: problem: excessive quotes; handler for dirty/position? |
| 00:10 | doc | unclear how to enable grid_handler: in debugger, it's 1: -- should grid_gridhandler: error in help or impl -- grid_events.htm error in example: select. control |
| 00:30 | grid | dirty+indicator; position indicator status bar |
| 00:20 | app | check dirty with save option |
| 00:30 | grid | insert/append/delete column/row takes long time -- no API support |
| 00:10 | grid | missing value - no supported for DEL key in grid; DEL key sets only top-left cells to 0, others to blank. |
| 00:20 | app | fixed CSV output format: quote only comma, double quote |
| 00:20 | app | made help HTML; Is it possible to bind grid to non-form locale? |
| 00:40 | grid | edit headers - again, no support |
| 00:20 | grid | select row/column, fixed insert/edit headers; How to start editing with keyboard preserving content |
| 00:20 | app | finished help |
Summarizing,
'T K'=: (0&".&>@{. ; <@{:)|:;:;._2 (0 : 0)
10 app
10 grid
...
)
(~.K) ,. <@(24 60&#:)"0 K +//. T
+----+----+
|app |2 35|
+----+----+
|grid|2 43|
+----+----+
|doc |0 15|
+----+----+
Notes
I added some comments to these notes, and otherwise will try to address the points for the 601 release. (Marked [CB]) -- ChrisBurke 2006-06-26 03:00:41
Thanks Chris, I added a few reponses. (Marked [OK]) -- OlegKobchenko 2006-06-26 10:02:39
It's hard to find Grid on "User Contents" page. It could be re-groupped differently, e.g. why not next to Plot? Also why DLL and OCX is a package, and not next to WD? This page could also be 2 or 3 column, like Dictionary.
In examples, there is pack before grid__show, what is it for?
[CB] pack creates a 2-col dictionary of names and values. This can be passed to the grid object to define options.
[OK] it would be good to mention it on grid_methods.htm next to show
How to specify numeric vs. character cells? E.g. grid_types.htm does not talk about that.
[CB] the grid get this information from the data that is given. There is no specific numeric vs character type.
In grid_options.htm it would help to describe "top headers" (although it's in the picture, it's not immediately clear how they are different from column headers) in the line
HDRTOP top headersshould have info how to set options next to options grid_options.htm
what is the difference between setting option with grid__show and using commands
[CB] there is no difference, use whichever is more convenient.
grid demo does not show stand-alone snippets, so it's hard to relate it to stand-alone script, especially dinamic aspects, such as changing content programmatically. For example, there is the Flip button, but no idea how it works. Also the demo does not have things like event processing.
It kind of was a revalation that you need to specify menu shortcuts in two places: menu itself and a keyboard handler in code.
[CB] they are two different things. I guess they could be linked in the code, but you really are giving menu and keyboard as two ways to invoke an action.
[OK] I used to know that. But it was displaced with more envolved UI designs, like Swing, which treat these as unity
Status bar set does not work in Java FE
Absense of dirty flag is OK, because it's application specific
There is no undo support. This is typically done in control with hookup calls.
Discrepancy in grid_events.htm: grid_handler vs grid_gridhandler
[CB] it should be grid_gridhandler. The first is obselete, since it may conflict with other _handler events.
errors in grid_events.htm, in example: select. control
no API support to select/insert/delete whole rows, columns; select all
DEL key could have configurable missing value
DEL key sets to 0 only the top-left cell of selection; the rest is blank even in numeric cells
paste is not consistent, sometimes for a multicell clipboard pastes only one cell; needs an additional click to paste the matrix.
Is is possible to bind grid (where it takes pronouns at grid__show) from a non-form locale? If it's not its creator.
No support to edit headers
How to start editing a cell with keyboard preserving content (like double-click)
[CB] double click should work
[OK] but keyboard is very handy when typing. Excel uses F2, same as other Windows cell editors: Explorer--file rename, etc. See more at Methods vs Commands
Grid Esc key not working: doesn't end edit mode. In demo closes window.
[CB] this will be fixed before the release
Methods vs Commands
Grid Methods are high-level control functions, which modify the grid at large. For example, reading, writing data, setting selection, etc.
Note: on the same page there is a list of even handlers. I am not sure they are directly related to methods, since the user code is not supporsed to call them.
Grid Commands are yet undocumented functions which are invoked upon specific user actions with keyboard and mouse. For example, clear cells (DEL key), copy, paste, extend selection etc. Typically in editors, like wordprocesors, such commands are mapped to the user actions in a configurable way. It would be good to document them so that they can be used custom applications. For example, a command to start edit mode could be hooked up to a keyboard command (typically F2 on Windows and Enter on Mac).
CSV Grid
An interesting and useful exercise!
Here is another quick and dirty implementation, in the public repository. Download and load
csvgrid.ijs, then:
run_pcsvgrid_''
and select a Demo to populate the grid.
I did not time individual steps, but it was roughly 4 hours app and 1 hour on the rest (grid + doc).
There are some features in CSV Edit not in CSV Grid, and vice versa.
Notes
Much of this functionality should be added to the core Grid code, for example:
support missing value
insert/add/delete row or column, plus corresponding change to header
import/export to CSV, semicolon or TAB-delimited file, or Excel
undo
Missing values need 3 definitions: value in file, value in actual data and value shown in grid. Where data is all numeric (as in the specs), the missing value in data itself has to be numeric (e.g. __).
It would be nice to have an method for defining cell type, for example, CSV files where the second row gives column type.
Other comments are appended to Oleg's notes above.