DESIGN.md

This commit is contained in:
Gwendal Roué committed 2015-09-07 21:42:37 +02:00
1 parent 51293bfce2
commit fa15cfb30f
1 file changed
+6 -2
+6 -2
View File
@@ -1,8 +1,7 @@
The Design of GRDB.swift
========================
More than caveats or defects, there are a few glitches, or surprises in the GRDB.swift API. We try to explain them here. And eventually, explanations may lead to solutions :-)
More than caveats or defects, there are a few glitches, or surprises in the GRDB.swift API. We try to explain them here. The interested readers can take them as Swift challenges!
- **Why is RowModel a class, when protocols are all the rage?**
@@ -36,6 +35,11 @@ More than caveats or defects, there are a few glitches, or surprises in the GRDB
}
```
A second reason: the `databaseEdited` flag, which is true when a RowModel has unsaved changes, is easily provided by the base class RowModel. RowModel can manage its internal state *accross method calls*. Protocols could not provide this service without extra complexity.
Yet, don't miss the [RowConvertible](http://cocoadocs.org/docsets/GRDB.swift/0.12.0/Protocols/RowConvertible.html) and [DatabaseMapping](http://cocoadocs.org/docsets/GRDB.swift/0.12.0/Protocols/DatabaseTableMapping.html) protocols: they provide fetching from custom SQL queries and fetching by primary key for free.
- **Why are DatabaseQueue.inTransaction() and DatabaseQueue.inDatabase() not reentrant?**
TODO