Hoping to learn more about Symbian and meet some interesting people: should be good. I'll write something about it in a couple of days!
It's not working though. It's now broken (the navigation bars underneath the content). Grrrr. Any hints?
Gilgamesh will be coded in Java, specifically in J2ME as a 'MIDlet suite'. I'm on a steep learning curve with Wireless Java myself, so if these terms are unfamiliar, don't worry: I've given some references in the table below, and I'll be blogging links to useful Java and Symbian documentation now and then.
Why Java? C++ is another viable alternative for the platform (Symbian 7.0 with
UIQ, e.g. Sony Ericsson P800), and might be considered more reasonable for the
application (A complex spreadsheet could get quite computationally intense).
My personal reasons were "I don't know C++", and "I like Java, and I want to
learn more of it".
If you really want to know, I'd have rather coded in Perl, but that's not
supported on the P800...
Tool | Version | Description | Download | Additional info | |
---|---|---|---|---|---|
Java 2 SDK | 1.4.1 | The Java compiler, tools, and API documentation. Vital of course |
java.sun.com/
(You will want to download the documentation too) |
Lots of info at
java.sun.com" including various
tutorials
Recommended books: O'Reilly's Java in a Nutshell.
(Not a tutorial: there are plenty of good ones about, but don't even think about the awful Chris Wright 'Teach Yourself Java')
|
|
Java 2 Micro Edition Wireless Toolkit | 1.0.3 | Contains the subsets of Java language and API specified by J2ME (Micro Edition). Includes a compiler called ktoolbar which makes sure that your code sticks to that set. It also has emulators to show you what the application will (probably) look like running on a phone or PDA. | java.sun.com/products |
Lots of info at
wireless.java.sun.com
I've bought Jonathan Allin's Wireless Java for Symbian Devices and the Java series Programming Wireless Devices with the Java 2 Platform, Micro Edition which had good reviews. Both seem useful but I'm not yet at the stage of having used them a great deal. |
|
UIQ SDK | 1 | Development Kit for the Symbian 7.0 based UIQ User Interface. This is a massive download (which I haven't yet made as I'm on a dialup connection, and I'm hoping to blag a CD at the Exposium... |
http://www.symbian.com/developer/ http://www.ericsson.com/mobilityworld/ (you need to register the Ericsson Mobility World developer programme: this is free.) |
Lots of information from
Symbian,
Sony Ericsson mobility world,
UIQ.
It's worth joining the developer programmes so that you can read their white papers and download tools. | |
Ant | 1.5.3 | Ant is an automated build tool, similar to make.
It's Java's de facto project build tool, and very easy to use.
A single command can:
|
ant.apache.org | The Ant documentation is quite good. Worth reading the article Ant in Anger (also bundled with the download). Apparently Erik Hatcher and Steve Loughran's Java Development with Ant is worth reading, but I've not bought it yet. | |
junit | 3.8.1 | junit is a unit-testing framework, which is now pretty much standard with Java. It makes it easy to write regression tests which is A Good Thing. Project Gilgamesh will require unit tests to exist for all classes. | www.junit.org |
junit comes with some excellent documentation.
The Ant book site has a freely available chapter on using Ant with junit. Oreilly's Java Extreme Programming Cookbook has a free chapter on junit available for download. 12 reasons to write unit tests is a nice introduction to the benefits of unit testing. | |
javadoc | n/a | javadoc is a standard tool with the Java SDK. All classes submitted to Project Gilgamesh must be well documented (for the appropriate definition of 'well'. More details in due course). | n/a |
javadoc -help
The Java SDK has pages of information about Javadoc under "Tool Docs" - "Javadoc Tool Page" and especially under "Javadoc Tool Reference Page (~your platform~)". |
|
CVS | 1.11.5 (client) | cvs (Concurrent Versioning System) is a
source control system. This means that one or more developers can look at
the same Java source and make changes to any part safely (because changes
can be tracked, rolled back, etc.)
Source Control, like automated testing, is A Good Thing. So far, Gilgamesh is not available on a CVS server. This should be rectified over the next few weeks (but I could do with some help setting it up.) |
www.cvshome.org | cvshome has plenty of documents: I'm have to admit that I find the documentation very confusing by the documentation: the concepts are fine, but it takes a leap to understand what's going on. So hand-holding on CVS for me and other CVS newbiew would be really appreciated... This introduction seems about as straight-forward as I can find. The manual is complete but opaque for the beginner. | |
Java Editor / IDE | n/a | I'm using gvim with ctags to edit my Java source files. But this isn't obligatory. I'm interested in learning more about Eclipse (free) and Intellij IDEA (not free). | www.vim.org
ctags.sourceforge.net |
But of course this is an oversimplification. We don't just need a list of cells that we reference: we need to know how they interact with the formula. The formula will need to be parsed into a tree of data relatingA +------+ 1| 1 | +------+ 2|A1*2 | <-- references: A1 +------+ 3|A1+A2 | <-- references: A1,A2 +------+
The last example shows a more complicated example, demonstrating that parsing the syntax could be quite intense. Of course, even a standard, commercial product like Excel simplifies the syntax by making it more functional:A1+A2 - function(+) - ref(A1) - ref(A2) if(A1==23 then "Yes" else "No) - function(if) - function(equals) - ref(a1) - constant(23) - constant("Yes") - constant("No")
As you can see, this is much more easily translated into the parse-tree above.if(equals(A1, 23), "Yes", "No") // Excel syntax
It looks a bit odd if you're not used to it, but it's trivial to build the parser. My first design idea is this:(function arg1 arg2 arg3 ...) Converting the formulae above: (+ A1 A2) (if (equals A1 A2) "Yes" "No")
=1 + 2 // arithmetic operators come inline =function(arg, arg) // functions as standard =A1 // reference unchanged
The Function class will have a simple interface something like:(if (= A1, 23), "Yes", "No) - Formula: - Function: if - Formula------------. - Constant: "Yes" \ - Constant: "No" \ - Function: = - Reference: A1 - Constant: 23
and is extended by subclasses like so:public abstract class Function { public String display; public boolean CheckArgs(Value[] args) { // ... (filled in by subclass) } public Value execute(Value[] args) { // ... (filled in by subclass) } }
public class EqualsFunction extends Function { public EqualsFunction() { display = "="; } public boolean CheckArgs(Value[] args) { if (args.size == 2) { return true; } else { return false; } } public Value execute(Value[] args) { if args[0].equals(args[1]) { return BooleanValue.TRUE; } else { return BooleanValue.FALSE; } } }
This might well be too heavyweight for being on a J2ME constrained device. But I think it will have its advantages: we'll see as we go on and try to optimize later if we need to. More on this topic later.
1 2 3 4 5 ..30 +-+-+-+-+-+--- 1| | | | | | +-+-+-+-+-+--- 2| | | | | | +-+-+-+-+-+--- 3| | | | | | +-+-+-+-+-+--- 4| | | | | | :+-+-+-+-+-+--- :| | | | | | 30 : : : : :
Already, this seems to have some advantages, in that some rows may have more data than others. We don't have to store cells that don't exist (i.e. it's a sparse data-structure). Once we start thinking about rows of data, this leads to some other considerations:+-+ +-+-+ |1|->| | | +-+ +-+-+ |2|->| | +-+ +-+-+-+-+ |3|->| | | | | +-+ +-+-+-+-+ |4|->| | | +-+ +-+-+-+-+-+ |5|->| | | | | | +-+ +-+-+-+-+-+ |6|->| | | +-+ +-+-+ : : :
If we add a rowA B C +---+---+-----+ 1| | |A2+B2| +---+---+-----+ 2| 3| 5| | +---+---+-----+
I'd expect the reference in cell C1 to now point to A3+B3. Hopefully there is a more elegant way for us to do this than to go through every cell in the grid updating the formulas.A B C +---+---+-----+ 1| | |A2+B2| <-- +---+---+-----+ 2| | | | +---+---+-----+ 3| 3| 5| | +---+---+-----+
Just because we've added or moved a row here or there doesn't change the other Cell objects, so we don't have to update the addressing at all: of course this implies that the referenced cell has a way of finding out its own address eventually:public class Cell { /** Cell has an Array of other Cell objects which it refers to */ Cell[] references; }
e.g. Cell object maintains references to its Row (Row 1) and its Column (Column B). Both the Row and the Column also contain references to the Cell object.+-+-+-+-+-+-+-+ B 1| | |X| | | | | +-+ +-+-+-+-+-+-+-+ | | ^ +-+ / |X| / ->+-+ +-+ / | | |X|------------ +-+ +-+
public class Cell { Line row; Line col; Cell[] references; }
If the Cell object needs to know its address, it can query the Row and the Column. All that needs to happen when Rows or Columns are inserted or moved is for them to be renumbered. This implies that the Grid contains
A B C +---+---+---+ 1| | |=A2| +---+---+---+ 2| 33| 12| |<-- delete this line +---+---+---+
A B C +---+---+---+ 1| | |=##|<-- error! +---+---+---+
Welcome to yet another blog about Symbian, and especially about a project which I've initiated, developing an open source Spreadsheet application for the platform, in particular for the pen-based UIQ desktop used by the Sony Ericsson P800.
Though Symbian is an OS for mobile phones and PDA's, that is, for small computing devices, I'm calling the project "Gilgamesh" (as in "the Epic of ...") Writing a spreadsheets might seem complicated at first glance: I've been thinking about it more or less constantly for the last 2 months and the project still seems immense...
I'm hoping that trying something on a scale I've never attempted before will be a great learning experience. Also that the blog and discussions around it will be an interesting working document about the challenges of designing and implementing a useable and powerful application for a computer with a screen the size of a train-ticket ;->