Why I hate C++
I figured I'd try to write a to-do list manager as a random side project. Tasks should be hierarchical, tasks should have dependencies, data should be stored locally, should have a pretty GUI around the whole thing. This doesn't sound hard, it should be something that I can get a first pass knocked off in about a weekend. Great.
I settled on C++ as an implementation language (I want something type-safe, Debian has no Haskell GUI libraries packaged, I know C++, OO code in C sucks a lot, and I kind of like Gtk). So I sat down and wrote a pretty simple data store for it. Bottom-up design and all that. So now I have a module where I can commit a new data state to it, and undo and redo. Oh yeah, and I wound up writing some basic code to do things like reference counting and callbacks when the state changed. Not hard or long, but it needed doing.
So now I start writing the GUI (using gtkmm) and I discover that I lose: to make a tree view of my hierarchical tasks, I either need to copy all of my data (eew) or write a custom TreeStore. There is no documentation for the latter. And the only way I can pass my store into the TreeView class is via a smart pointer...in the Glib reference-counting system...which is different from mine.
My options are now to either tie my data store into Glib (yuck), figure out how to write the custom tree data store object in C and tie it in (more yuck), figure out how to make my adaptor object Glib-refcounted (possible, I suppose, but TFM is pretty unhelpful). Or learn OCaml, or figure out how to compile and install gtk2hs. The last is increasingly sounding like a better use of my brain cells...
I settled on C++ as an implementation language (I want something type-safe, Debian has no Haskell GUI libraries packaged, I know C++, OO code in C sucks a lot, and I kind of like Gtk). So I sat down and wrote a pretty simple data store for it. Bottom-up design and all that. So now I have a module where I can commit a new data state to it, and undo and redo. Oh yeah, and I wound up writing some basic code to do things like reference counting and callbacks when the state changed. Not hard or long, but it needed doing.
So now I start writing the GUI (using gtkmm) and I discover that I lose: to make a tree view of my hierarchical tasks, I either need to copy all of my data (eew) or write a custom TreeStore. There is no documentation for the latter. And the only way I can pass my store into the TreeView class is via a smart pointer...in the Glib reference-counting system...which is different from mine.
My options are now to either tie my data store into Glib (yuck), figure out how to write the custom tree data store object in C and tie it in (more yuck), figure out how to make my adaptor object Glib-refcounted (possible, I suppose, but TFM is pretty unhelpful). Or learn OCaml, or figure out how to compile and install gtk2hs. The last is increasingly sounding like a better use of my brain cells...
Nothing to do with C++
(Anonymous) 2005-11-03 02:08 pm (UTC)(link)Murray