I have just added the last features to the database application and squished the last bugs. I must admit that I feel proud when I look at this little program. The 77 KB of source code is probably miniscule compared to what other people are writing, but it's by far my biggest project so far. And I'm quite pleased with the result:
- User friendly GUI using wxWidgets.
- XML based database, making it easy to import/export data.
- Cryptography based on XTEA (in CBC mode) and MD5.
- Portability (should compile on Linux, Mac and MS Windows with only minor changes).
- Stability. I have written several test cases and spent a lot of time on error handling.
The thing I like the most i probably the XML library that I wrote. Using XML is neat because it is so flexible. And it's easy to import/export between different programs as well. A reader of this blog (Gamegod) suggested that XML might be too slow. Fortunately, the worst-case scenario is about 5000 records in the whole database, and only one search per second, so speed is not really a concern.
Writing and testing the program took a lot longer than expected, but I've heard that it's often like that in the software development business. Overall, I'm quite satisfied, but there are a number of things that I would probably do differently if I got another programming task like this one.
Language: C++I like C/C++, but now I'm beginning to understand why people like Python and similar languages so much. I spent too much time manually allocating memory and making sure it was released again and similar things that higher-level languages take care of automatically. I think Python might have been a better choice, even if I had to learn how to use it first. Its superior string and list handling capabilities would probably have saved me a lot of time.
Another thing about C++ is the long compile times. A typo, a misspelled identifier, a missing semi-colon etc. that cause the compiler to fail, is very time consuming and an interpreted language like Python would make development much faster. If I had an IDE with built-in syntax checking, that would help a lot, though.
IDE: Dev-C++Using Dev-C++ was nice in the beginning, but it has a lot of shortcomings and a few bugs. Using another IDE with better code completion features and better stability could have saved me quite a bit of time, especially because I'm quite new to most of these things and don't know the function names and their syntax by heart.
GUI library: wxWidgetswxWidgets is a nice library. It's easy to use and has a lot of features. However, combined with C++, the compile time becomes annoying. Using wxWidgets with Python would probably have been a better solution. Another thing is that I didn't know wxGlade when I started coding, so I spent a lot of time writing GUI code that could have been written for me automatically. wxGlade is a great tool and highly recommended if you use wxWidgets. On the other hand, I probably learned more about wxWidgets from writing the code myself than I would if I had used wxGlade right from the start.
wxWidgets' error handling, though, is an entirely different matter: it's virtually non-existent. This cuased me a lot of headaches when my program mysterioysly started to crash whenever I closed certain dialog windows. After hours of work, it turned out that you shouldn't make pointers to
wxSizer members of a
wxDialog. I don't know why, and I didn't find anything about it in the documentation. An error message from the library would have been very helpful, since I was left pretty much in the dark by the standard crash messages in Windows.
Anyway, I won't be programming much in the near future, so stay tuned even if you don't care about technical gibberish ;-)